Giter VIP home page Giter VIP logo

ierlang's Introduction

Interactive Erlang Notebook

IErlang is an Erlang language kernel for IPython. It allows users to use IPython's Notebook frontend, except where IPython executes python code, IErlang can execute erlang code and compile and execute erlang modules.

This is on top of all of IPython's other frontend features like Markdown rendering, HTML rendering, saving notebooks for later use and even the ability to view IErlang Notebooks in IPython's NBViewer

Requirements:

  • Python 2.7 in your $PATH
  • Erlang installed with erl and escript in your $PATH
  • virtualenv installed
  • rebar installed
  • curl installed

Installation

You need only do the following to get started:

For Python 2.7.*

$ make demo

For Python 3.4.*

$ make demo3

This will do the following:

  • Get all Python deps and patch IPython for IErlang support
  • Get all Erlang deps and compile them
  • Compile IErlang
  • Start up an IErlang Notebook, loading a demo in your browser

Usage

Other make targets are also provided. Some notes about these:

  • make clean will remove the Python virtual environment as well as the compiled Erlang modules (ebin/*.beam).
  • If you just want to clean the Erlang files and leave the Python virtual environment in place, you may use make erlclean (or rebar clean, of course).
  • You don't have to start with the demo; you can be placed into the IPython web view of the notebooks directory where you can create new notebooks easily. Just use the make py2notebook target.
  • If you would like to run the demo again, but don't want to recompile everything, you may use the make demo-no-deps target.

Notes

Disclaimer

The development of this language kernel for IPython is at it's very early stages. This is Alpha. Take with a large pinch of salt. No sugar necessary, because it's pretty damn sweet! :)

IPython Workaround

Please note: in order to use IErlang, it is required to patch one of IPython's files. In IPython 2.0.0, this does not affect the usage of the original IPython.

Feedback

I am eager to receive feedback from anyone who has attempted to use IErlang. I would love to hear some thoughts on how to improve IErlang.

Resources

ierlang's People

Contributors

jimt avatar oubiwann avatar robbielynch avatar sdwolfz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ierlang's Issues

Expression results not returned

When I type in Erlang code into the notebook, the results are not returned (screenshot). I'm able to print in the terminal where I'm running make py2notebook though [2]. It seems as though the kernel computed the answer, but due to some reason it didn't send a response or the response wasn't properly interpreted and displayed by the web interface.

How can I enable more verbose logging on what's happening?

Here's my environment:

$ erl
Erlang/OTP 17 [erts-6.1] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]

Eshell V6.1  (abort with ^G)
1> erlang:system_info(otp_release).
"17"
2>
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
       (v)ersion (k)ill (D)b-tables (d)istribution
^C
$ python --version
Python 2.7.6

[2]: I'm able to see the printouts issued by In [17]: io:format("printing: ~p~n", [123 * 10]).

$ make py2notebook
  ! snip
Starting IErlang Notebook Demo...
2015-03-02 15:21:31.522 [NotebookApp] Using existing profile dir: u'/Users/erszcz/.ipython/profile_default'
2015-03-02 15:21:31.527 [NotebookApp] Using MathJax from CDN: https://cdn.mathjax.org/mathjax/latest/MathJax.js
2015-03-02 15:21:31.540 [NotebookApp] Serving notebooks from local directory: /Users/erszcz/work/ierlang/notebooks
2015-03-02 15:21:31.540 [NotebookApp] 0 active kernels
2015-03-02 15:21:31.540 [NotebookApp] The IPython Notebook is running at: http://localhost:8888/
2015-03-02 15:21:31.540 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
2015-03-02 15:21:36.019 [NotebookApp] Kernel started: 02bad31f-d160-469f-a76a-e1cfb2a1964e
[ERLANG KERNEL]
  ! snip
2015-03-02 15:23:36.013 [NotebookApp] Saving notebook at /Untitled0.ipynb
2015-03-02 15:25:36.021 [NotebookApp] Saving notebook at /Untitled0.ipynb
printing!n




printing!
printing: 1230
2015-03-02 15:27:36.023 [NotebookApp] Saving notebook at /Untitled0.ipynb
printing: 1230
printing: 1230

Rendering of output to stdout

Would love to see the IErlang Kernel handle output to stdout from io:format/1, io:format/2 etc.

Currently only the result ok of writing to stdout is shown,

In [1]: io:format("hello").

Out[1]: ok

, but no rendering of output on stdout.

Make the install process fully automated

Hey Robbie -- I'm loving IErlang :-) Nice work!

I just got it up and running tonight with the latest release of IPython. In order to get this to the point where it could be automated, I had to do several things:

  • Move the scripts over to a Makefile (the Erlang community projects tend to use Makefiles)
  • Automate use of virtualenv
  • Add support for rebar
  • Add support for patching the IPython session.py file

The first two I did in one branch and the second two I did in separate branches. I'll send along the PRs now ...

Module declaration not working for all valid module names

It seems that the Erlang kernel doesn't work for all valid module names (atoms).

This works.

-module(foo).

This doesn't work.

-module(foo2).

The second example doesn't result in an error or a warning other than In [*]: and the Erlang kernel must be manually restarted.

The above have been tested with Python 2.7.

$> make demo

I was not able to install and run with Python 3 on Mac OS X.

$> make demo3
Running virtualenv with interpreter /Users/karl/anaconda/bin/python3.4
Using base prefix '/Users/karl/anaconda'
New python executable in ./.venv-py3/bin/python3.4
Also creating executable in ./.venv-py3/bin/python
ERROR: The executable ./.venv-py3/bin/python3.4 is not functioning
ERROR: It thinks sys.prefix is '/Users/karl/Teaching/jupyter/ierlang' (should be '/Users/karl/Teaching/jupyter/ierlang/.venv-py3')
ERROR: virtualenv is not compatible with this system or executable
make: *** [.venv-py3/bin/python3.4] Error 100
$>

Remove requirement for virtualenv

It would be an improvement in usability if installing this did not require virtualenv.

I use pyenv to manage my virtualenv environments which doesn't have the same virtualenv creation commands. Ideally, with jupyter this kernel would be installable without any regard for which python version is involved at all. The iElixir kernel is a good example of what I'm talking about. https://github.com/pprzetacznik/IElixir

License

Currently, this project doesn't have a license defined. I'm starting to work on this again, however, without a license I'd rather start from scratch.

Add Python 3 Support

Python 3 is pretty much all I use these days. I'll give it a whirl and see if any issues pop up.

Create a language profile for Erlang

Instead of using the command line to provide the Kernel Manager commands, we should create a language profile for Erlang.

This can be done by running (inside venv):
ipython3 create profile erlang

The kernel profile profile_erlang will be created in:
~/.ipython/
This could be different on different machines.

The kernel settings should be set here.

Refer to here for more information

Installation errors on ubuntu

Tried installing on a fresh install of ubuntu. Errors with python libs and erlzmq compiling. Update to install script necessary. It worked after I ran these commands:

Install python dev libs to work on ipython/ierlang

sudo apt-get install libxml2-dev libxslt1-dev python-dev

C Stuff

sudo apt-get install build-essential manpages-dev

Make sure curl is installed. It doesn't come with ubuntu 14.04

sudo apt-get install curl

Move from IPython 2.x.x to Jupyter (IPython 3.x.x)

To keep up with IPython/Jupyter, it's necessary to move from IPython to Jupyter. There are some things that may not work with the updated Wire Protocol, and lots of putting square pegs in round holes, but it shouldn't be too much effort to get Jupyter to start with an erlang kernel because the heartbeat server hasn't changed and will keep the kernel alive.

CPU Utilisation is high

One thing I noticed when running in both console and notebook was that CPU utilization hovered around 90-95% on my laptop. Not sure if you've seen this too.

I'll try to dig into this at some point ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.