curfew¶
couvre-feu — "cover the fire". An after-hours rule that keeps things within their bounds. That's exactly what this tool does for your imports.
curfew is a local-first Python dependency & module-boundary checker — an
opinionated, fully-offline alternative to tach.
From a single static import-graph engine it does two jobs:
- Module boundaries — enforce which first-party modules/packages may import which.
- External & workspace validation — per package, verify every imported third-party package is declared, flag declared-but-unused dependencies, and detect uv workspace leakage.
It also visualises the dependency graph entirely offline.
Install¶
uv tool install curfew # zero transitive runtime dependencies
uv tool install "curfew[rich]" # optional colour output
Quick start¶
curfew check # run all checks; non-zero exit on any error (CI gate)
curfew show --mermaid -o graph.md # dependency graph as Mermaid (renders on GitHub)
curfew report path/to/module.py # dependencies and dependents of a module
curfew init # scaffold a [tool.curfew] config
Run inside your workspace venv
Workspace-leakage detection relies on the single shared environment that uv
creates for a workspace, so run curfew from inside it.
See Why curfew, Usage, Configuration, and the dogfooded dependency graph.