Skip to content

Include subpackages and runtime data in built wheels - #188

Open
Asterisk-Hunter wants to merge 3 commits into
theochem:mainfrom
Asterisk-Hunter:fix/wheel-subpackages
Open

Asterisk-Hunter wants to merge 3 commits into
theochem:mainfrom
Asterisk-Hunter:fix/wheel-subpackages

Conversation

@Asterisk-Hunter

@Asterisk-Hunter Asterisk-Hunter commented Oct 5, 2026 •

Copy link
Copy Markdown

A clean wheel currently includes only the top-level moha modules, so importing the installed package outside the checkout raises ModuleNotFoundError: No module named 'moha.rauk'.

Discover the moha subpackages and include their JSON/TOML runtime resources. Add a CI smoke check that installs the built wheel into an isolated target, imports it outside the checkout, and verifies the six runtime data files.

Validation:

  • A clean source archive of e27c5b9 produced a wheel without moha.rauk and failed the isolated import; the fixed wheel imports successfully and contains all six runtime resources.
  • python -m pytest -q moha/test: 9 passed, with SparseEfficiencyWarnings.
  • git diff --check and pycodestyle moha/: passed.
  • pydocstyle moha/: existing D205/D207/D400 errors in the HamHeisenberg docstring. The pre-commit bot removed its trailing whitespace; this PR changes no Python runtime logic.

@Asterisk-Hunter

Copy link
Copy Markdown
Author

Hi @RichRick1 and @giovanni-br, I opened this after reproducing the missing package files from a clean wheel install. The isolated wheel smoke test and package tests are passing. Could you let me know whether this fix is in the right direction or needs any changes? I am keen to keep contributing to ModelHamiltonian and would appreciate a pointer to the next useful issue after this one.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The packaging changes address the reported failure, the smoke check covers imports and required resources, and no blocking issues remain.

No open issues 🎉

What changed in this PR

Fixes wheel packaging so installed moha includes its subpackages and runtime resources, resolving imports that fail outside the checkout.

Changes:

  • Enables subpackage discovery and includes JSON/TOML runtime data.
  • Adds a CI smoke check that installs the built wheel into an isolated target, imports it outside the checkout, and checks all six resource files.
  • Removes trailing whitespace from a docstring without changing runtime logic.
File Description
pyproject.toml Configures subpackage discovery and runtime resource inclusion.
moha/​hamiltonians.py Removes trailing whitespace from the HamHeisenberg docstring.
.github/​workflows/​main.yml Adds the installed-wheel import and resource smoke check.

Review effort: Balanced

PaulWAyers
PaulWAyers previously approved these changes Oct 22, 2026

@PaulWAyers PaulWAyers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks fine to me.

@PaulWAyers
PaulWAyers dismissed their stale review October 22, 2026 20:52

Not approved since test fails.

@Asterisk-Hunter

Asterisk-Hunter commented Oct 23, 2026 •

Copy link
Copy Markdown
Author

I traced the failed check to actions/setup-python being unable to find Python 3.10.12 on the Ubuntu 26.04 runner. I pinned the workflow to Ubuntu 24.04 in commit b6ce270. The new PR run is marked action_required and has no jobs, so it appears to need maintainer approval before it can run. Could someone approve the run? The package tests pass locally (9 passed).

This branch has not been deployed

No deployments
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.

3 participants