Git Product home page Git Product logo

nteract / nteract Goto Github PK

View Code? Open in Web Editor NEW
6.2K 149.0 551.0 40.09 MB

๐Ÿ“˜ The interactive computing suite for you! โœจ

Home Page: https://nteract.io

License: BSD 3-Clause "New" or "Revised" License

JavaScript 1.22% HTML 0.63% Jupyter Notebook 6.39% Shell 0.36% Batchfile 0.03% Python 2.64% TypeScript 85.83% CSS 2.90%
notebook nteract data-science repl ipython jupyter jupyter-notebook desktop-application react react-components

nteract's Introduction

nteract animated logo

the interactive computing suite for you

code coverage maintained with lerna github action ci nteract docs

nteract is an open-source organization committed to creating fantastic interactive computing experiences that allow people to collaborate with ease.

We build SDKs, applications, and libraries that help you and your team make the most of interactive (particularly Jupyter) notebooks and REPLs.

To learn more about the nteract open source organization and the rest of our projects, please visit our website.

What's in this repo?

This repo is a monorepo. It contains the code for the nteract core SDK and nteract's desktop and web applications. It also contains the documentation for the SDK and the applications. Here's a quick guide to the contents of the monorepo.

Folder Description
applications/desktop Source code for the nteract desktop application. The desktop application is a cross-platform app built using Electron.
applications/jupyter-extension Source code the nteract Jupyter extension. This extension can be installed alongside Jupyter classic and JupyterLab in your Jupyter deployments or personal Jupyter server.
packages JavaScript packages that are part of the nteract core SDK.
changelogs Changelogs for each release of the nteract core SDK and applications.

How do I contribute to this repo?

If you are interested in contributing to nteract, please read the contribution guidelines for information on how to set up your nteract repo for development, how to write tests and validate changes, how to update documentation, and how to submit your code changes for review on GitHub.

How do I use the nteract core SDK?

If you are a developer who wants to build an nteract-based notebook application, check out the following documentation resources for more info.

Link What's in it?
docs.nteract.io This page contains our how-to and tutorial style documentation. Get started learning about the nteract core SDK here.
packages.nteract.io This page contains the API documentation for packages in our core SDK. Bookmark this and use it as a reference when building your nteract-based UI.
components.nteract.io This page contains the documentation for our suite of composable React components. It contains code samples that you can reference when building your nteract-based UI.

Our documentation is living. We are always making changes and adding more content. If you have feedback about the documentation, please open an issue in this repo. If you are interested in submitting a change to our documentation page, please review the contribution guidelines and submit a pull request.

How do I use the nteract desktop application?

To get started with the nteract desktop app, head over to the nteract homepage to download the application for your operating system.

Once you've download the app, head over to our documentation page for tutorials and guides on using the app for your data analysis and science workflows.

Supporting nteract

nteract is a non-profit open-source organization fiscally sponsored by NumFOCUS. If you are interested in supporting development on nteract, please consider making a recurring donation.

Development on nteract is also supported by the following organizations.

Netflix Logo Microsoft Logo
Gordon and Betty Moore Foundation Logo Plotly Logo

nteract's People

Contributors

alexandercbooth avatar benrussert avatar betatim avatar bryanchen-d avatar captainsafia avatar carreau avatar crystallinecat avatar emeeks avatar gnestor avatar greenkeeper[bot] avatar greenkeeperio-bot avatar ivanov avatar jdetle avatar jdfreder avatar jeromefv avatar kenwheeler avatar lgeiger avatar mpacer avatar peggyrayzis avatar ramantehlan avatar renovate-bot avatar renovate[bot] avatar rgbkrk avatar semantic-release-bot avatar shinigami92 avatar stormpython avatar theengineear avatar vivek1729 avatar willingc avatar yuvipanda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nteract's Issues

Design a contextual cell

In the current notebook, you have to go to a menu to perform operations on cells, know some keybindings, or click a button on a toolbar at the top.

screenshot 2016-01-19 11 57 07

screenshot 2016-01-19 11 57 26

It would be nice if cells had their own contextual menu or other UI device so you can keep context on the cell you're working in. I'm not sure how to design this, though I think it's important.

React render failures should not be silent

While implementing cells by uuid I got to a point where the page was rendering blank and there were no error in the console. It turns out one of the react components was failing to render. Unfortunately this failure was logged no where. We need to make sure asynchronous errors get logged and we will need to come up with a really good story for when we decide nteract should be able to render components from user extensions (maybe even rendering errors to the screen).

