Development Guide

Setup

Install uv

pipx install uv

and install all dependencies in a venv

uv pip install --all-groups

Also install the pre-commit hooks

pre-commit install

Don’t forget to activate the venv

source .venv/bin/activate

Lastly, install the editable package locally

uv pip install -e .

Debug

To browse the sqlite3 db for debugging, install sqlitebrowser.

There is a debug docker-compose file that can be used to run the application in debug mode.

Alternatively you can run the local package

python3 -m cata_log

Testing

Unittests

The projects tests are in the test/ directory. You can run them from the project root with

pytest

The cata_log_hub package must be installed beforehand.

Validation and Linting

You can use the tools in tools/ to lint and check your changes.

The code is formatted using ruff.

Before every commit the code is formatted, checked and linted by pre-commit.

IDE setups

Zed

"lsp": {
    "ruff": {
      "initialization_options": {
        "settings": {
          "configuration": "tools/ruff.toml",
        },
      },
    },
  },
  "languages": {
    "Markdown": {
      "remove_trailing_whitespace_on_save": true,
    },
    "Python": {
      "format_on_save": "on",
    },
    "HTML": {
      "format_on_save": "on",
      "formatter": {
        "external": {
          "command": "djlint",
          "arguments": [
            "-",
            "--reformat",
            "--configuration",
            "tools/djlintrc",
            "{buffer_path}",
          ],
        },
      },
    },
  }