FE-1415: Generate import edges for Python packages - #9252
Draft
kube wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
kube
force-pushed
the
cf/fe-1415-arch-docs-generate-import-edges-for-python-packages
branch
from
August 19, 2026 16:06
3ef4667 to
58ce62d
Compare
kube
force-pushed
the
cf/fe-1415-arch-docs-generate-import-edges-for-python-packages
branch
from
August 19, 2026 16:15
58ce62d to
5ad8d7e
Compare
kube
force-pushed
the
cf/fe-1415-arch-docs-generate-import-edges-for-python-packages
branch
from
August 19, 2026 16:22
5ad8d7e to
3fe1939
Compare
kube
force-pushed
the
cf/fe-1415-arch-docs-generate-import-edges-for-python-packages
branch
from
August 19, 2026 16:47
3fe1939 to
dad50f8
Compare
kube
force-pushed
the
cf/fe-1415-arch-docs-generate-import-edges-for-python-packages
branch
from
August 19, 2026 17:32
dad50f8 to
41682c6
Compare
kube
force-pushed
the
cf/fe-1415-arch-docs-generate-import-edges-for-python-packages
branch
from
August 19, 2026 22:16
5323c1d to
3dd9e5b
Compare
kube
force-pushed
the
cf/fe-1415-arch-docs-generate-import-edges-for-python-packages
branch
from
August 19, 2026 22:54
3dd9e5b to
d705288
Compare
kube
force-pushed
the
cf/fe-1415-arch-docs-generate-import-edges-for-python-packages
branch
from
August 19, 2026 22:56
d705288 to
6ab77ad
Compare
kube
force-pushed
the
cf/fe-1415-arch-docs-generate-import-edges-for-python-packages
branch
from
August 19, 2026 23:45
6ab77ad to
a1241c6
Compare
kube
force-pushed
the
cf/fe-1415-arch-docs-generate-import-edges-for-python-packages
branch
from
August 20, 2026 00:26
a1241c6 to
5ffe338
Compare
kube
force-pushed
the
cf/fe-1415-arch-docs-generate-import-edges-for-python-packages
branch
from
August 20, 2026 00:29
5ffe338 to
3eacd7f
Compare
kube
force-pushed
the
cf/fe-1415-arch-docs-generate-import-edges-for-python-packages
branch
from
August 20, 2026 00:50
3eacd7f to
12dab88
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🌟 What is the purpose of this PR?
Implements FE-1415: Python packages had layers but no edges, because the import graph came from dependency-cruiser (TypeScript only). The optimizer's real dependency on the Python bindings was invisible, and its diagram suggested dead code.
The bundle now derives Python import edges the same way as TypeScript ones. The visible result:
{ "from": "optimizer", "to": "python-bindings", "provenance": "imports", "fileDependencies": 2, "crossesPackage": true }Top of stack #9226, on FE-1447.
🔗 Related links
python-bindings → cliedge stays declared, and the duplicate check confirms the two never overlap.🔍 What does this change?
libs/@local/petrinaut-arch-docs:graph.ts):buildGraphsplits covered packages by language. TypeScript goes through dependency-cruiser as before; Python goes through a new collector. Both produce the same file-level dependency records, so aggregation, intra-layer dropping, example pairs,crossesPackage, rules, and the declared-edge duplicate check apply to Python unchanged.python-imports.ts(new, no dependencies): a line-based parser forimport a.bandfrom a.b import c(aliases, comma lists, parenthesised continuations, relative imports), a module index over the covered Python packages, and a resolver. Imports that resolve to nothing covered (stdlib, third-party) drop silently, matching the TypeScript behaviour. A false negative beats a false positive: strings and comments are skipped conservatively.content/index.mdxno longer say Python contributes no edges.Edge count: 198 → 199. The one new edge is the optimizer's import of the bindings; intra-package Python imports aggregate away as intra-layer, as they should.
Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
🛡 What tests cover this?
python-imports.test.ts(new): parsing (absolute, from-import, aliases, relative, continuations, comment/string non-matches), module indexing, resolution.graph.test.ts: a full-chain assertion that a Python cross-package import aggregates into an edge.lint:arch-docsexercises the real repo: 199 edges, zero diagnostics.❓ How to test this?
yarn workspace @local/petrinaut-arch-docs lint:arch-docs— 199 edges.turbo run dev --filter @apps/petrinaut-docs— theoptimizerpage showspython-bindingsunder "Depends on" with an import count, and the overview diagram draws the solid edge next to the dashed declared one.🤖 Generated with Claude Code