Getting started#

Setting up#

Dependencies#

Code Shelf projects are managed with Pixi and Bibliotekar. See the official documentation for installing Pixi. Bibliotekar is installed automatically when using Pixi.

Optionally, you can also set up pre-commit to run some checks before committing. This can avoid many common test failures later on.

Tracking metadata#

All code submissions must contain a set of tracking metadata that allows users to find out where a notebook or script came from. See the dedicated tracking metadata page for more information.

Tracking metadata is not magic.

Tracking metadata is not magic. In notebooks, it is a set of metadata items in the file and in scripts, it is specified in a comment at the top of the script. You can always inspect (or manipulate) the metadata manually without the tools described here.

Inspecting metadata#

When you are inside a Code Shelf project, you can use the shelf task to inspect the tracking metadata of a file:

pixi run shelf show path/to/file.ipynb

Checking metadata#

The tracking metadata of every file is checked automatically in GitLab. You can use the following to perform the same check locally:

pixi run shelf check path/to/file.ipynb

or

pixi run shelf check

to check all files in the project.

If these commands print nothing, then the metadata is correct.

Adding / updating metadata#

The shelf patch task allows you to add tracking metadata if it is missing or update existing metadata:

pixi run shelf patch path/to/file.ipynb

This command is interactive and guides you through the process. It is usually a good idea to inspect the metadata when you are done.