Skip to main content

tomte

A library that wraps many useful tools (linters, analysers, etc) to keep Python code clean, secure, well-documented and optimised.

Essentially does nothing else but pinning multiple packages to compatible versions, for consistency across many projects and simplicity of use.

Extremely (!) opinionated by design!

Wrapped tools

  • black
  • bandit
  • isort
  • flake8
  • mypy
  • safety
  • darglint
  • vulture
  • pylint
  • docs (various mkdocs libraries)
  • tests (various pytest libraries)
  • tox
  • liccheck

To install, for instance black, simply specify tomte[black]==VERSION, where VERSION is the latest version, and then use black CLI as required.

Shipped configs

Since 0.7.0, tomte ships canonical linter configurations as packaged resources. Reach them from a tox env (or any tooling) via:

from tomte.configs import PYLINTRC, MYPY_INI, ISORT_CFG, FLAKE8_CFG, DARGLINT_CFG, BANDIT_YAML, SAFETY_POLICY

Each constant is a pathlib.Path to the file inside the installed wheel. Typical use:

[testenv:pylint]
commands = pylint --rcfile={envsitepackagesdir}/tomte/configs/pylintrc <paths>

tomte tox runtime wrapper

Since 0.7.0, tomte tox renders the canonical tox.ini (shipped at tomte/configs/tox.ini) at runtime, reading per-repo identity from [tool.tomte] in the consumer's pyproject.toml and a slim [tomte-extensions] section in their local tox.ini. The rendered file is ephemeral — nothing generated lives on disk between runs. Invoke as a drop-in replacement: tomte tox -e <env>.

Per-repo settings in [tool.tomte] (TOML in pyproject.toml): packages_paths, pytest_targets[_extra|_exclude], service_specific_packages[_extra], service_public_id, known_first_party, open_autonomy_version, open_aea_version, check_handlers_ignores, check_dependencies_extra_excludes, upstream_pins, gitleaks_extra_paths, gitleaks_extra_regexes, safety_ignores, safety_scan_lock, tomte_dep_pin. Most defaults auto-derive from packages.json.

By default the safety env scans only safety's own virtualenv, which says nothing about the repo. Set safety_scan_lock = true to scan the repo's locked dependencies instead: the env runs tomte export-safety-requirements, which pins every released package in uv.lock (or, failing that, poetry.lock), and the scan reads only that export. The fleet baseline is not applied then, since it covers safety's own dependencies. A missing or unreadable lock fails the env. A package locked from git or a URL is checked as the PyPI release of its version, not as its source, and the export names each one.

safety_ignores takes an advisory id or a list of them and renders them as --ignore flags on the safety scan, after the fleet baseline in _FLEET_SAFETY_IGNORES. Add an entry only when the vulnerable code is unreachable from the repo, and record why alongside it. An unavailable fix is a reason an entry cannot be retired yet, not a reason to add one.

service_public_id takes a single public id or a list of them, and [testenv:analyse-service] runs autonomy analyse service once per entry. Left undeclared, it defaults to every service in packages.json; in a repo with no services the env is not rendered at all, so tomte tox -e analyse-service there reports an unknown environment.

Per-repo settings in [tomte-extensions] (raw INI in local tox.ini, for things that don't fit cleanly in TOML): extra_deps, extra_pylint_disables, extra_pylint_ignored_modules, extra_testenvs — multi-line continuation values that configparser preserves verbatim.

Scope. tomte tox targets AEA agent repos — the homogeneous fleet that ships packages/valory/ skills + agents + services and bootstraps via the autonomy CLI. Framework repos (open-aea, open-autonomy) keep their own hand-written tox.ini and consume the canonical configs directly (from tomte.configs import PYLINTRC, MYPY_INI, …) via --rcfile= / --config= flags.

Pytest plugin (opt-in)

Tomte declares a pytest11 entry-point plugin in pyproject.toml that ships fleet-canonical pytest defaults: the integration and e2e markers, plus an ignore::DeprecationWarning:aea.*: filter. Pytest auto-loads pytest11 plugins, so the plugin module is imported in any environment where tomte is installed — but the plugin is silent by default; it registers nothing unless the consumer opts in:

# tox.ini (or pyproject.toml [tool.pytest.ini_options], or pytest.ini)
[pytest]
tomte_defaults = true

Truthy spellings: true, 1, yes, on (case-insensitive). Without opt-in, non-fleet tomte[black] / tomte[mypy] consumers see no config injection.

Development:

Install deps:

Install poetry. Install development dependencies before running maintenance scripts:

poetry install --with dev

Upgrading versions

Use the script directly (fully automated, no manual pin editing):

  1. Run poetry run python bump_to_latest.py

This command automatically:

  • Resolves latest compatible versions for <4,>=3.10 support.
  • Applies strict == pins with Poetry.
  • Falls back to the highest resolver-compatible version when the absolute latest conflicts.
  • Bumps package version (patch by default) in pyproject.toml, tomte/__init__.py, and tests/test_tomte.py.
  • Regenerates poetry.lock.

Useful flags:

  • --dry-run
  • --bump-version none|patch|minor|major
  • --no-lock

Name

"The Swedish hustomte (house elf/gnome) is a quiet little guy, dressed mostly in gray and red, living at your house or farmsted helping out by taking care of things around the house and keep everyone safe."

A tomte and his son enjoying quiet company of the cat. Illustration by Rolf Lidberg.

"A tomte and his son enjoying quiet company of the cat. Illustration by Rolf Lidberg."

Release guide:

Finish edits and ensure dev dependencies are installed (poetry install --with dev), then run poetry run python bump_to_latest.py, then poetry run pytest -q, then poetry build, then rm -rf dist, then poetry publish --build --username=<username> --password=<password>.

Metadata

Release files for tomte 0.7.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tomte 0.7.4
File Size Uploaded Provenance Actions
tomte-0.7.4.tar.gz 49.3 kB Without provenance Details for tomte-0.7.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tomte 0.7.4
File Interpreter ABI Platform Actions
tomte-0.7.4-py3-none-any.whl Python 3 none any Details for tomte-0.7.4-py3-none-any.whl

Total release size: 106.9 kB

Release files / tomte-0.7.4.tar.gz

Download URL tomte-0.7.4.tar.gz
Size 49.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6ad5df591f1b5252ed47103f671594feec9f3db504de3cafbc8a33a84168355c
BLAKE2b-256 checksum
How to use checksums
a0057ec88bed44e641f0044546d0f76dac8f94f9f91eec1d6273ad5ec085db8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / tomte-0.7.4-py3-none-any.whl

Download URL tomte-0.7.4-py3-none-any.whl
Size 57.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a7634141db7ed5fd21728b036b17e741509c8eb16b0d64a097195c647ab345e
BLAKE2b-256 checksum
How to use checksums
a2b28657ba25887a5ba281ca9803be84694b712d5672d11487674ddfab77997f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for tomte 0.7.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.7.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page