The last segment of this read, provided by @rgbkrk , is relevant: https://nylas.com/blog/react-plugins

cc @kenwheeler

Naming

It's been suggested that we either rename to:

  • nteract/nteract

or

  • nteract/notebook

The first presumes that the Electron based notebook will be the primary byproduct of the nteract org (similar to Atom). Considering how many people refer to Jupyter as JupyterHub | jupyter/notebook | tmpnb, I'm fairly tempted to go along with that. One other issue we've run into in the past is that "the notebook" can refer to the notebook document, the notebook server (python), or the frontend application that is the jupyter notebook.

The composition name came from me thinking of a different way to say notebook; @Karissa and I rolled with it and all was happy.

/cc @jackparmer

Accessing channels from actions

I'd like to have some way to access our current channels from the actions.

This is motivated by wanting to offload/move execution of a cell to an action function. We currently only have the subject, which is a scan on the state. While we could subscribe, it would be pretty odd to wait for the โ€‹_next_โ€‹ change when we really want the โ€‹_last_โ€‹ channels. Possibly even the last state in general.

Launching kernels as an event on notebook load

It's a bit unclear to me how to launch the kernel as a result of a new notebook load. The current flow of loading is unidirectional and very Redux like.

The problem I feel like I'm facing in creating the initial connections is that I would expect that the first READ_JSON event would propagate a NEW_KERNEL event. I'll post a PR with my current code and hopefully we'll figure out something clean.

Scope/Roadmap

It's time to outline what we want out of an Electron application for the Jupyter notebook!

  • Fully standalone desktop application (in Electron!)
  • One click installers for OS X and Windows
  • Integrates well with the current ecosystem of tooling
  • Bundles a kernel with scientific Python packages

Cell Operations

