Skip to content

fix: add PYTHONPATH=/app to Dockerfile for intra-package imports#343

Merged
hf-kklein merged 2 commits intomainfrom
fix/dockerfile-pythonpath
Apr 2, 2026
Merged

fix: add PYTHONPATH=/app to Dockerfile for intra-package imports#343
hf-kklein merged 2 commits intomainfrom
fix/dockerfile-pythonpath

Conversation

@hf-kklein
Copy link
Copy Markdown
Contributor

Problem

The Dockerfile runs `python ebd_toolchain/main.py` directly. Python adds the script's directory (`/app/ebd_toolchain/`) to `sys.path` but NOT `/app/`.

This means neither approach works:

  • Absolute: `from ebd_toolchain.ahb_pruefi import ...` → `ModuleNotFoundError: No module named 'ebd_toolchain'`
  • Relative: `from .ahb_pruefi import ...` → `ImportError: attempted relative import with no known parent package`

Fix

Add `ENV PYTHONPATH=/app` to the Dockerfile (one line). Revert to absolute import (standard Python style).

Prevention

Guard test verifies the Dockerfile contains `PYTHONPATH`.

Also

Updated README to mention the new optional `GITHUB_TOKEN` and `FORMAT_VERSION` env vars.

🤖 Generated with Claude Code

hf-kklein and others added 2 commits April 2, 2026 19:04
The Dockerfile runs `python ebd_toolchain/main.py` directly. Python adds
the script's directory (/app/ebd_toolchain/) to sys.path but NOT /app/.

  - Absolute imports → ModuleNotFoundError: No module named 'ebd_toolchain'
  - Relative imports → ImportError: attempted relative import with no known parent package

Fix: set ENV PYTHONPATH=/app in Dockerfile. Revert to absolute import
(the standard Python style). Update guard test to verify PYTHONPATH is set.
Update README with new optional env vars.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@hf-kklein hf-kklein merged commit beb6058 into main Apr 2, 2026
17 checks passed
@hf-kklein hf-kklein deleted the fix/dockerfile-pythonpath branch April 2, 2026 19:14
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