Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jonklein committed Dec 20, 2020
1 parent 4280674 commit b04e26a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
40 changes: 16 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
# Niex - Interactive Elixir Code Notebooks

Niex is an interactive Elixir code notebook built with Phoenix LiveView with support for embedded media and
charting. Niex stores your data & code in persistent, interactive notebooks, making it great for scientific and data analysis applications using Elixir, or for sharing interactive demos of your Elixir code.
Niex is an interactive Elixir code notebook with support for embedded media and
charting, built with Phoenix LiveView. Niex stores your data & code in persistent, interactive notebooks, making it great for scientific and
data analysis applications using Elixir, or for sharing visual, interactive demos and documentation of code
written in Elixir.

![An animation of a Niex notebook in action](https://github.com/jonklein/niex/blob/master/sample_notebooks/demo.gif?raw=true)

## Why Niex?

You may note that the powerful, full-featured [Jupyter](https://jupyter.org/) project is already capable of supporting other language backends,
including Elixir, so what's the advantage of using Niex for an interactive Elixir notebook?

- Embeddable - Niex is easily embedable in your own Elixir project so that you can easily use it
as a development and exploration workspace for your own code.

- Simple - Niex offers a simple Phoenix/Elixir app to get up and running quickly & easily or to deploy however you prefer to
deploy your Phoenix apps.

- Lightweight

Niex is extremely lightweight

- Written in native Elixir, so it integrates easily with your existing Elixir project and lets you use your own code
in notebooks
Niex is inspired by the powerful and full-featured [Jupyter](https://jupyter.org/) project. You may note that Jupyter
(with some effort) can already support Elixir as a backend, so what's the advantage of using
Niex? The main advantage is that Niex is simple, lightweight and written fully in Elixir, so it's easy to use as a simple
dependency to integrate with your existing Elixir code. It can be run as a standalone
Phoenix app, or embedded in your own Elixir project.

## Getting Started

Expand Down Expand Up @@ -72,7 +62,8 @@ config :niex, NiexWeb.Endpoint,
```

Note: Though Niex uses Phoenix and LiveView, it runs as its own server on its own port and can be run happily alongside
your own Phoenix app.
your own Phoenix app. Configure the Niex port number accordingly to avoid conflicts with the rest of your
project - in the example above, we use port 3333.

### Media

Expand Down Expand Up @@ -127,14 +118,15 @@ Sample notebook:

## Known issues / future improvements

- executed code is *not* sandboxed - see section below on arbitrary code execution
- executed code is **not** sandboxed - see section below on arbitrary code execution
- `alias`, `import` and `use` do not function as expected in the notebook
- future work - add support for other media types
- future work - add support custom Live components in cells
- future work - add support for Live components in cells
- notebook format & details are subject to change

## Warning - arbitrary code execution
## WARNING: arbitrary code execution

This software enables arbitrary code execution *by design* – is for *development and local use only*. If you
This software enables arbitrary code execution **by design**it is intended for **development and local use only**. If you
choose expose any Niex functionality is available over a network, you are responsible for
implementing the necessary authorization and access controls.

2 changes: 1 addition & 1 deletion lib/niex_web/live/file_dialog_live.html.leex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<a phx-click="select" phx-value-path='<%= path %>'><%= component %></a>
<% end %>
<%= if @mode == "save" do %>
<form phx-change="update-filename">
<form phx-change="update-filename" phx-submit="noop">
<input class="new_filename" type="text" value="<%= @filename %>"
name="filename"/>
</form>
Expand Down
1 change: 1 addition & 0 deletions sample_notebooks/chart.niex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"worksheets":[{"cells":[{"prompt_number":0,"outputs":[{"text":["\"hello, world\""]}],"content":["IO.inspect(\"hello, world\")"],"cell_type":"code"},{"prompt_number":1,"outputs":[{"text":"<div class=\"chart\" style=\"width: 480px; height: 360px\" phx-hook=\"NiexChart\" data-chart='{\"type\":\"LineChart\",\"options\":{\"width\":480,\"height\":360},\"data\":[[1,0.8414709848078965],[2,0.9092974268256817],[3,0.1411200080598672],[4,-0.7568024953079282],[5,-0.9589242746631385],[6,-0.27941549819892586],[7,0.6569865987187891],[8,0.9893582466233818],[9,0.4121184852417566],[10,-0.5440211108893699],[11,-0.9999902065507035],[12,-0.5365729180004349],[13,0.4201670368266409],[14,0.9906073556948704],[15,0.6502878401571169],[16,-0.2879033166650653],[17,-0.9613974918795568],[18,-0.750987246771676],[19,0.14987720966295234],[20,0.9129452507276277],[21,0.836655638536056],[22,-0.008851309290403876],[23,-0.8462204041751706],[24,-0.9055783620066239],[25,-0.13235175009777303],[26,0.7625584504796028],[27,0.956375928404503],[28,0.27090578830786904],[29,-0.6636338842129675],[30,-0.9880316240928618]]}' id=\"0cb5b93c-df56-4a5d-937d-b10d79f75a0e}\" />\n"}],"content":["data = (1..30) |> Enum.map(fn i -> [i, :math.sin(i)] end)\r\nNiex.Content.chart(\"LineChart\", data)"],"cell_type":"code"}]}],"metadata":{"name":"Simple Chart"}}

0 comments on commit b04e26a

Please sign in to comment.