Developer information

The information here is intended to get Magpie developers up-to-speed for working with the codebase.

Logging

The logging level is controlled by the config.MAGPIE_LOG_LEVEL variable.

It can consist in a single value defining the default logging level for all modules, like:

MAGPIE_LOG_LEVEL=DEBUG

or it can be a comma-separated list of module=LEVEL value pairs, like:

MAGPIE_LOG_LEVEL=INFO,magpie=DEBUG,celery=DEBUG

In this case, the default logging level will be INFO but all messages issued from the magpie and celery modules will be logged with DEBUG severity.

Pretty-printing functions

The magpie.util module has a few pretty-printing functions:

  • pprint: to print a nice representation of the given object to the console.

  • pformat: to return a string containing a nice representation of the given object.

  • rprint: this is a re-export of the rich.pretty.pprint() function

Coding style

We mostly conform to PEP8, with a max line length of 120.

Linting is performed by Ruff, use the following to run it:

just check

Docstrings

Docstrings are written in the markdown format, using the Google-style for docstrings.

Documentation

Colon fences

When writing documentation in markdown, you can use colon fences instead of the standard triple backquotes to render directives. This is especially useful for admonitions and the like as the fenced content will be rendered as markdown by your editor and not as monospace text.