Skip to content

fix(deploy): drop examples/chat/python/src/__init__.py — restore namespace-package collision-free imports#303

Merged
blove merged 1 commit into
mainfrom
claude/fix-shared-deploy-init
May 13, 2026
Merged

fix(deploy): drop examples/chat/python/src/__init__.py — restore namespace-package collision-free imports#303
blove merged 1 commit into
mainfrom
claude/fix-shared-deploy-init

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 13, 2026

Summary

After Phase 1 of the canonical-demo deployment plan (#300) merged, the shared cockpit-dev LangGraph Cloud deployment failed to apply its new revision (30b289c4-67ee-48d0-aecd-430bd1f3d8bfDEPLOY_FAILED). Pulled deploy logs and confirmed the root cause:

File "/deps/streaming/src/chat_graphs.py", line 47, in <module>
  from src.dashboard_graph import graph as generative_ui
ModuleNotFoundError: No module named 'src.dashboard_graph'

Root cause

The shared deployment stages every Python capability under deps/<alias>/, each shipping its own src/ subdir.

  • cockpit/langgraph/streaming/python/src/no __init__.py → namespace package (PEP 420)
  • examples/chat/python/src/had an empty __init__.py → regular package

When Python's import resolver sees multiple src/ directories on sys.path, the first one with __init__.py claims the src namespace as a regular package and shadows the rest. So from src.dashboard_graph in chat_graphs.py resolved against deps/examples-chat/src/ (no dashboard_graph) instead of deps/streaming/src/ and threw ModuleNotFoundError.

Fix

Delete examples/chat/python/src/__init__.py. It was empty; nothing imports src explicitly; 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. Both chat (canonical demo) and all the cockpit graphs now share a merged namespace package and coexist.

Test plan

  • Local: namespace package resolution works for examples/chat
  • After merge: + "" + Deploy LangGraph + "" + workflow runs, new revision succeeds, + "" + Production smoke + "" + shows + "" + chat: smoke test passed + "" + for the first time

🤖 Generated with Claude Code

…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>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment May 13, 2026 9:17pm

Request Review

@blove blove merged commit 4fd1bd2 into main May 13, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant