Skip to content

Include gnm.shape.data packages in setuptools package list.#21

Merged
copybara-service[bot] merged 1 commit into
google:mainfrom
vraj130:fix-shape-packaging
Jul 22, 2026
Merged

Include gnm.shape.data packages in setuptools package list.#21
copybara-service[bot] merged 1 commit into
google:mainfrom
vraj130:fix-shape-packaging

Conversation

@vraj130

@vraj130 vraj130 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

gnm_base.py, gnm_data_loader.py, and gnm_landmarks.py import
gnm.shape.data.versions.gnm_specs and gnm_catalog as regular Python
modules, but the [tool.setuptools] packages list in pyproject.toml does not
declare gnm.shape.data or gnm.shape.data.versions. The package-data globs
only cover asset files (npz, images, md, h5), so built distributions omit
gnm_specs.py and gnm_catalog.py entirely.

As a result, installing gnm-shape from a built wheel (pip install . without
-e, or a wheel from python -m build) fails at import time:

  ImportError: cannot import name 'gnm_specs' from
  'gnm.shape.data.versions' (unknown location)

CI does not catch this because all workflows install the package in editable
mode (pip install -e), which puts the whole source tree on sys.path.

Fix: declare the two missing packages in the packages list.

Verification: built a wheel before and after this change. Before, the wheel
contains no .py files under gnm/shape/data/ and importing
gnm.shape.gnm_numpy from the installed wheel raises the ImportError above.
After, gnm_specs.py and gnm_catalog.py are included (the .npz model asset
ships correctly in both cases) and GNM.from_local works from the installed
wheel, returning the expected (17821, 3) vertex array.

@bednarikjan bednarikjan added the ready to pull A tag used to indicate that the PR is ready to be pulled for review into the internal codebase. label Jul 21, 2026
@bednarikjan

Copy link
Copy Markdown
Collaborator

@vraj130 Please update your branch to the ToT. We recently made some minor changes to the CI naming which prevents your PR from integrating with our codebase. Alternatively, you can allow "Allow edits from maintainers" on your branch which would allow us to update the branch on your PR on our side, thanks!

gnm_base.py, gnm_data_loader.py and gnm_landmarks.py import
gnm.shape.data.versions.gnm_specs and gnm_catalog as regular Python
modules, but the [tool.setuptools] packages list in pyproject.toml
does not declare gnm.shape.data or gnm.shape.data.versions. The
package-data globs only cover asset files (npz, images, md, h5), so
built distributions omit gnm_specs.py and gnm_catalog.py entirely.

As a result, installing gnm-shape from a built wheel (pip install .
or a wheel from python -m build) fails at import time:

  ImportError: cannot import name 'gnm_specs' from
  'gnm.shape.data.versions' (unknown location)

This is not caught by CI because all workflows install the package
in editable mode (pip install -e), which puts the whole source tree
on sys.path.

Verified by building a wheel before and after this change: before,
the wheel contains no .py files under gnm/shape/data/ and importing
gnm.shape.gnm_numpy from the installed wheel raises the ImportError
above; after, gnm_specs.py and gnm_catalog.py are included (the npz
model asset ships in both cases) and GNM.from_local works from the
installed wheel.
@vraj130
vraj130 force-pushed the fix-shape-packaging branch from e066cda to 9554394 Compare July 21, 2026 21:48
@vraj130

vraj130 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@bednarikjan thanks for flagging it, I've rebased it. Also not sure why it doesn't show you but I've always selected the option which allows for you to edit.

Screenshot 2026-07-21 at 3 15 01 PM

One more thing, I've also rebased #28 in case you wanna merge along this one, so It won't need to rebase again, but if the approval process its too long, I will be happy to rebase it again when you have time to attend!

@copybara-service
copybara-service Bot merged commit ec6c986 into google:main Jul 22, 2026
13 checks passed
@bednarikjan

Copy link
Copy Markdown
Collaborator

Thanks @vraj130, it worked now and the PR is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to pull A tag used to indicate that the PR is ready to be pulled for review into the internal codebase.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants