Getting started#

Setting up#

Code Shelf projects are managed with Pixi and Bibliotekar. See the official documentation for installing Pixi. You should interact with projects exclusively through Pixi as it will ensure that you use the correct versions of all packages.

For maintainers, it is especially useful to install pre-commit. So in each repo you work on, run this:

pre-commit install

Repositories with submissions are configured in a pixi.toml file and are simple collections of scripts, notebooks, and templates, not Python packages. Bibliotekar, on the other hand, is a Python package and is configured in pyproject.toml. The Pixi configuration is also paced in pyproject.toml.

Running tests#

Run all tests using

pixi run pytest

or pass extra arguments to pytest using, e.g.,

pixi run pytest -k test_name

Pixi will manage Python environments for you and ensure that the correct packages are installed.

Running linters#

To run all linters, use

pixi run lint

Note that this uses pre-commit internally.

Individual linters can be run like this:

pixi run mypy
pixi run ruff-format
pixi run codespell
...

See the [tool.pixi.feature.*.tasks] tables (in particular [tool.pixi.feature.lint-tasks.tasks]) in pyproject.toml for a list of available linters. Or use

pixi task list

Building the documentation#

The documentation for Code Shelf stored in the Bibliotekar project in the docs folder. To build the documentation, use

pixi run docs

and open the resulting HTML file build/html/index.html in your browser.