Analyze, validate, and visualize Python import dependencies — like dependency-cruiser for Python.
Project description
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
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
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
Project self-graph
Dependency graph of src/import_cruiser, generated by the tool itself:
Development
poetry install
poetry run pytest
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file import_cruiser-0.2.19.tar.gz.
File metadata
- Download URL: import_cruiser-0.2.19.tar.gz
- Upload date:
- Size: 31.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4abf4dbbe6d434d945f4eae7f84d80c058bb7a25f22609b78aed41a460bec42d
|
|
| MD5 |
af16695a9f4df6054af871c957c07f1c
|
|
| BLAKE2b-256 |
f96f9168e6c769799c620cb893b9407befcb8506eb59b0c1daf87f59e9e7d94a
|
Provenance
The following attestation bundles were made for import_cruiser-0.2.19.tar.gz:
Publisher:
workflow.yml on kevin91nl/import-cruiser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
import_cruiser-0.2.19.tar.gz -
Subject digest:
4abf4dbbe6d434d945f4eae7f84d80c058bb7a25f22609b78aed41a460bec42d - Sigstore transparency entry: 1188503309
- Sigstore integration time:
-
Permalink:
kevin91nl/import-cruiser@58948dff702ae093c831ed9e30aa2ebb6f60a958 -
Branch / Tag:
refs/tags/v0.2.19 - Owner: https://github.com/kevin91nl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@58948dff702ae093c831ed9e30aa2ebb6f60a958 -
Trigger Event:
push
-
Statement type:
File details
Details for the file import_cruiser-0.2.19-py3-none-any.whl.
File metadata
- Download URL: import_cruiser-0.2.19-py3-none-any.whl
- Upload date:
- Size: 34.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26aad879df1705a1268e8ca80abcbb5cab8ad05cc41499d3fcdd9e58343c9b8b
|
|
| MD5 |
10739eba17b2415333f051bdc9198cb9
|
|
| BLAKE2b-256 |
425115b3a05dd32966e767c769159698294bb392ca69e07c76538b33e26afcb1
|
Provenance
The following attestation bundles were made for import_cruiser-0.2.19-py3-none-any.whl:
Publisher:
workflow.yml on kevin91nl/import-cruiser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
import_cruiser-0.2.19-py3-none-any.whl -
Subject digest:
26aad879df1705a1268e8ca80abcbb5cab8ad05cc41499d3fcdd9e58343c9b8b - Sigstore transparency entry: 1188503328
- Sigstore integration time:
-
Permalink:
kevin91nl/import-cruiser@58948dff702ae093c831ed9e30aa2ebb6f60a958 -
Branch / Tag:
refs/tags/v0.2.19 - Owner: https://github.com/kevin91nl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@58948dff702ae093c831ed9e30aa2ebb6f60a958 -
Trigger Event:
push
-
Statement type: