Boundary linter for large Python and Django monorepos, with a Rust engine
Maintained. Last release 1 day ago, commits in 4 of the last 26 weeks. Weaker on commit activity and contributor spread.
pip install hoglintREADME as published on PyPI with version 0.3.0.
Hoglint
Hoglint is a boundary linter for large Python and Django monorepos, built at PostHog.
It reads every Python file of a repo and builds one graph of the couplings between its packages: imports, dotted paths in strings, Django model and settings references, and more. It checks that graph against rules that you write in TOML. Existing violations go into a generated ledger file, so a rule can block new problems on the first day, before the old ones are fixed.
A Rust engine extracts the facts and judges the rules. A thin Python command line runs it.
Install
uv add --dev hoglint
uv run hoglint check
The wheel holds the Python package, the native module and the fact extractor, so you do not need a Rust toolchain. Wheels exist for Linux (x86_64 and aarch64, manylinux) and macOS (arm64 and x86_64). Hoglint needs Python 3.14 or newer.
Configure
Hoglint reads hoglint.toml at the root of the repo.
The config can extend the built-in Django pack (extends = ["hoglint:django"]) and presets of your own.
hoglint explain-config prints the expanded config, with the source of each key.
Commands
| Command | What it does |
|---|---|
hoglint check | Runs every rule on the working tree. |
hoglint check --index | Checks the staged snapshot. This is what the pre-commit hook runs. |
hoglint check --write-ledger | Rewrites the ledger from the scan. It adds new lines only with --record-growth. It keeps the level line of a group that no longer passes the level and exits 1; a person who lets the group lose the level passes --drop-levels. |
hoglint ledger shrink | Removes stale ledger lines. It never adds a line. It keeps the level line of a group that no longer passes the level and exits 1; a person who lets the group lose the level passes --drop-levels. |
hoglint compare --base <ref> | Checks a pull request against the merge base of <ref>. |
hoglint explain <rule> |