import-cruiser
Analyze, validate, and visualize Python import dependencies.
import-cruiser helps you quickly answer:
- Where are tight couplings?
- Are there circular imports?
- Are architecture rules respected?
Why teams use it
- Fast graph export to
html,svg, anddot - Rule-based validation for CI (
validate --strict) - Readable interactive HTML output for architecture reviews
- Works out of the box on regular Python codebases
See it in action: project self-graph
Dependency graph of src/import_cruiser, generated by the tool itself:
Run make self-graph to refresh these artifacts—the script passes --show-loc so clusters include LOC badges in the DOT/HTML/SVG exports (with --cluster-mode module --cluster-depth 1, the self-graph renders a single top-level import_cruiser cluster and skips the src path layer).
The target also passes --include-external-deps, so non-dev third-party packages render as a grouped green block labeled “External dependencies” (without LOC badges). External roots are read from both tool.poetry.dependencies and project.dependencies.
Install
pip install import-cruiser
60-second quick start
From your repo root:
# 1) Generate an interactive dependency graph
import-cruiser export . --format html --output deps.html
# 2) Generate an embeddable SVG
import-cruiser export . --format svg --output deps.svg
# 3) Detect cycles and get a JSON report
import-cruiser analyze . --output report.json
For larger repos, filter noise:
import-cruiser export . \
--format html \
--include-path '^src/' \
--exclude-common-noise-paths \
--output deps-src.html
Commands
import-cruiser analyze <path> # analyze imports, output json/dot/svg/html
import-cruiser export <path> # export graph dot/svg/html
import-cruiser validate <path> # enforce dependency rules
Most useful options
--format {json,dot,svg,html}--include,--exclude--include-path,--exclude-path--exclude-common-noise-paths--cluster-depth,--cluster-mode--include-db-connectors,--include-http-hosts--show-locto show LOC per node/cluster and total LOC badge in HTML--include-external-depsto surface non-dev third-party packages as grouped green nodes (auto-enabled in the self-graph)--external-deps-include,--external-deps-excludeto filter which external dependency roots are surfaced
Validate architecture in CI
Minimal import-cruiser.json example:
{
"rules": [
{
"name": "no-data-to-ui",
"severity": "error",
"from": { "path": "\\.data" },
"to": { "path": "\\.ui" },
"allow": false
}
]
}
Run in CI:
import-cruiser validate . --config import-cruiser.json --strict --output-format github
Development
poetry install
poetry run pytest
License
MIT
Metadata
Release files for import-cruiser 0.2.38
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| import_cruiser-0.2.38.tar.gz | 36.2 kB | With provenance | Details for import_cruiser-0.2.38.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| import_cruiser-0.2.38-py3-none-any.whl | Python 3 | none | any | Details for import_cruiser-0.2.38-py3-none-any.whl |
Total release size: 74.4 kB
Release files / import_cruiser-0.2.38.tar.gz
| Download URL | import_cruiser-0.2.38.tar.gz |
|---|---|
| Size | 36.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44c339586c0f277bf0dc0a9fcef6b8e8410a56fff809630891ee76c9bd9c8779
|
|
BLAKE2b-256 checksum How to use checksums |
8b5a007618c60cb344f6aaa5b5bafa2224e0d616ecdf5fdf30367fce59346ea2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 30, 2026.
Transparency logRelease files / import_cruiser-0.2.38-py3-none-any.whl
| Download URL | import_cruiser-0.2.38-py3-none-any.whl |
|---|---|
| Size | 38.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ec8365bd732c91ef45fa6ba166242d90aa7f5fdbe83fa1be5d16bb56f5cedff
|
|
BLAKE2b-256 checksum How to use checksums |
6e174aa9eaa9e9559dc1eb75bd33f77ab2424192eb08be75de3de84f5d26c84b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 30, 2026.
Transparency logSecurity for import-cruiser 0.2.38
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for import_cruiser-0.2.38.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 30, 2026.
Transparency logA 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.