Popularity
8.3
Stable
Activity
0.0
Stable
2,347
48
156

Programming language: Go
License: BSD 3-clause "New" or "Revised" License

lgo alternatives and similar packages

Based on the "Other Software" category.
Alternatively, view lgo alternatives based on common mentions on social networks and blogs.

  • syncthing

    Open Source Continuous File Synchronization
  • hugo

    10.0 9.8 lgo VS hugo
    The world’s fastest framework for building websites.
  • The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
    Promo workos.com
    WorkOS Logo
  • croc

    Easily and securely send things from one computer to another :crocodile: :package:
  • restic

    Fast, secure, efficient backup program
  • Seaweed File System

    SeaweedFS is a fast distributed storage system for blobs, objects, files, and data lake, for billions of files! Blob store has O(1) disk seek, cloud tiering. Filer supports Cloud Drive, cross-DC active-active replication, Kubernetes, POSIX FUSE mount, S3 API, S3 Gateway, Hadoop, WebDAV, encryption, Erasure Coding. [Moved to: https://github.com/seaweedfs/seaweedfs]
  • Gor

    9.8 4.8 lgo VS Gor
    GoReplay is an open-source tool for capturing and replaying live HTTP traffic into a test environment in order to continuously test your system with real data. It can be used to increase confidence in code deployments, configuration changes and infrastructure changes.
  • rkt

    9.7 0.4 lgo VS rkt
    An App Container runtime that integrates with init systems, is compatible with other container formats like Docker, and supports alternative execution engines like KVM.
  • limetext

    Open source API-compatible alternative to the text editor Sublime Text
  • toxiproxy

    :alarm_clock: :fire: A TCP proxy to simulate network and system conditions for chaos and resiliency testing
  • Comcast

    Simulating shitty network connections so you can build better systems.
  • LiteIDE

    9.5 5.8 L1 lgo VS LiteIDE
    LiteIDE is a simple, open source, cross-platform Go IDE.
  • confd

    Manage local application configuration files using templates and data from etcd or consul
  • drive

    Google Drive client for the commandline
  • nes

    9.2 2.3 lgo VS nes
    NES emulator written in Go.
  • scc

    9.1 8.2 lgo VS scc
    Sloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go
  • Duplicacy

    A new generation cloud backup tool
  • heka

    DEPRECATED: Data collection and processing made easy.
  • blocky

    Fast and lightweight DNS proxy as ad-blocker for local network with many features
  • fleet

    A Distributed init System.
  • Docker

    Notary is a project that allows anyone to have trust over arbitrary collections of data
  • myLG

    Network Diagnostic Tool
  • Juju

    Orchestration engine that enables the deployment, integration and lifecycle management of applications at any scale, on any infrastructure (Kubernetes or otherwise).
  • Stack Up

    Super simple deployment tool - think of it like 'make' for a network of servers
  • snap

    The open telemetry framework
  • GoBoy

    Multi-platform Nintendo Game Boy Color emulator written in Go
  • Circuit

    Circuit: Dynamic cloud orchestration http://gocircuit.org
  • Documize

    Modern Confluence alternative designed for internal & external docs, built with Go + EmberJS
  • borg

    Search and save shell snippets without leaving your terminal
  • GoDNS

    A dynamic DNS client tool that supports AliDNS, Cloudflare, Google Domains, DNSPod, HE.net & DuckDNS & DreamHost, etc, written in Go.
  • vFlow

    Enterprise Network Flow Collector (IPFIX, sFlow, Netflow)
  • Plik

    Plik is a temporary file upload system (Wetransfer like) in Go.
  • shell2http

    Executing shell commands via HTTP server
  • peg

    7.4 3.6 lgo VS peg
    Peg, Parsing Expression Grammar, is an implementation of a Packrat parser generator.
  • portal

    Portal is a quick and easy command-line file transfer utility from any computer to another.
  • Gokapi

    Lightweight selfhosted Firefox Send alternative without public upload. AWS S3 supported.
  • Go Package Store

    An app that displays updates for the Go packages in your GOPATH.
  • Leaps

    A pair programming service using operational transforms
  • Postman

    CLI tool for batch-sending email via any SMTP server.
  • Guora

    🖖🏻 A self-hosted Quora like web application written in Go 基于 Golang 类似知乎的私有部署问答应用 包含问答、评论、点赞、管理后台等功能
  • gfile

    Direct file transfer over WebRTC
  • gocc

    Parser / Scanner Generator
  • Gebug

    Debug Dockerized Go applications better
  • mockingjay

    Fake server, Consumer Driven Contracts and help with testing performance from one configuration file with zero system dependencies and no coding whatsoever
  • sake

    :robot: sake is a task runner for local and remote hosts
  • ipe

    6.4 0.0 lgo VS ipe
    An open source Pusher server implementation compatible with Pusher client libraries written in GO
  • yai

    6.4 8.1 lgo VS yai
    Your AI powered terminal assistant.
  • woke

    Detect non-inclusive language in your source code.
  • GoNB

    GoNB, a Go Notebook Kernel for Jupyter
  • ide

    6.0 0.0 lgo VS ide
    A Go code editor. With debugging and Autocomplete. 一个 Go 代码编辑器,具有 DEBUGGING 和 AUTOCOMPLETE
  • tcpprobe

    Modern TCP tool and service for network performance observability.

Do you think we are missing an alternative of lgo or a related project?

Add another 'Other Software' Package

README

lgo Binder Go Report Card

Go (golang) Jupyter Notebook kernel and an interactive REPL

Disclaimer

Since go1.10, this Go kernel has performance issue due to a performance regression in Go tool chain.

Also, this Go kernel can not be built with go1.12 due to another regression in Go tool chain.

Now, the compiler options this kernel relies on are completely broken and I'm not sure when they will fix the regressions. Unfortunately, they don't plan to fix this in go1.13 as of July 8th 2019. If you are interested in using this kernel, please upvote the bugs. For a while, please use other Go kernels if you want to use the later version of Go with Jupyter notebook.

Medium Post

Features

  • Write and execute Go (golang) interactively like Python.
  • Jupyter Notebook integration
  • Full Go (golang) language spec support. 100% gc (go compiler) compatible.
  • Code completion and inspection in Jupyter Notebooks
  • Display images, HTML, JavaScript, SVG, etc...
  • Currently, lgo is only supported on Linux. But you can use lgo on Mac and Windows with virtual machines or Docker.

Jupyter notebook examples

You can view example notebooks of lgo from Example notebooks on Jupyter nbviewer

If you want to execute these notebooks, you can try these notebooks on your browser without installation from Binder

Try lgo from your browser without installation

Binder

Thanks to binder (mybinder.org), you can try lgo on your browsers with temporary docker containers on binder. Open your temporary Jupyter Notebook from the button above and enjoy lgo.

Quick Start with Docker

  1. Install Docker and Docker Compose.
  2. Clone the respository and run the docker container with docker-compose. > git clone https://github.com/yunabe/lgo.git > cd lgo/docker/jupyter > docker-compose up -d

If you want to use a port other than 8888 on host, update ports config in lgo/docker/jupyter/docker-compose.yaml before running docker-compose up.

  1. Get the URL to open the Jupyter Notebook > docker-compose exec jupyter jupyter notebook list Currently running servers: http://0.0.0.0:8888/?token=50dfee7e328bf86e70c234a2f06021e1df63a19641c86676 :: /examples
  2. Open the Jupyter Notebook server with the authentication token above.

Linux/Mac OS

If you are using Linux or Mac OS, you can use start/stop scripts instead. Web browser will open the URL automatically.

# start server
> ./up.sh
# stop server
> ./down.sh

Install

Prerequisites

Install

  • go get github.com/yunabe/lgo/cmd/lgo && go get -d github.com/yunabe/lgo/cmd/lgo-internal
    • This installs lgo command into your $(go env GOPATH)/bin
  • Set LGOPATH environment variable
    • lgo install will install binaries into the directory specified with LGOPATH.
    • You can use any empty directory with write permission as LGOPATH.
  • Run lgo install
    • This installs std libraries and the internal lgo tool into LGOPATH with specific compiler flags.
    • If lgo install fails, please check install log stored in $LGOPATH/install.log
  • (Optional) Run lgo installpkg [packages] to install third-party packages to LGOPATH
    • You can preinstall third-party packages into LGOPATH.
    • This step is optional. If packages are not preinstalled, lgo installs the packages on the fly.
    • But, installing packages is a heavy and slow process. I recommend you to preinstall packages which you will use in the future with high probability.
    • If lgo installpkg fails, please check the log stored in $LGOPATH/installpkg.log.
    • See go's manual about the format of [packages] args.
  • Install the kernel configuration to Jupyter Notebook
    • python $(go env GOPATH)/src/github.com/yunabe/lgo/bin/install_kernel
    • Make sure to use the same version of python as you used to install jupyter. For example, use python3 instead of python if you install jupyter with pip3.
  • (Optional) If you want to use lgo with JupyterLab, install a jupyterlab extension for lgo
    • jupyter labextension install @yunabe/lgo_extension
    • This extension adds "Go Format" button to the toolbar in JupyterLab.

Usage: Jupyter Notebook

  • Run jupyter notebook command to start Juyputer Notebook and select "Go (lgo)" from New Notebook menu.
  • To show documents of packages, functions and variables in your code, move the cursor to the identifier you want to inspect and press Shift-Tab.
  • Press Tab to complete code
  • Click Format Go button in the toolbar to format code.
  • lgo works with JupyterLab. To use lgo from JupyterLab, install JupyterLab and run jupyter lab.

Usage: REPL console

You can use lgo from command line with Jupyter Console or build-in REPL mode of lgo

Jupyter Console (Recommended)

Run jupyter console --kernel lgo

In [1]: a, b := 3, 4

In [2]: func sum(x, y int) int {
      :     return x + y
      :     }

In [3]: import "fmt"

In [4]: fmt.Sprintf("sum(%d, %d) = %d", a, b, sum(a, b))
sum(3, 4) = 7

built-in REPL mode

Run lgo run

$ lgo run
>>> a, b := 3, 4
>>> func sum(x, y int) int {
...     return x + y
...     }
>>> import "fmt"
>>> fmt.Sprintf("sum(%d, %d) = %d", a, b, sum(a, b))
sum(3, 4) = 7

Tips

go get and lgo

The packages you want to use in lgo must be prebuilt and installed into $LGOPATH by lgo install command. Please make sure to run lgo install after you fetch a new package with go get command.

Update go version

Please run lgo install --clean after you update go version.

lgo install installs prebuilt packages into $LGOPATH. When you update go version, you need to reinstall these prebuilt packages with the newer go because binary formats of prebuilt packages may change in the newer version of go.

Display HTML and images

To display HTML and images in lgo, use _ctx.Display. See the example of _ctx.Display in an example notebook

Cancellation

In lgo, you can interrupt execution by pressing "Stop" button (or pressing I, I) in Jupyter Notebook and pressing Ctrl-C in the interactive shell.

However, as you may know, Go does not allow you to cancel running goroutines with Ctrl-C. Go does not provide any API to cancel specific goroutines. The standard way to handle cancellation in Go today is to use context.Context (Read Go Concurrency Patterns: Context if you are not familiar with context.Context in Go).

lgo creates a special context _ctx on every execution and _ctx is cancelled when the execution is cancelled. Please pass _ctx as a context.Context param of Go libraries you want to cancel. Here is an example notebook of cancellation in lgo.

Memory Management

In lgo, memory is managed by the garbage collector of Go. Memory not referenced from any variables or goroutines is collected and released automatically.

One caveat of memory management in lgo is that memory referenced from global variables are not released automatically when the global variables are shadowed by other global variables with the same names. For example, if you run the following code blocks, the 32MB RAM reserved in [1] is not released after executing [2] and [3] because

  • [2] does not reset the value of b in [1]. It just defines another global variable b with the same name and shadows the reference to the first b.
  • [3] resets b defined in [2]. The memory reserved in [2] will be released after [3]. But the memory reserved in [1] will not be released.
[1]
// Assign 32MB ram to b.
b := make([]byte, 1 << 25)
[2]
// This shadows the first b.
b := make([]byte, 1 << 24)
[3]
// This sets nil to the second b.
b = nil

go1.10

lgo works with go1.10. But the overhead of code execution is 4-5x larger in go1.10 than go1.9. It is due to a regression of the cache mechnism of go install in go1.10. I recommend you to use lgo with go1.9 until the bug is fixed in go1.10.

Comparisons with similar projects

gore

gore, which was released in Feb 2015, is the most famous REPL implementation for Go as of Dec 2017. gore is a great tool to try out very short code snippets in REPL style.

But gore does not fit to data science or heavy data processing at all. gore executes your inputs by concatinating all of your inputs, wrapping it with main function and running it with go run command. This means every time you input your code, gore executes all your inputs from the begining. For example, if you are writing something like

  1. Loads a very large CSV file as an input. It takes 1 min to load.
  2. Analyzes the loaded data. For example, calculates max, min, avg, etc..

gore always runs the first step when you calculate something and you need to wait for 1 min every time. This behavior is not acceptable for real data science works. Also, gore is not good at tyring code with side effects (even fmt.Println) because code snippets with side effects are executed repeatedly and repeatedly. lgo chose a totally different approach to execute Go code interactively and does not have the same shortcoming.

gore is a CLI tool and it does not support Jupyter Notebook.

gophernotes

lgo gophernotes
Backend gc (go compiler) An unofficial interpreter
Full Go Language Specs :heavy_check_mark:
100% gc compatible :heavy_check_mark:
Static typing :heavy_check_mark: to some extent
Performance Fast Slow
Overhead 500ms 1ms
Cancellation :heavy_check_mark:
Code completion :heavy_check_mark:
Code inspection :heavy_check_mark:
Code formatting :heavy_check_mark:
Display HTML and images :heavy_check_mark:
Windows, Mac Use Docker or VM Partial
License BSD LGPL

gophernotes was the first Jupyter kernel for Go, released in Jan 2016. Before Sep 2017, it used the same technology gore uses to evaluate Go code. This means it did not fit to heavy data processing or data analysis at all. From Sep 2017, gophernotes switched from go run approach to gomacro, one of unofficial golang interpreters by cosmos72. This solved the problem gore has. Now, the code execution mechnism of gophernotes also fits to heavy data analysis.

The shortcomings of using an unofficial interpreter are

  • It does not support all Go language features. Especially, it does not support one of the most important Go feature, interface. As of go1.10, it is hard to support interface in an interpreter written in Go because of the lack of API in reflect package.
  • Interpreters are generally slow.
  • Unofficial interpreters are not well-tested compared to the official gc (go compiler) tools.

The advantages of this approach are

  • The overhead of code execution is small because it does not compile and link code.
  • Windows/Mac partial support. lgo works only on Linux and you need to use VMs or Docker to run it on Windows/Mac. gophernotes (gomacro) works on Windows/Mac natively if you do not need third-party packages.

These disadvantage and advantages are not something inevitable in interperters. But they are not easy to solve under the limited development resource.

Also, lgo kernel supports more rich features in Jupyter Notebook as of Dec 2017, including code completion, code inspection and images/HTML/JavaScript output supports.

Troubleshooting

Dead kernel

Symptom

Got an error message like:

Kernel Restarting
The kernel appears to have died. It will restart automatically.

Solutions

First, please confirm your code does not call os.Exit directly or indirectly. In lgo, your code is executed in the processs of lgo kernel. If you evaluate os.Exit in lgo, it terminates the lgo kernel process and jupyter notebook server loses the connection with the kernel. Thus, you must not evaluate os.Exit or functions that call it internally (e.g. log.Fatal) in lgo.

If os.Exit is not the reason of "Dead kernel", please check crash logs of the kernel. If you run your notebook with jupyter notebook command in a terminal, the crash log should be there. If you run your notebook in docker, attach the container's terminal with docker attach to view the logs. If you can see the logs of jupyter notebook, you should see logs like

2018/03/01 20:30:45 lgo-internal failed: exit status 1
[I 22:34:00.500 NotebookApp] KernelRestarter: restarting kernel (1/5)
kernel abcd1234-5678-efghi-xxxx-777eeffcccbb restarted

and you can probably see helpful information before lgo-internal failed message.

multiple roots

Sympton

Got an error message like:

multiple roots $LGOPATH/pkg &
Failed to build a shared library of github.com/yunabe/lgo/sess7b..7d/exec1: exit status 1

Solutions

This error occurs when the go command you are currently using is different from the go command you used to run lgo install. For example, this happens if you update go from 1.9 to 1.10 but did not run lgo install --clean with the new go after the update.

If you encouter this issue, please double-check that you are using go which you used to run lgo install to install packages into $LGOPATH.

old export format no longer supported

Symptom

Got error messages like:

could not import github.com/yunabe/mylib (/home/yunabe/local/gocode/pkg/linux_amd64/github.com/yunabe/mylib.a: import "github.com/yunabe/mylib": old export format no longer supported (recompile library))

Reason and Solution

Some libraries installed in your $GOPATH are in the old format, which are built go1.6 or before. Make sure all libraries under your $GOPATH are recompiled with your current go compiler.

cd $GOPATH/src; go install ./...


*Note that all licence references and agreements mentioned in the lgo README section above are relevant to that project's source code only.