python/import-linter
Runs project import contracts from setup.cfg, .importlinter, or pyproject.toml.
Part of the python configuration, at the recommended level. It runs at the commit stage, once per scope. It runs uv.
A layer that imports the layer above it turns an architecture into a diagram nobody follows.
What to do
Section titled “What to do”Move the import to the side the contract allows, or change the contract.
Example
Section titled “Example”A module that imports from a forbidden layer reports a broken contract. Move the shared code to an allowed layer, and update the import.
Turn it off
Section titled “Turn it off”Turn it off for some files, with a reason:
gspot ignore python/import-linter --paths "<glob>" --reason "<why>"