GithubHelp home page GithubHelp logo

hhy5277 / atom-notebook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jupyter/atom-notebook

0.0 1.0 0.0 87 KB

[Deprecated] Jupyter Notebook, but inside Atom.

License: MIT License

JavaScript 81.10% CoffeeScript 9.07% CSS 9.83%

atom-notebook's Introduction

jupyter-notebook

This project does not have any active maintainers. We recommend that you use nteract, a native notebook application built using Electron, React (like this project), Redux, and RxJS, or Hydrogen, a LightTable-inspired package for Atom that allows users to run code blocks and selections using Jupyter kernels.

A package that works like the Jupyter Notebook, but inside Atom. It's registered as an opener for .ipynb files โ€” try opening one!

Sweet baby integration

Install

  1. Install dependencies:
OS X
  • Python 3: brew install python3 (there are issues with pip2 and OS X 10.11)
  • Jupyter and Jupyter Kernel Gateway: pip3 install jupyter jupyter_kernel_gateway
Linux (Debian)
  • Python: sudo apt-get install python python-pip
  • Jupyter and Jupyter Kernel Gateway: pip install jupyter jupyter_kernel_gateway
  1. apm install jupyter-notebook or search for jupyter-notebook inside of Atom

Usage

  • Run cell: SHIFT+ENTER, CMD+ENTER (or CTRL+ENTER on Windows)

Developers

Install

  1. git clone https://github.com/jupyter/atom-notebook.git
  2. apm install
  3. apm link

Achitecture

This package is built on React and the Flux architecture.

Map

  • main tells Atom how to render NotebookEditor and registers as an Opener for .ipynb files
  • dispatcher is a singleton flux.Dispatcher which contains the list of valid actions
  • notebook-editor is the Store and handles all of the business logic. It loads the file in, creates a state, then receives Actions and updates the state accordingly.
  • notebook-editor-view, notebook-cell, text-editor, display-area are the views. notebook-editor-view updates its state by fetching it from notebook-editor, then passes appropriate bits of that state down to the other views as props.

Flow

Rendering: NotebookEditor -> NotebookEditorView -> [child views]

Updating: [external action] -> Dispatcher.dispatch -> NotebookEditor.onAction ?-> NotebookEditor._onChange -> NotebookEditorView._onChange

Immutable state

The state returned by NotebookEditor.getState is an Immutable.js object.

Accessing its properties inside a view looks like this:

let executionCount = this.props.data.get('execution_count');

Changing it (in NotebookEditor) looks like this:

this.state = this.state.setIn(
    ['cells', cellIndex, 'source'],
    payload.source);

or this:

outputs = outputs.push(el.outerHTML);

Since React requires a view's state to be a regular JS object, the state of NotebookEditorView takes the form:

{
    data: <Immutable object>
}

No other views have state.

To do

  • autocomplete
    • atom.workspace.getActiveTextEditor() returns undefined because atom.workspace.getActivePaneItem() returns our custom NotebookEditor class which contains one or more TextEditors, therefore autocomplete, find, and features provided by other packages don't work in cells
  • add more actions (duplicate cell, restart kernel, change cell type, etc)
  • tell React our rendering is pure
  • test rendering performance with big notebooks

atom-notebook's People

Contributors

cloutiertyler avatar gnestor avatar jhonaker avatar kwilcox avatar rgbkrk avatar thomasingalls avatar willwhitney avatar

Watchers

 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.