Skip to main content

Lightweight Swift file-level dependency mapper

Project description

swift-deps-map

Lightweight Swift file-level dependency mapper that scans a source tree for symbol definitions/references and reports cross-file edges. Generates human-readable summaries plus optional graph/JSON exports for visualization.

Features

  • Default root is the current working directory for drop-in use on any Swift repo.
  • Supports focus prefixes for zooming into specific folders.
  • Exports graphs in Mermaid, Graphviz DOT, or Cytoscape JSON.
  • Optional JSON report with symbols and edges for further processing.
  • --max-files guard to avoid runaway scans on very large projects.
  • Proper exit codes with errors sent to stderr for automation friendliness.

Quick start

From PyPI (after publishing):

uvx swift-deps-map --help
uvx swift-deps-map --root /path/to/src --graph-format mermaid --graph-output deps.mmd

Local, without publishing (run at repo root):

uvx --from . swift-deps-map --root . --graph-format cytoscape --graph-output deps.cyto.json

You can also call the module directly:

python -m swift_deps_map --help

CLI options

  • --root PATH (default: .) Root directory to scan.
  • --focus PREFIX... Limit printed focus sections to matching relative paths.
  • --limit N Max rows per focus section (default: 20).
  • --max-files N Abort if more than N Swift files are detected (0 disables).
  • --json PATH Write the JSON report to PATH.
  • --graph-format {mermaid,dot,cytoscape} Choose graph export format.
  • --graph-output PATH Write graph output to PATH (stdout if omitted).
  • --include-viewer When using --graph-format cytoscape with --graph-output, also drop cyto_viewer.html beside the JSON so you can open it directly.
  • --version Show the CLI version.

Outputs

  • Console summary: Total Swift files, unique symbols, duplicate symbol hints, and feature-level edges.
  • Graph exports: Mermaid/DOT snippets or Cytoscape JSON for visual viewers.
  • JSON report: Includes root, focus, dependencies, and per-file defines/references.

Development

  • Requires Python 3.9+.
  • Install/iterate locally: uvx --from . swift-deps-map --help or python -m swift_deps_map --help.
  • Package data includes cyto_viewer.html for Cytoscape visualization if you want an offline viewer.

License

Apache-2.0. See LICENSE.

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

swift_deps_map-0.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

swift_deps_map-0.1.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file swift_deps_map-0.1.0.tar.gz.

File metadata

  • Download URL: swift_deps_map-0.1.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for swift_deps_map-0.1.0.tar.gz
Algorithm Hash digest
SHA256 63dcbc250297d2520603acbd0235b9bcdaf40aa1b79b280133e0977e58994546
MD5 1630b700953c5bfe2e736c8059f5160e
BLAKE2b-256 b3448fe2260b69a88f7fdc776fb33dcbdb04d281a330c8e65ff7101b0518d97b

See more details on using hashes here.

File details

Details for the file swift_deps_map-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: swift_deps_map-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for swift_deps_map-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 310265ec7991d88bd18567cf6ec52c79a2c45493904f06b3986c626d9bc13aa6
MD5 409e11a8330d203bd573c0ab99693e1a
BLAKE2b-256 f2cdf5af1f420f73b833d4ae59bcf980896cb7666ca6bacc958c0f5fab527b9f

See more details on using hashes here.

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