Skip to main content

Analyze, validate, and visualize Python import dependencies — like dependency-cruiser for Python.

Project description

import-cruiser

PyPI version Python versions Workflow License: MIT

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, and dot
  • 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-loc to 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:

import-cruiser self graph

Development

poetry install
poetry run pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

import_cruiser-0.2.20.tar.gz (31.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

import_cruiser-0.2.20-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file import_cruiser-0.2.20.tar.gz.

File metadata

  • Download URL: import_cruiser-0.2.20.tar.gz
  • Upload date:
  • Size: 31.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for import_cruiser-0.2.20.tar.gz
Algorithm Hash digest
SHA256 2f808210ccd9a6123d87086fabdbef845027704d16443b6e01e9eb0a1b60fcca
MD5 13390b5f7ca5526db9f0b2af869c9bbf
BLAKE2b-256 b68b037716c767e2315ad8bea5b256cbc5cdb27b43a8775cd176594875bfde39

See more details on using hashes here.

Provenance

The following attestation bundles were made for import_cruiser-0.2.20.tar.gz:

Publisher: workflow.yml on kevin91nl/import-cruiser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file import_cruiser-0.2.20-py3-none-any.whl.

File metadata

File hashes

Hashes for import_cruiser-0.2.20-py3-none-any.whl
Algorithm Hash digest
SHA256 23572384d243c1f2d7ec4f7d4eadb642edb5a80e72e47577b8e7a9de34d107e0
MD5 3111e87b3182a10ebe04b55d58716912
BLAKE2b-256 0c1948a11e48a93c2852e99090bdce97eba3e21f8c016a19e20d32870338f953

See more details on using hashes here.

Provenance

The following attestation bundles were made for import_cruiser-0.2.20-py3-none-any.whl:

Publisher: workflow.yml on kevin91nl/import-cruiser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page