Data-Forge Notebook (DFN) is developed by Ashley Davis.
When are you coding in Data-Forge Notebook you are simply coding against Node.js. Anything you can do in Node.js you can also do in Data-Forge Notebook. When you have finished developing your code in Data-Forge Notebook you can export it to a Node.js project and deploy it to your production environment.
Have feedback? Please get in touch.
What does DFN include?
Data-Forge Notebook includes a portable embedded version of Node.js. This won't interfere with any existing Node.js you may already have installed on your system.
Data-Forge Notebook comes bundled with a suite of example notebooks that demonstrate a variety of data wrangling and visualization techniques. To explore the examples click Open example notebook from the File menu.
How does DFN work?
Data-Forge Notebook is a cross-platform Electron app.
When you start DFN it starts a seperate Node.js process called the evaluation engine (using the embedded Node.js mentioned earlier). This separate process is used to evaluate the code in your notebook. As you edit your code DFN uses inter-process communication to constantly push your code updates to the evaluation engine. When you hit the run button to trigger evaluation of your code DFN sends a message to the evaluation engine that tells it to evaluate the code it currently has in memory.
Output and errors
Any output or errors produced by the code in your notebook are sent back to DFN for display within the notebook. When you save your notebook, DFN also saves the output and errors within it so that the next time you open the notebook all the results from the last evaluation are restored.
The evaluation engine is designed to handle errors from your code and be resilliant. It can also handle being aborted and restarted, just in case you put an infinite loop in your code. You can even put a call to
process.exit in your notebook and DFN will automatically restart the evaluation engine after you aborted it. However the evaluation engine isn't perfect and you can probably find unusual ways to corrupt it from the inside - if you do, in the interest of improving it, please let us know!
To install an npm module, simply require it into your code. The first time you evaluate the code DFN will automatically download and install the requested npm module in the same directory where you save your notebook. You can also pre-install npm modules using npm from the command line, just make sure you install them in the same directory as your notebook or in parent directory.
Working with the file system
When evaluating your notebook DFN automatically sets the current working directory for the evaluation to be the directory where the notebook is saved. Thus when using Node.js file system functions you can access your files by using paths that are relative to the directory that contains your notebook.