fix(deploy): drop examples/chat/python/src/__init__.py — restore namespace-package collision-free imports#303
Merged
Merged
Conversation
…ace packages The shared cockpit-dev LangGraph Cloud deployment stages every Python capability under its own `deps/<alias>/` directory. Each dep ships its own `src/` subdir. When Python's import resolver encounters multiple `src/` directories on the path, the first one with a regular package marker (`__init__.py`) "claims" the namespace; subsequent `src/` directories become invisible. `cockpit/langgraph/streaming/python/src/` has no `__init__.py` — its `src` is a namespace package. After Phase 1 of the canonical-demo deployment added `examples/chat/python` to the shared bundle, that dep's `src/__init__.py` (empty) claimed the `src` namespace, and imports like `from src.dashboard_graph import graph` in `chat_graphs.py` started resolving against the wrong `src/` and failing with ModuleNotFoundError. The `__init__.py` was empty and no code imports `src` explicitly, so deleting it is safe. The streaming graph's `c-generative-ui` and sibling graphs load again; the new `chat` graph from this branch is unaffected (its own imports are all from `.foo` / module-relative). Fixes the DEPLOY_FAILED revision 30b289c4 on cockpit-dev. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
After Phase 1 of the canonical-demo deployment plan (#300) merged, the shared
cockpit-devLangGraph Cloud deployment failed to apply its new revision (30b289c4-67ee-48d0-aecd-430bd1f3d8bf→DEPLOY_FAILED). Pulled deploy logs and confirmed the root cause:Root cause
The shared deployment stages every Python capability under
deps/<alias>/, each shipping its ownsrc/subdir.cockpit/langgraph/streaming/python/src/— no__init__.py→ namespace package (PEP 420)examples/chat/python/src/— had an empty__init__.py→ regular packageWhen Python's import resolver sees multiple
src/directories on sys.path, the first one with__init__.pyclaims thesrcnamespace as a regular package and shadows the rest. Sofrom src.dashboard_graphinchat_graphs.pyresolved againstdeps/examples-chat/src/(nodashboard_graph) instead ofdeps/streaming/src/and threwModuleNotFoundError.Fix
Delete
examples/chat/python/src/__init__.py. It was empty; nothing importssrcexplicitly; all subpackages (src/schemas/,src/streaming/) retain their own__init__.py, so they continue to work as regular packages.Local verification:
python -c "import src.graph"resolves cleanly after deletion. Bothchat(canonical demo) and all the cockpit graphs now share a merged namespace package and coexist.Test plan
+ "" +Deploy LangGraph+ "" +workflow runs, new revision succeeds,+ "" +Production smoke+ "" +shows+ "" +chat: smoke test passed+ "" +for the first time🤖 Generated with Claude Code