Skip to content

fix(packaging): include all subpackages and prompt files in wheel#43

Open
fuleinist wants to merge 1 commit into
federicodeponte:masterfrom
fuleinist:fix/packaging-include-subpackages
Open

fix(packaging): include all subpackages and prompt files in wheel#43
fuleinist wants to merge 1 commit into
federicodeponte:masterfrom
fuleinist:fix/packaging-include-subpackages

Conversation

@fuleinist

Copy link
Copy Markdown

Fixes #26.

Root cause

pyproject.toml declared:

[tool.setuptools]
packages = ["engine"]

This only ships the top-level engine package. Every subpackage — engine.concurrency, engine.opendraft, engine.phases, engine.utils, engine.utils.api_citations, engine.utils.pdf_engines — was silently dropped from the wheel. The prompts/**/*.md package-data glob then resolved against an empty directory, so engine/prompts/01_research/scribe.md (and every other prompt file) was missing from installed packages.

Fix

Replace the explicit packages list with auto-discovery:

[tool.setuptools.packages.find]
include = ["engine*"]
namespaces = false

[tool.setuptools.package-data]
engine = ["prompts/**/*.md", "prompts/**/*.txt"]

Verification

Built a wheel with the patched config and inspected its contents. The new wheel ships:

  • engine/concurrency/, engine/opendraft/, engine/phases/, engine/utils/api_citations/, engine/utils/pdf_engines/
  • The full engine/prompts/ tree, including the previously-missing prompts/01_research/scribe.md from the bug report

Tests

Adds tests/test_packaging_subpackages.py with three regression checks:

  1. pyproject must use packages.find OR explicitly list every subpackage
  2. Prompt files (incl. the exact scribe.md from [BUG] "FileNotFoundError: Prompt file not found: prompts/01_research/scribe.md – file is missing from the installed package even after force-reinstall" #26) exist on disk
  3. package-data declares prompts/**/*.md

All 3 pass.

Surgical change: 4 lines removed, 7 lines added in pyproject.toml; one new test file.

Fixes federicodeponte#26.

`pyproject.toml` declared `packages = ["engine"]`, which only ships
the top-level `engine` package — `engine.concurrency`,
`engine.opendraft`, `engine.phases`, `engine.utils`, and the
`engine/prompts/*.md` data files were silently dropped from the wheel.

After a fresh `pip install`, users hit:

    FileNotFoundError: Prompt file not found: prompts/01_research/scribe.md

because the prompt directory never made it into the installed package,
even after `pip install --force-reinstall`.

Replace the explicit `packages` list with
`[tool.setuptools.packages.find] include = ["engine*"]` so every
subpackage under `engine/` is auto-discovered, and move the
`package-data` declaration into its own table.

Verified by building a wheel and inspecting it: the new wheel contains
`engine.concurrency/`, `engine.opendraft/`, `engine.phases/`,
`engine.utils/api_citations/`, `engine.utils/pdf_engines/`, and the
full `engine/prompts/` tree including the previously-missing
`prompts/01_research/scribe.md`.

Adds tests/test_packaging_subpackages.py with three regression checks:
- pyproject must use packages.find OR list every subpackage explicitly
- prompt files (incl. the exact one from federicodeponte#26) exist on disk
- package-data declares prompts/**/*.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant