MCPcopy Create free account
hub / github.com/acking-you/static_flow / workspace_graph

Function workspace_graph

scripts/ci_affected.py:75–100  ·  view source on GitHub ↗

Return (dir2name, deps) parsed from Cargo.toml manifests. deps[crate] = set of intra-workspace crates it depends on (any dep kind, any target), resolved via path deps. No cargo invocation, so no submodules required.

()

Source from the content-addressed store, hash-verified

73 """Yield (name, spec) across every dependency table of one manifest,
74 including the target-specific ones (e.g. the non-wasm table that gates
75 static-flow-shared's lance/lancedb deps)."""
76 for sect in ("dependencies", "dev-dependencies", "build-dependencies"):
77 yield from ct.get(sect, {}).items()
78 for target_tables in ct.get("target", {}).values():
79 yield from target_tables.get(sect, {}).items()
80
81
82def workspace_graph():
83 """Return (dir2name, deps) parsed from Cargo.toml manifests.
84
85 deps[crate] = set of intra-workspace crates it depends on (any dep kind,
86 any target), resolved via path deps. No cargo invocation, so no
87 submodules required.
88 """
89 root_manifest = tomllib.load(open(REPO / "Cargo.toml", "rb"))
90 members = root_manifest["workspace"]["members"]
91 dir2name = {}
92 for m in members:
93 ct = tomllib.load(open(REPO / m / "Cargo.toml", "rb"))
94 dir2name[m] = ct["package"]["name"]
95 deps = defaultdict(set)
96 for m in members:
97 ct = tomllib.load(open(REPO / m / "Cargo.toml", "rb"))
98 for _key, spec in manifest_dep_items(ct):
99 if isinstance(spec, dict) and "path" in spec:
100 tgt = (REPO / m / spec["path"]).resolve()
101 try:
102 rel = tgt.relative_to(REPO).as_posix()
103 except ValueError:

Callers 1

detectFunction · 0.85

Calls 3

manifest_dep_itemsFunction · 0.85
loadMethod · 0.80
resolveMethod · 0.80

Tested by

no test coverage detected