This is a Python project template that combines uv — a fast Python package installer and resolver — with nbdev — a notebook-driven development framework. It enables you to write and document Python code directly in Jupyter notebooks, which are automatically converted into a Python package with generated documentation.
Key Features:
- Rapid package management with
uvfor fast dependency resolution and virtual environment management - Notebook-based development with nbdev for literate programming and documentation
- Automatic code generation from notebooks to Python modules
- Built-in documentation generation from notebook cells
- Pre-commit hooks for code quality checks
- CI/CD workflows configured for testing and documentation builds
git clone <repository-url>
cd <project-directory>Update the project metadata in pyproject.toml:
name: Your project name (must match your package directory)description: A brief description of your projectauthors: Author informationdependencies: List your project dependenciesversion: Version number (follow semantic versioning)
Example:
[project]
name = "my-awesome-package"
description = "A brief description"
version = "0.1.0"
authors = [{name = "Your Name", email = "your.email@example.com"}]
dependencies = ["numpy", "pandas"]ATTENTION: Do not forget to rename the project_name folder to the name specified above, as well as any other instances of project_name elswhere!
If you don't have uv installed, run:
curl -LsSf https://astral.sh/uv/install.sh | shFor other installation methods, see the uv installation guide.
uv sync --all-groupsThis installs all dependencies, development tools, and optional groups.
For HTML/PDF documentation generation:
uv run nbdev-install-quartouv run nbdev-newThis creates the nbdev folder structure (nbs/, docs/, etc.) and initializes the nbdev configuration file. You may want to set an acess token to use with private repositories or bypass API rate limits.
uv run pre-commit installThis sets up automatic code quality checks before each commit.
- Create Jupyter notebooks in the
nbs/directory - Annotate code cells with nbdev directives (e.g.,
#| exportto export functions to your package) - Use markdown cells for documentation and explanations
- Generate code:
nbdev-buildconverts notebooks to Python modules in your package directory - Run tests:
nbdev-testexecutes all test cells in your notebooks - Build documentation:
nbdev-build-docscreates HTML documentation from notebooks - Clean:
nbdev-cleanremoves generated artifacts
# Export code from notebooks
uv run nbdev-build
# Run all tests
uv run nbdev-test
# Build documentation
uv run nbdev-build-docs
# Clean generated files
uv run nbdev-cleanGitHub Actions workflows are pre-configured to:
- Run all tests on push and pull requests
- Build and validate documentation
- Perform code quality checks via pre-commit
- Deploy documentation (optional)
Check the .github/workflows/ directory to customize these workflows for your needs.
See LICENSE file for details.