A simple SoS workflow to generate website from Jupyter notebooks
Copyright 2016 Gao Wang
Run from a docker image
docker. Double-check after installation that
dockeris properly installed, by typing:
docker run hello-world # Hello from Docker. # This message shows that your installation appears to be working correctly.
Pull the docker image that contains dependency software to generate the website:
docker pull gaow/jnbinder
Download the script
jnbinder_docker.shfrom this repository to your project folder and load it:
After this, command prompt
jnbindershould be available from your terminal. To verify, the following command should display the command interface:
If it is your first time using this program please run the following to initialize:
Then open up the file
config.ymland edit it, particularly set the
include_dirto point to where your Jupyter notebooks are. A simplified example can be found here.
Inside your new project directory, generate all the webpages using the following command:
Next time when you generate the files, if you want to skip existing pages please type
jnbinder -s build. If you want to force generate every page from scratch you can use:
jnbinder clean jnbinder -s force
[For advanced users only] Run source code
Step 0: install dependencies
pip install sos bs4
Step 1: install
wget https://raw.githubusercontent.com/vatlab/jnbinder/master/release chmod +x release ./release setup-jnbinder
Step 2: edit
config.yml to include notebooks under various folders
See the template
config.yml file in this repo. Uncomment them as you customize the contents. Particularly, configure
include_dir to include folders where you keep the notebooks you want to publish as HTML pages. Here is a minimal example configuration file in action. To reproduce it you can download some example notebooks here and put them to a folder (or multiple folders) consistent with what's specified in
Step 3: build website
./release -j 10
Or, when things go wrong (pages not updated as expected).
./release -s force -j 10
-j 10 means running 10 conversion commands in parallel -- useful when there is a lot of notebooks to bind.
You should see the result in
docs/ folder. You can click on
docs/index.html to open it in your browser.
The software is intented for my personal use but I'm happy to help if you request a feature or report a bug (it is not fully documented so do not worry about requesting for features that already exist!).
Here are more examples of generated research websites: