GithubHelp home page GithubHelp logo

urantialife / ijavascript Goto Github PK

View Code? Open in Web Editor NEW

This project forked from n-riesco/ijavascript

1.0 0.0 0.0 2.02 MB

IJavascript is a javascript kernel for the Jupyter notebook

License: Other

JavaScript 85.97% Python 11.35% Dockerfile 2.68%

ijavascript's Introduction

Links

IJavascript Home Page
IJavascript Repository
jp-babel Repository
jp-coffeescript Repository

IJavascript

IJavascript is a Javascript kernel for the Jupyter notebook. The Jupyter notebook combines the creation of rich-text documents (including equations, graphs and videos) with the execution of code in a number of programming languages. The execution of code is carried out by means of a kernel that implements the Jupyter messaging protocol.

The IJavascript kernel executes Javascript code inside a Node.js session. And thus, it behaves as the Node.js REPL does, providing access to the Node.js standard library and to any installed npm modules.

There are kernels available for Python, Julia, Ruby, Haskell and many other languages.

Here's a sample notebook that makes use of the IJavascript kernel:

Screenshot: Notebook Hello Sample

Contents

Announcements

  • SUPPORT NOTICE: IJavascript v5.1 will be the last version supporting Node.js 0.10, Node.js 4, Node.js 6 and Node.js 8.
  • IJavascript v5.1 added new functionality to the API (see NEL for preliminary documentation):
    • $$.clear({wait}) to send a clear_output request.
    • $$.display({id}) to send display_data and update_display_data messages.
    • $$.input(options, {callback}) to send a input_request and handle input_reply messages.
  • Starting with IJavascript v5.0.11, it is possible to customise the output of an object based on its type. See the documentation on custom output for details.
  • The use of $$mimer$$ and $$defaultMimer$$ to customise output is now deprecated.
  • To avoid clutter in the global context, the use of $$async$$, $$done$$, $$mime$$, $$html$$, $$svg$$, $$png$$ and $$jpeg$$ has also been deprecated and replaced with the global object $$.

Main Features

Installation

IJavascript is distributed as an npm package and thus it requires:

Depending on your use, other Jupyter tools will be necessary (e.g. Jupyter notebook). Note that IJavascript has been kept backwards-compatibility with IPython v1, so that it's possible to use the IPython notebook distributed in Ubuntu 14.04 LTS and Ubuntu 16.04 LTS.

For other platforms not listed below, or if you find any problems with the instructions above, please, refer to the installation notes.

Ubuntu

To install IJavascript in Ubuntu 16.04 LTS, run:

sudo apt-get install nodejs-legacy npm ipython ipython-notebook
sudo npm install -g ijavascript
ijsinstall

Windows (Official Python Distribution)

In the command line:

pip3 install --upgrade pip
pip3 install jupyter
npm install -g ijavascript
ijsinstall
# Or run: %appdata%\npm\ijsinstall

Then you can run jupyter notebook in your terminal to load Jupyter Notebook. When you create a new Jupyter Notebook, you should see the Javascript (Node) kernel available.

Windows (Anaconda Distribution)

Open the Anaconda prompt and run:

conda install nodejs
npm install -g ijavascript
ijsinstall

Then you can run jupyter notebook in your terminal to load Jupyter Notebook. When you create a new Jupyter Notebook, you should see the Javascript (Node) kernel available.

macOS

In macOS, Homebrew and pip can be used to install IJavascript and its prerequisites:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install pkg-config node zeromq
sudo easy_install pip
pip install --upgrade pyzmq jupyter
npm install -g ijavascript
ijsinstall

Usage

IJavascript provides 5 executables: ijsinstall, ijsnotebook, ijsconsole, ijskernel and ijs. Their purpose and basic use is described in the sections below. Please, refer to the usage notes for further details.

ijsinstall: IJavascript kernel spec installer

'ijsinstall` registers the IJavascript kernel with Jupyter, so that other tools (e.g. the Jupyter notebook) can invoke it. The following command flags are recognised:

--debug                   enable debug messages
--help                    show this help
--hide-undefined          do not show undefined results
--install=[local|global]  install kernel for current user or globally
--protocol=version        set messaging protocol version, e.g. 5.0
--show-undefined          show undefined results
--spec-path=[none|full]   set whether kernel spec uses full paths
--startup-script=path     run script on kernel startup
                          (path can be a file or a folder)
--version                 show kernel version
--versions                show kernel and library versions
--working-dir=path        set kernel working directory
                          (default = current working directory)

ijsnotebook: IJavascript notebook

After running ijsinstall, Jupyter notebook users can invoke the Jupyter notebook as usual. ijsnotebook is provided for convenience to users of the IPython notebook prior to version 3. ijsnotebook is a wrapper around ipython notebook. It extends the command flags accepted by ipython notebook with the following:

--help                        show IJavascript and notebook help
--ijs-debug                   enable debug messages
--ijs-help                    show this help
--ijs-hide-undefined          do not show undefined results
--ijs-install=[local|global]  install kernel for current user or globally
--ijs-protocol=version        set protocol version, e.g. 5.0
--ijs-show-undefined          show undefined results
--ijs-spec-path=[none|full]   set whether kernel spec uses full paths
--ijs-startup-script=path     run script on startup
                              (path can be a file or a folder)
--ijs-working-dir=path        set kernel working directory
                              (default = current working directory)
--version                     show kernel version
--versions                    show kernel and library versions

ijsconsole: IJavascript console

ijsconsole is provided for convenience to users as a wrapper around ipython console. The following command flags are recognised:

--help                        show IJavascript and notebook help
--ijs-debug                   enable debug messages
--ijs-help                    show this help
--ijs-hide-undefined          do not show undefined results
--ijs-install=[local|global]  install kernel for current user or globally
--ijs-protocol=version        set protocol version, e.g. 5.0
--ijs-show-undefined          show undefined results
--ijs-spec-path=[none|full]   set whether kernel spec uses full paths
--ijs-startup-script=path     run script on startup
                              (path can be a file or a folder)
--ijs-working-dir=path        set kernel working directory
                              (default = current working directory)
--version                     show kernel version
--versions                    show kernel and library versions

ijskernel: IJavascript kernel

ijskernel is the executable invoked by Jupyter tools (e.g. the notebook) and that appears in the kernel spec that ijsinstall creates for IJavascript. You won't need this command, unless you want to create a custom kernel spec.

Usage:
    ijskernel [options] connection_file

Options:
    --debug                           enable debug messages
    --hide-undefined                  do not show undefined results
    --protocol=Major[.minor[.patch]]  set protocol version, e.g. 5.0
    --session-working-dir=path        set session working directory
    --show-undefined                  show undefined results
    --startup-script=path             run script on startup
					  (path can be a file or a folder)

ijs: Deprecated CLI

ijs is provided for backwards-compatibility. It will be removed in the next major-version update. Please, use ijsinstall or ijsnotebook instead.

Contributions

First of all, thank you for taking the time to contribute. Please, read CONTRIBUTING and use the issue tracker for any contributions: support requests, bug reports, enhancement requests, pull requests, submission of tutorials...

TODO

See the issue tracker and the TODO list in the packages jp-kernel and NEL for additional items.

ijavascript's People

Contributors

adeelshahid avatar antimatter15 avatar ianedington avatar int3h avatar joeflack4 avatar krinsman avatar lgeiger avatar mandarvaze avatar minrk avatar n-riesco avatar parmentelat avatar rgbkrk avatar willwhitney avatar

Stargazers

 avatar

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.