Skip to content

Repository files navigation

nbdev_uv template

This file is autogenerated from nbs/index.ipynb. Change it and run nbdev_docs inside your uv env to repopulate it with your own content.

Getting started

  • Make your own copy of this repo
  • Search TODO CHANGE for all the places you need to replace with your own project’s details
    • stuff like docker/github actions need only be changed once you are ready to use them.
  • delete the nbdev_uv sub_dir, your notebooks will be exported to a subdir that matches your project’s name
# setup uv env
uv sync

# set up your python env to be the project's uv env, through your code editor.
# to do so manually ryn
source .venv/bin/activate

# to init precommit hooks, run
poe init

Development

  • Edit the notebooks in the nbs directory.
  • To clean them, export them and sync your uv env, run poe sync

To see what other lifecycle hooks where implemented, run:

! poe
Poe the Poet (version 0.39.0)

Result: No task specified.

Usage:
  poe [global options] task [task arguments]

Global options:
  -h, --help [TASK]     Show this help page and exit, optionally supply a
                        task.
  --version             Print the version and exit
  -v, --verbose         Increase output (repeatable)
  -q, --quiet           Decrease output (repeatable)
  -d, --dry-run         Print the task contents but don't actually run it
  -C, --directory PATH  Specify where to find the pyproject.toml
  -e, --executor EXECUTOR
                        Override the default task executor
  -X, --executor-opt KEY[=VALUE]
                        Set executor configuration for this run.
  --ansi                Force enable ANSI output
  --no-ansi             Force disable ANSI output

Configured tasks:
  init                  Initialise project, including precommit hooks
  clean                 Remove temporary files generated during build process
  test                  Run tests
  sync                  Cleans, lints and exports notebooks, syncs settings.ini and uv env
  pypi                  Build the package and publish to PyPI

Or read the pyproject.toml file.

Env variables

Set up an env file in .env.dev with all your environment variables you will need in your project in the repo’s root directory.

See pyproject.toml for how to add checks for env vars you might need in your tests/CI.

Documentation

To generate a doc site from your notebooks, follow nbdev’s documentation. Make sure you have Quarto installed.

Issues & bugs

If you found any issues or bugs with the template, let me know in an issue.

About

A template for an nbdev repo using uv

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages