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.0.0.tar.gz (75.6 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.0.0-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for modwire-1.0.0.tar.gz
Algorithm Hash digest
SHA256 67aef61b4fef5359474cbf09f653c7885024770ef633752c4c88b391a5f760f3
MD5 09a2c685ca7950ef7ee48e2c5d20d056
BLAKE2b-256 d91464a43c1f8491f7522128ca443fe71cfde37534c99770df7ce18927fc2a9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for modwire-1.0.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.0.0-py3-none-any.whl.

File metadata

  • Download URL: modwire-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 30.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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c779574fd6710269612d2d8e7c9ba80baea6a812f77e131a4f65e21e07eb8b51
MD5 bb88b7e6edd167f263285cd21d7dda3e
BLAKE2b-256 d5149b58b18400138338a0e69bf62529058100533d14061d31c9b0ed423ed8f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for modwire-1.0.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