gophernotes/README.md

89 lines
4.0 KiB
Markdown
Raw Normal View History

2016-01-23 14:19:24 -06:00
![alt tag](https://raw.githubusercontent.com/gophergala2016/gophernotes/master/files/gophernotes2.jpg)
2016-01-23 06:11:05 -06:00
# gophernotes - Go in Notebooks
2016-01-23 22:28:14 -06:00
`gophernotes` is a Go kernel for [Jupyter](http://jupyter.org/) notebooks. Finally, we can have a reliable and maintained way to use Go interactively and code in the browser. Use `gophernotes` to create and share documents that contain live Go code, equations, visualizations and explanatory text. These notebooks, with the live Go code, can then be shared with others via email, Dropbox, GitHub and the [Jupyter Notebook Viewer](http://nbviewer.jupyter.org/). Go forth and do data science, or anything else interesting, with go notebooks!
2016-01-23 14:24:34 -06:00
This project came out of the [Gopher Gala](http://gophergala.com/) 2016. It is based on a REPL called [gore](https://github.com/motemen/gore) and on a, no longer maintained and self-described limited, ipython kernel call [iGo](https://github.com/takluyver/igo).
2016-01-23 06:12:06 -06:00
2016-01-23 17:12:57 -06:00
## Screenshots/Examples
2016-01-23 15:48:35 -06:00
2016-01-23 22:18:57 -06:00
### Simple interactive use:
2016-01-23 17:06:28 -06:00
2016-01-23 15:48:35 -06:00
![alt tag](https://raw.githubusercontent.com/gophergala2016/gophernotes/master/files/screencast.gif)
2016-01-23 17:12:57 -06:00
### Story telling and pattern recognition with Markdown and Golang:
2016-01-23 17:06:28 -06:00
![alt tag](https://raw.githubusercontent.com/gophergala2016/gophernotes/master/files/pr-screenshot.png)
2016-01-24 07:07:48 -06:00
### Example Notebooks (dowload and run them locally, follow the links to view in Github, or use the [Jupyter Notebook Viewer](http://nbviewer.jupyter.org/)):
2016-01-23 17:18:54 -06:00
- [Simple Printing and Channels](https://github.com/gophergala2016/gophernotes/blob/master/examples/Simple-Example.ipynb)
2016-01-23 16:59:40 -06:00
- [Pattern Recognition with Golearn](https://github.com/gophergala2016/gophernotes/blob/master/examples/Pattern-Recognition.ipynb)
2016-01-23 21:55:50 -06:00
- [Feed Forward, Recurrent Neural Nets](https://github.com/gophergala2016/gophernotes/blob/master/examples/Feed-Forward-Recurrent-NN.ipynb)
2016-01-23 20:18:18 -06:00
- [Time Parsing, Formatting](https://github.com/gophergala2016/gophernotes/blob/master/examples/Time-Formatting-Parsing.ipynb)
2016-01-23 20:44:05 -06:00
- [Stateful Goroutines](https://github.com/gophergala2016/gophernotes/blob/master/examples/Stateful-Goroutines.ipynb)
2016-01-24 07:06:36 -06:00
- [Worker Pools](https://github.com/gophergala2016/gophernotes/blob/master/examples/Worker-Pools.ipynb)
2016-01-23 15:51:10 -06:00
2016-01-23 16:02:31 -06:00
## Jupyter Installation/Usage
2016-01-24 14:05:12 -06:00
- Make sure jupyter notebook and `libzmq-dev` are installed. See [here](http://jupyter.readthedocs.org/en/latest/install.html) for more details on installing jupyter.
2016-01-24 06:22:49 -06:00
- Install `goimports` if you haven't already:
```
go get golang.org/x/tools/cmd/goimports
```
2016-01-23 16:02:31 -06:00
- Get the kernel:
2016-01-23 16:03:49 -06:00
2016-01-23 16:02:31 -06:00
```
go get github.com/gophergala2016/gophernotes
```
2016-01-23 16:03:49 -06:00
2016-01-23 16:02:31 -06:00
- Create a directory for the new kernel config:
2016-01-23 16:03:49 -06:00
2016-01-23 16:02:31 -06:00
```
mkdir -p ~/.ipython/kernels/gophernotes
```
2016-01-23 16:09:45 -06:00
- Copy the kernel config into the `.ipython` directory:
```
cp -r $GOPATH/src/github.com/gophergala2016/gophernotes/kernel/* ~/.ipython/kernels/gophernotes
```
- Start the jupyter notebook:
```
jupyter notebook
```
- Select `Golang` from the `New` drop down menu.
- Have Fun!
Possible Issues:
- Depending on your environment, you may need to manually change the path to the `gophernotes` executable in `kernel/kernel.json` before copying it to `~/.ipython/kernels/gophernotes`. You can put the **full path** to the `gophernotes` executable here, and you shouldn't have any further issues.
2016-01-23 18:09:05 -06:00
## Custom commands
Some of the custom commands from the [gore](https://github.com/motemen/gore) REPL have carried over to `gophernotes`. Note in particular the syntax for importing packages:
2016-01-23 18:07:24 -06:00
```
:import <package path> Import package
:print Show current source
:write [<filename>] Write out current source to file
:help List commands
```
2016-01-23 17:12:57 -06:00
## Gopher Gala Status
2016-01-23 06:12:06 -06:00
2016-01-23 09:12:25 -06:00
- ~~Rewrite of some of the gore functionality to process messages from the notebook.~~
2016-01-23 11:04:48 -06:00
- ~~Implement more intuitive error handling in the notebook, test the suite of functionality in the Jupyter notebook.~~
2016-01-23 15:02:47 -06:00
- ~~Refactor, loggings~~
2016-01-23 17:18:22 -06:00
- ~~Examples, screenshots, installation~~
2016-01-24 00:17:56 -06:00
- ~~Troubleshoot errors, unit testing~~
2016-01-24 00:34:18 -06:00
- ~~Godep~~
- Dockerfile
2016-01-24 14:21:26 -06:00
## License
[MIT-style](LICENSE.md).