https://github.com/jhamrick/nbflow
A tool that supports one-button reproducible workflows with the Jupyter Notebook and Scons.
https://github.com/jhamrick/nbflow
Last synced: 7 months ago
JSON representation
A tool that supports one-button reproducible workflows with the Jupyter Notebook and Scons.
- Host: GitHub
- URL: https://github.com/jhamrick/nbflow
- Owner: jhamrick
- License: bsd-3-clause
- Created: 2016-03-29T17:52:39.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-10-09T19:56:01.000Z (about 7 years ago)
- Last Synced: 2024-12-27T10:07:34.562Z (12 months ago)
- Language: Python
- Homepage:
- Size: 30.3 KB
- Stars: 160
- Watchers: 12
- Forks: 18
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-jupyter - nbflow - One-button reproducible workflows with Jupyter and Scons. (Rendering/Publishing/Conversion)
- -awesome-jupyter - nbflow - One-button reproducible workflows with Jupyter and Scons. (Rendering/Publishing/Conversion)
README
# NBFlow
[](https://travis-ci.org/jhamrick/nbflow) [](https://mybinder.org/v2/gh/jhamrick/nbflow/master)
A tool that supports one-button reproducible workflows with the Jupyter Notebook and Scons. **Note: this currently only supports Python kernels.**
> **UPDATE: Scons >= 3.0.0 now supports Python 3 so Python 2 isn't needed anymore!** Now Nbflow and Scons are both Python 2 and 3 compatible so you can choose whichever you want.
> The actual version of Scons (3.0.1) currently supports Python >= 3.5, which is the default in Ubuntu 16.04
## Installation
To install, run:
Linux:
```
pip3 install git+git://github.com/jhamrick/nbflow.git
```
Windows:
```
pip install git+git://github.com/jhamrick/nbflow.git
```
## Usage
For a complete example of how to use nbflow, check out [the example](nbflow/example)
in this repository.
You can now you Binder to check the example online:
1. Entre in Binder [here](https://mybinder.org/v2/gh/jhamrick/nbflow/master) or through the badge above
2. Open a terminal
3. Run `cd nbflow/example`
4. Run `scons`
5. Check the results in the `results` directory
Optionally you can modify the notebook in this online environment and check how the results change.
### Analysis notebooks
For each notebook that you want executed, you MUST include two special variables
in the first code cell:
* `__depends__` -- a list of relative paths to files that the notebook depends
on
* `__dest__` -- either a relative path, or list of relative paths, to files that
the notebook produces
For example, the first cell in [one of the example notebooks](nbflow/example/analyses/analyze_data.ipynb)
is:
```python
__depends__ = ["../results/data.json"]
__dest__ = "../results/stats.json"
```
### SConstruct file
You need a `SConstruct` file in the root of you analysis directory. In this
`SConstruct` file you will need to import nbflow and use it to setup your scons
environment, e.g.:
```python
import os
from nbflow.scons import setup
env = Environment(ENV=os.environ)
setup(env, ["analyses"])
```
The second argument of the `setup` command takes a list of folder names that
contain analysis notebooks.
### Running nbflow
Once you have setup your analysis notebooks and your `SConstruct` file, you can
run your notebooks by just running the `scons` command from the root of your
analysis directory.