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-filesguard 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 NMax rows per focus section (default: 20).--max-files NAbort if more than N Swift files are detected (0 disables).--json PATHWrite the JSON report to PATH.--graph-format {mermaid,dot,cytoscape}Choose graph export format.--graph-output PATHWrite graph output to PATH (stdout if omitted).--include-viewerWhen using--graph-format cytoscapewith--graph-output, also dropcyto_viewer.htmlbeside the JSON so you can open it directly.--versionShow 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-filedefines/references.
Development
- Requires Python 3.9+.
- Install/iterate locally:
uvx --from . swift-deps-map --helporpython -m swift_deps_map --help. - Package data includes
cyto_viewer.htmlfor Cytoscape visualization if you want an offline viewer.
License
Apache-2.0. See LICENSE.
Release files for swift-deps-map 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swift_deps_map-0.1.0.tar.gz | 15.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swift_deps_map-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.3 kB
Release files / swift_deps_map-0.1.0.tar.gz
| Download URL | swift_deps_map-0.1.0.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63dcbc250297d2520603acbd0235b9bcdaf40aa1b79b280133e0977e58994546
|
|
BLAKE2b-256 checksum How to use checksums |
b3448fe2260b69a88f7fdc776fb33dcbdb04d281a330c8e65ff7101b0518d97b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Release files / swift_deps_map-0.1.0-py3-none-any.whl
| Download URL | swift_deps_map-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
310265ec7991d88bd18567cf6ec52c79a2c45493904f06b3986c626d9bc13aa6
|
|
BLAKE2b-256 checksum How to use checksums |
f2cdf5af1f420f73b833d4ae59bcf980896cb7666ca6bacc958c0f5fab527b9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|