nbdev
comes with the following commands. To use any of them, you must be in one of the subfolders of your project: they will search for the settings.ini
recursively in the parent directory but need to access it to be able to work. Their names all begin with nbdev so you can easily get a list with tab completion.
chisel_nbdev_build_docs
builds the documentation from the notebookschisel_nbdev_build_lib
builds the library from the notebookschisel_nbdev_bump_version
increments version insettings.py
by onechisel_nbdev_clean_nbs
removes all superfluous metadata form the notebooks, to avoid merge conflictschisel_nbdev_detach
exports cell attachments todest
and updates referenceschisel_nbdev_diff_nbs
gives you the diff between the notebooks and the exported librarychisel_nbdev_fix_merge
will fix merge conflicts in a notebook filechisel_nbdev_install_git_hooks
installs the git hooks that use the last two command automatically on each commit/mergechisel_nbdev_nb2md
converts a notebook to a markdown filechisel_nbdev_new
creates a new nbdev projectchisel_nbdev_read_nbs
reads all notebooks to make sure none are brokenchisel_nbdev_test_nbs
runs tests in notebookschisel_nbdev_trust_nbs
trusts all notebooks (so that the HTML content is shown)chisel_nbdev_update_lib
propagates any change in the library back to the notebooks
By default (fname
left to None
), the whole library is built from the notebooks in the lib_folder
set in your settings.ini
.
By default (fname
left to None
), the whole library is treated. Note that this tool is only designed for small changes such as typo or small bug fixes. You can't add new cells in notebook from the library.
By default (fname
left to None
), the whole library is tested from the notebooks in the lib_folder
set in your settings.ini
.
By default (fname
left to None
), the whole documentation is build from the notebooks in the lib_folder
set in your settings.ini
, only converting the ones that have been modified since the their corresponding html was last touched unless you pass force_all=True
. The index is also converted to make the README file, unless you pass along mk_readme=False
.
By default (fname
left to None
), the all the notebooks in lib_folder
are checked.
By default (fname
left to None
), the all the notebooks in lib_folder
are trusted. To speed things up, only the ones touched since the last time this command was run are trusted unless you pass along force_all=True
.
When you have merge conflicts after a git pull
, the notebook file will be broken and won't open in jupyter notebook anymore. This command fixes this by changing the notebook to a proper json file again and add markdown cells to signal the conflict, you just have to open that notebook again and look for >>>>>>>
to see those conflicts and manually fix them. The old broken file is copied with a .ipynb.bak
extension, so is still accessible in case the merge wasn't successful.
Moreover, if fast=True
, conflicts in outputs and metadata will automatically be fixed by using the local version if trust_us=True
, the remote one if trust_us=False
. With this option, it's very likely you won't have anything to do, unless there is a real conflict.
test_eq(bump_version('0.1.1' ), '0.1.2')
test_eq(bump_version('0.1.1', 1), '0.2.0')
This command installs git hooks to make sure notebooks are cleaned before you commit them to GitHub and automatically trusted at each merge. To be more specific, this creates:
- an executable '.git/hooks/post-merge' file that contains the command
nbdev_trust_nbs
- a
.gitconfig
file that usesnbev_clean_nbs
has a filter/diff on all notebook files insidenbs_folder
and a.gitattributes
file generated in this folder (copy this file in other folders where you might have notebooks you want cleaned as well)
nbdev_new
is a command line tool that creates a new nbdev project from the current directory, which must be a cloned git repo.
After you run nbdev_new
, please check the contents of settings.ini
look good, and then run nbdev_build_lib
.