Skip to content

Fix src-layout package discovery in wheel builds - #986

Merged
lmoresi merged 1 commit into
underworldcode:developmentfrom
ss2098:fix/src-package-discovery
Nov 12, 2026
Merged

lmoresi merged 1 commit into
underworldcode:developmentfrom
ss2098:fix/src-package-discovery

Conversation

@ss2098

@ss2098 ss2098 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes Python package discovery in setup.py for Underworld3's src directory layout.

The change is small, but it resolves an installation issue I encountered while running the regression tests on my local macOS arm64 environment.

Problem

While testing the development branch, I noticed that several tests were failing even though the corresponding implementations were already present in the source code.

For example, the rotated free-slip solver source contained the expected diagnostic fields, but the installed version did not.

I initially rebuilt Underworld3 using ./uw build, but the installed Python modules were still different from the current source.

I traced the problem to package discovery in setup.py.

The original call:

packages=find_packages()

discovered zero packages because the Python source is located under src/underworld3.

Using find_packages(where="src") discovered 18 packages.

The existing setup.cfg already specifies the src directory as the package location, so no additional configuration changes were needed.

Change

Updated the package discovery statement in setup.py to:

packages=find_packages(where="src"),

No solver implementations, numerical methods, dependencies, or tests were modified.

Validation

I tested the change on macOS arm64 with Python 3.12 using the project's Pixi environment.

Before the correction, the installed package had 49 Python files that differed from the source and 15 missing Python files.

After the correction:

  1. Package discovery found 18 packages.
  2. The freshly built wheel contained 145 verified Python modules matching the source.
  3. The standard ./uw build command completed successfully.
  4. The installed versions of the main package, rotated free-slip solver, free-surface solver, expression handling, Stokes solvers, and transcript reporting matched the source.
  5. All 10 import regression tests passed.
  6. The complete test files for rotated free-slip, free-surface configuration, and yield-stress units passed.

The earlier failures in these test files disappeared after installing the corrected package.

I have not rerun the complete serial and MPI test suites after this correction.

Scope

This PR only addresses Python package discovery and installation consistency. It does not change the numerical behavior of Underworld3.

@ss2098
ss2098 requested a review from lmoresi as a code owner November 7, 2026 07:00
@lmoresi
lmoresi merged commit e4076e5 into underworldcode:development Nov 12, 2026
13 of 15 checks passed

lmoresi commented Nov 12, 2026

Copy link
Copy Markdown
Member

Thank you, @ss2098. This is merged to development.

Your diagnosis was right: with the src/ layout, find_packages() at the repository root finds nothing, and that empty list overrides the find: setting in setup.cfg. We had not seen it because the setuptools on our own build machines installs the package anyway, while yours honoured the empty list. That is exactly the kind of difference we cannot find from inside our own environment, so the careful write-up of how you traced it (installed code not matching the source) was very helpful.

Apologies for the week it waited. Your GWB subduction example (#987) is noted; we will review it when you mark it ready.

Underworld development team with AI support from Claude Code


Generated by Claude Code

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.

2 participants