Pure Cell

  • render markdown when a markdown cell
  • editable markdown area
  • render all Jupyter mimetypes (mostly - nteract/transformime-react#1)
  • handler prop to notify on change of inputs
  • indicates when cell is hovered over with the mouse

Draggable Cell

  • has a cell while working well as a dnd item

zmq for everyone

In order to connect to any Jupyter kernel, they rely on zmq for reliable interprocess communication. The node bindings, which are quite stable (and awesome), are a bit persnickety to install on some platforms (as with anything relying on native bindings to C). In order for a developer to build, e.g., an Electron app that relies on zmq, they tend to need these items:

  • zmq headers
  • (optionally) libsodium for encryption TweetNACL is built in now!
  • C compiler
  • pkg-config
  • for every version of Electron and node that come out, these need to be rebuilt
  • rebuild for each version

Releasing multiplatform precompiled binaries for node modules is completely doable, though care has to be taken to allow users to use their local version of libzmq + libsodium as well.

If you dig through issues on zmq, you'll find quite a few about installation issues. Currently there are bundled Windows binaries in the repository for libzmq (for linking against).

Internationalization of text

screenshot 2016-02-05 14 00 26

As we progress, we should take some time to think about how we do internationalization of text. The current way that people appear to be doing this in React apps is with react-intl, which relies on formatjs. There are standard APIs for the easy ones:

> new Intl.NumberFormat().format(1000.0)
"1,000"

It's the string messages that I'm not sure of. What I do know we have to do is make it easy for others to provide translations as PRs. Seems like people are used to JSON files with things like templated dialog messages, etc. for all the languages. @TwistedHardware suggested that there may be translations available for a lot of common things like File, Edit, etc.

Within jupyter/notebook, @TwistedHardware is putting together an enhancement proposal for the current Tornado app and templates. We should make sure to learn from both efforts.

Related resources

Notebook storage

Where do notebooks get saved by default? What's your workspace area (your cwd if you will)?

Since this is an electron app that can run from clicking a shortcut on someone's Windows Desktop or Apple Applications menu, we have to make sensible defaults (while clearly allowing for file browsing).

Security of Notebook Documents

As implemented in jupyter/notebook currently, there are quite a few security features to deal with malicious notebooks (whether intentional or not).

  • Signed notebooks
  • Sanitization of HTML outputs

We'll need to implement those up to the spec as well.

Diffing

Earlier @captainsafia and I discussed the ability to do diffs on notebooks. With our immutable.js structure, this might turn out to be pretty simple. Hooking it up with git would be super slick.

There's already a diffing library for Immutable.js that produces RFC 6902 style patches, called immutable-js-diff:

var Immutable = require('immutable');
var diff = require('immutablediff');

var map1 = Immutable.Map({a:1, b:2, c:3});
var map2 = Immutable.Map({a:1, b:2, c:3, d: 4});

diff(map1, map2);
// List [ Map { op: "add", path: "/d", value: 4 } ]

It would be super cool to see what @smashwilson thinks about this one in terms of making custom diff tools for git.

Copy Pasta

Now that we have a custom menu, we lost our default actions for things like Copy Paste. We should bring in some of the default menu options that come with Electron.

Packaging

We should start packaging this for pre-pre-pre-alpha releases to at least figure out a bit of the flow. Some things we'll need:

  • Icons!
  • Metadata about the built application across the other platforms

Make Travis happier to work with

I'm not sure what limits we're running into right now (disk space, memory?). Travis seems to be stalling out on the regular while I'm able to build and run this all locally on Linux and OS X.

Launching kernels

Given a kernelspec, launch a kernel. This doesn't have to take into account the UI aspect and may end up being a node package in its own right.

Selectable cells

We need to have the concept of active cells (user has clicked on the cell, is interacting with it in some way, etc.)

Add language logo and name to header

The current notebook has a header and menu that looks like this:

screenshot 2016-01-22 12 03 21

At the very least, we should display what the current language is + logo. In Atom, it's shown in the gutter and, depending on your plugins, before the name in the editor tab. nteract's sidecar does the same thing.

Filename Proposal

We have disallowed using capital case at Walmart, due to OSX case insensitivity issues. Additionally, we use the .js extension instead of .jsx.

Do we have good reasons for either? On other projects we've found these patterns to be more trouble than they are worth.

Thoughts?

Kernel Operations

  • Start a kernel (given a kernelspec)
  • Stop a kernel
  • Run code against a kernel

Note that much of this is encompassed within jupyter-js-services, though we'll be reliant on zmq directly.

Interface Elements

  • Kernel Selection - Top level menu?
  • Notebook(s) - Are these in individual windows, tabbed, selectable?
  • Notebook selection - is this a dashboard, a menu, or a sidebar?

Kernel usage issue

This little snippet of code works just fine run locally as a script via babel-node ($( npm bin )/babel-node in composition):

const launchKernel = require('./src/api/kernel').default;
const createExecuteRequest = require('./src/api/messaging').createExecuteRequest;

console.log('prelaunch');
launchKernel('python3')
  .then(kc => {
    console.log(kc);
    const channels = kc.channels;
    const shell = channels.shell;
    const iopub = channels.iopub;
    const msg = createExecuteRequest('print(3)');
    console.log(msg);
    shell.subscribe(console.log, console.error);
    iopub.subscribe(console.log, console.error);
    shell.next(msg);
  }).catch(console.error);

If I run the same thing from the chrome console in Electron (or if inserted in the code base after channels are launched), I get this error:

screenshot 2016-02-06 15 17 50

Adapt to v1.0.0 spawnteract API

spawnteract v1.0.0 is out, with a new API:

const spawnteract = require('spawnteract')

spawnteract.launch('python3').then(kernel => {
  // Returns
  // kernel.spawn <-- The running process, from child_process.spawn(...)
  // kernel.connectionFile <-- Connection file path
  // kernel.config <-- Connection information from the file
}

The only change there is that connFile is now connectionFile. Underneath the hood, kernelspecs has changed and is faster than before because it tore out RxJS4 and switched to native promises.

Editor

  • Basic CodeMirror as input area for cells (done in #11)
  • Markdown editing
  • Maintain a consistent immutable notebook state over time superseded by commutable work
  • Input/Output styling
  • Handle all the mimetypes that Jupyter supports (see nteract/transformime-react#1)

ConsoleText should create React Components

We're currently relying on ansi-to-html, which creates HTML text from ANSI colored text. It would be great to make a separate package (or find one!) that does the direct route so it can rely on React's Virtual DOM.

Notebook format

Sometime ago, I wrote nbformatjs (available on npm as nbformat) for working with the notebook format. We need to add on to that package and/or build follow ons that use it to handle a variety of things:

  • Upgrading from previous formats
  • Validation of format
  • Converting from the disk format to the in-memory format, e.g. The "multi-line string" array of strings should be .join('')ed
  • Utilities for working with an Immutable.js notebook (load, convert, save)

Enable configurable default cell type

From some of the classes I have taught and some observations at conferences, I've noticed that people tend to use the notebook in two ways, as a note-taking tool and as the "traditional" interactive programming tool. Simply put a note-taking user will mostly be writing text with occassional code cells. On the other hand, a "traditional" user will mostly be writing code with occassional text cells.

As mentioned by @rgbkrk in #41, composition will only support the Markdown and code cell types so we are dealing with a binary toggle. I'm imagining the following implementation option.

  1. Add a defaultCellType property to the Notebook class.
  2. Configure the cells to render with the defaultCellType by default.
  3. Add a toggle, either as a menu item or as a literal toggle, although I am leaning towards the menu item that will allow the user to set the default cell type.

There might be more details to flesh out on this but this is my cursory impression based on user observations and code reading.

Consistent jupyter messaging

Right now everything is built on the predicate of loading a notebook from disk. As I'm fleshing this out, I'm noticing it matches up much better to be reacting to changes in state. The notebook document itself is a final state representation that can be turned back into the messages that put the application state together.

Flesh out keybindings for cell execution

We're a bit different in the current keybindings for the notebook. Our current shift-enter stays on the same cell.

cellular

In the Jupyter Notebook, that action is supposed to be ctrl-enter. shift-enter should run the cell and move to the next, creating one if necessary.

This generally brings up a point about needing to think about keybindings and action names.

Problem: We need an exit action

Solution: Command-q / ctrl-q should exit the application

Bonus points: close the kernel channels, kill the spawn, and fs.unlink the connectionFile.

Prior Cell Art

People have iterated on the cell design quite a few times.

There's the classic IPython/Jupyter notebook cells:

screenshot 2016-01-25 10 56 30

In CoLaboratory, they took a lot of approaches that we should look back to, namely

  • Cells have their own context menu
  • Active and hovered cells are raised up as cards (material design)

screenshot 2016-01-25 11 05 09

In jupyter/design#10, the cell is very trim and clean:

Theming

I'd really love to see the entire app colorscheme to be dependent on top level variables, similar to Atom's. I'm imagining that, for the time being, we can rely on code mirror choices used as less variables throughout the application.

Rendering notebooks as static documents

This isn't so much of a concern for the Electron notebook itself. This is more about how the notebook gets presented when sharing on the web (converted to HTML, no kernel backed compute). As much as possible, we need to make sure that components which are pure can be extracted. Thus far, the primary ones have been:

It makes a good bit of sense that Cell isn't, since we're keyed into editor changes. In order for us to have full parity with nbviewer and the notebook we're going to need more implemented within our other projects:

Another piece that needs to be explored is:

  • Prismjs input segments (instead of CodeMirror) for CodeCells

Roughly speaking, the static rendering component starts to look like this, complete with custom transforms (swapping out the defaults used in https://github.com/nteract/transformime-react):

import { transforms } from 'transformime-react';
import Display from 'react-jupyter-display-area';

const IFramedHTML = React.createClass({
  render: function() {
    return (
      <iframe ...>
         <somehow {this.props.data} />
      </iframe>
    );
  }
});

const myTransforms = transforms.set('text/html', IFramedHTML);

...

const StaticCodeCell = React.createClass({
  render: function() {
    return (
      <div>
        <PrismCode>
          {this.props.cell.get('source')}
        </PrismCode>
        <Display transforms={myTransforms}
                 outputs={this.props.cell.get('outputs')} />
      </div>
    );
  }
});

Document the getting started hacking process

OS X

brew install zmq
brew install pkg-config

Jupyter tooling

pip install jupyter_console
jupyter kernelspec install-self

Installing the Python 3 kernel:

python3 -m pip install ipykernel
python3 -m ipykernel install --user

It's all about the DOM

We have to make a difficult choice in how we handle cell output.

The current notebook lets cell output do anything with the page, including modifying the notebook itself and running code on kernels. This is both powerful and a large risk which is overcome by restricting cell output to <iframe>s or even Electron's web-view. That ends up meaning you get consistent state on the notebook and all the UI while restricting what can be mutated by cells. On the other hand, this also means that cells can't communicate with each other. It's a tradeoff!

Error: Electron compilers not found but were requested to be loaded

Howdy! I was trying the install instructions in the readme and hit this error. I'm on node v5.4.1 and npm 3.3.12. Wondering if there are other dependencies that need to be installed before I can try this out?

Here's a bit more detail:

$ npm run start

> [email protected] start /Users/odewahn/Desktop/composition
> electron main.js

App threw an error when running [Error: Electron compilers not found but were requested to be loaded

screen shot 2016-01-20 at 3 34 56 pm
]

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.