nbdev-framework-example
Getting Started
PDM
PDM, as described, is a modern Python package and dependency manager supporting the latest PEP standards. But it is more than a package manager. It boosts your development workflow in various aspects. The most significant benefit is it installs and manages packages in a similar way to npm that doesn’t need to create a virtualenv at all!
Installation
PDM should be installed as described in the Installation instructions.
Initialization
Once PDM is installed and configured, the project should be initialized by running the following command. This will ask a series of questions, where the defaults are usually safe, and produce a file called pyproject.toml
.
pdm init
Data Version Control (DVC)
DVC is built to make ML models shareable and reproducible. It is designed to handle large files, data sets, machine learning models, and metrics as well as code.
Installation
As we are using PDM for managing python dependencies of the project, we are able to add DVC by running pdm add dvc
. This will add it to the pyproject.toml
file and install it into the environment.
Initialization
To add DVC to the project, we need to do a one time initialization by running pdm run dvc init
. This will generate a .dvc
directory which stores it’s internal files as well as a files to DVC what files it should ignore.
nbdev
nbdev is a notebook-driven development platform. Simply write notebooks with lightweight markup and get high-quality documentation, tests, continuous integration, and packaging for free!
Installation
As we are using nbdev for creating documentation automatically, we are able to add nbdev by running pdm add nbdev
. This will add it to the pyproject.toml
file and install it into the environment.
Initialization
To add nbdev to the project, we need to do a one time initialzation by running pdm run nbdev_new
. This will create a settings.ini
file with project settings, a .github/workflows
directory containing workflows for package building and documentation deploying, and a nbs
directory containing jupyter notebooks for project files. These notebooks will be deployed as documentation pages using Quarto
Removing Packaging Feature (optional)
If you are using nbdev for documentation only without the package creation feature you can follow these steps: 1. Remove library files
rm setup.py .github/workflows/test.yaml nbs/00_core.ipynb
- Remove you library folder (this will be the
lib_path
field insettings.ini
)
rm -rf <lib_path>