nodebook

Nodebook - Multi-Lang Web REPL + CLI Code runner

Github星跟蹤圖

nodebook Build Status

Nodebook - Multi-Language REPL with Web UI + CLI code runner

What is it?

Nodebook is an in-browser REPL supporting many programming languages. Code's on the left, Console's on the right. Click "Run" or press Ctrl+Enter or Cmd+Enter to run your code.
Code is automatically persisted on the file system.

You can also use Nodebook directly on the command line, running your notebooks upon change.

nodebook

A notebook is a folder containing an {index, main}.{js,py,c,cpp,...} file. The homepage lists all of the available notebooks.

home

Supported environments

  • C11 (.c)
  • C++14 (.cpp)
  • C# (.cs)
  • Elixir (.ex)
  • Fsharp (.fs)
  • Go (.go)
  • Haskell (.hs)
  • Java (.java)
  • NodeJS (.js)
  • Lua (.lua)
  • OCaml (.ml)
  • PHP (.php)
  • Python 3 (.py)
  • R (.r, .R)
  • Ruby (.rb)
  • Rust (.rs) — Uses cargo run if Cargo.toml is present, and rustc otherwise
  • Swift (.swift)
  • TypeScript (.ts)

If --docker is set on the command line, each of these environments will run inside a specific docker container.

Otherwise, the development environments on your local machine will be used.

Install and run as package (npm)

# Install
$ npm i -g --production nbk

# Run with Web UI
$ nbk path/to/notebooks
# Or
$ nbk --notebooks path/to/notebooks

# Run on CLI
$ nbkcli path/to/notebooks
# Or
$ nbkcli --notebooks path/to/notebooks

Install and run from source

# Install
$ git clone https://github.com/netgusto/nodebook
$ cd nodebook
$ npm install --production

# Run
$ node . --notebooks path/to/notebooks

Install and run from source as an electron app

# Install
$ git clone https://github.com/netgusto/nodebook
$ cd nodebook
$ npm install

# Run
$ npm run electron -- --notebooks path/to/notebooks

Usage

Create a Notebook (Web UI)

Click on the + Notebook button on the Home page, then select the language of the notebook to be created.

Once on the notebook edition page, you can rename the notebook by clicking on it's name.

Notebooks are created in the directory specified by the parameter --notebooks.

Create a Notebook manually (WebUI, CLI)

In the directory where you want your notebooks to be stored, simply create a folder containing a file named {index, main}.{js,py,c,cpp,...}.

The notebook's name will be the name of the folder. The notebook language is determined automatically.

Command line options

  • --notebooks: path to notebook folders; required
  • --docker: Execute code in disposable docker containers instead of local system; defaults to false

Web UI only:

  • --bindaddress: IP address the http server should bind to; defaults to 127.0.0.1
  • --port: Port used by the application; defaults to 8000

Notebook environment

If your notebook dir contains a .env file, the corresponding environment will be set up during notebook execution.

Exemple .env:

HELLO=World!

More information about the expected file format here: https://github.com/motdotla/dotenv#rules

⚠️ A bit of warning ⚠️

Do not run the Web UI on a port open to public traffic! Doing so would allow remote code execution on your machine.

By default, the server binds to 127.0.0.1, which allows connection from the localhost only. You can override the bind address using --bindaddress, but do it only if you know what you're doing.

Develop

To iterate on the code:

$ npm install
$ PARAMS="--notebooks path/to/notebooks" npm run dev

To build:

$ npm run build

To test:

$ npm test

主要指標

概覽
名稱與所有者netgusto/nodebook
主編程語言Go
編程語言JavaScript (語言數: 23)
平台
許可證ISC License
所有者活动
創建於2018-09-05 09:14:30
推送於2024-05-15 05:19:08
最后一次提交2020-09-06 11:32:06
發布數26
最新版本名稱0.2.0 (發布於 )
第一版名稱0.1.0 (發布於 )
用户参与
星數1.6k
關注者數27
派生數86
提交數136
已啟用問題?
問題數39
打開的問題數15
拉請求數53
打開的拉請求數21
關閉的拉請求數4
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?