Skip to main content

Extract source-code dependencies and build dependency graphs.

Project description

modwire

modwire extracts source-code structure and import dependencies from Python, TypeScript/JavaScript, and PHP projects. It returns typed Python objects that you can use to build dependency graphs, inspect symbols, and evaluate architecture rules.

Installation

python -m pip install modwire

The Python extractor works with Python alone. TypeScript/JavaScript extraction requires Node.js at runtime, and PHP extraction requires PHP at runtime.

Quick Start

from pathlib import Path

from modwire import extract_code

result = extract_code(
    "python",
    Path("src"),
    exclusions=("**/__pycache__/**",),
)

print(result.extraction_result.summary.files_checked)
print(result.graph.node_ids())
print([(edge.from_id, edge.to_id) for edge in result.graph.edges])

Graph nodes use canonical extensionless source IDs, so equivalent Python, TypeScript, and PHP projects can be compared through the same graph shape.

Supported Languages

from modwire import supported_languages

print(supported_languages())
# ("python", "typescript", "php")

Language-specific source IDs can be normalized without running a full extraction:

from modwire import normalize_source_id

print(normalize_source_id("typescript", "src/view.tsx"))
# "src/view"

Architecture Policy API

modwire.architecture exposes policy evaluation helpers for checking import boundaries and common dependency-flow rules.

from modwire.architecture import ArchitecturePolicyEvaluator, supported_analyzers

print(supported_analyzers())
# ("backward-flow", "no-reentry", "no-cycles")

evaluator = ArchitecturePolicyEvaluator()

Development

uv run ruff check
uv run pytest
uv run python -m build --outdir dist
uv run twine check dist/*

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

modwire-1.1.0.tar.gz (82.5 kB view details)

Uploaded Source

Built Distribution

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

modwire-1.1.0-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

Details for the file modwire-1.1.0.tar.gz.

File metadata

  • Download URL: modwire-1.1.0.tar.gz
  • Upload date:
  • Size: 82.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for modwire-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5ac18bcaf15bb8f7932b7e085cac18292fe8bda7cdee8345bbe9ea1ea1d9e82f
MD5 6f6c4b47284243a6913510107c85b9a5
BLAKE2b-256 1f0a4fd8146f024bdabac01e43d0582219bebfea416e957b3ec938689993ddba

See more details on using hashes here.

Provenance

The following attestation bundles were made for modwire-1.1.0.tar.gz:

Publisher: release.yml on 9orky/modwire

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

File details

Details for the file modwire-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: modwire-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 36.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for modwire-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eac763f33dce800a9da05810b6c599d3ec19d4fa90aed353c001bab321d3d5ad
MD5 ac6578956fca52b0d36b728a8d1f9082
BLAKE2b-256 7daeaa8c33c0a6a0929eada492b7ab464af63ede04503e3258c8f3b2ce0dd870

See more details on using hashes here.

Provenance

The following attestation bundles were made for modwire-1.1.0-py3-none-any.whl:

Publisher: release.yml on 9orky/modwire

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