Skip to main content

Elm Magic provides IPython magic commands that execute elm-lang code

Project description

Elm Magic

:Author: Ali Rathore

Introduces a %%elm magic.

Compile and display Elm code in IPython and Jupyter notebooks

.. image::

.. image::

.. image::

.. image::
:alt: Documentation Status

.. image::
:alt: Updates

Elm Magic provides IPython magic commands that execute elm-lang code


.. code-block:: python

In [1]: %load_ext elm_magic

In [2]: %%elm
...: import Html exposing (text)
...: main =
...: text "Hello World"
...: Hello World

In [3]: %%elm -i elm-lang/http elm-lang/mouse -w /tmp/myelmdir
...: <elm source code>

This magic will:
(1) use working dir as /tmp/myelmdir (or a new temporary dir)
(2) install elm-lang/http and elm-lang/mouse with elm-package install
(3) compile the cell input with elm-make
(4) display the cell output as html

The -r flag renders the cell contents with elm-static-html
The cell must look exactly like this:

.. code-block:: python

In [4]: %%elm -r
...: module Main exposing (..)
...: import Html exposing (text)
...: view =
...: text "Hello World"
...: Hello World


Install using github::

git clone
cd elm_magic
pip install -e .

If elm and nodejs are not installed, you can try::

elm_magic install --target <install-dir>

where <install-dir> is writable by the current user.
and in the user's PATH (e.g /usr/local/ or /opt/conda)

Load the magic extension in IPython or Jupyter::

%load_ext elm_magic

then start using the %%elm magic::

... elm-lang code ...


see or set configuration parameters::

%config ElmMagic


* provides %%elm magic that executes elm-lang and displayes the result
* can be used with any jupyter kernel
* directory used by elm-make is configurable
* provides cli for installing nodejs and elm


This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
Started with the help of

.. _Cookiecutter:
.. _`audreyr/cookiecutter-pypackage`:

* Free software: GNU General Public License v3
* Documentation:


0.1.0 (2017-06-11)

* First release on PyPI.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elm_magic-0.1.0.tar.gz (62.7 kB view hashes)

Uploaded Source

Built Distribution

elm_magic-0.1.0-py2.py3-none-any.whl (9.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page