Skip to content

Make marinholab and marinholab.sas namespace packages - #12

Merged
mmmarinho merged 1 commit into
mainfrom
namespace-packages
Oct 1, 2026
Merged

mmmarinho merged 1 commit into
mainfrom
namespace-packages

Conversation

@mmmarinho

Copy link
Copy Markdown
Contributor

marinholab/__init__.py and marinholab/sas/__init__.py made both marinholab and marinholab.sas regular packages. When marinholab-sas-core is installed alongside another distribution that has a marinholab.* package, Python finds the regular package first and hides the other distribution's subpackages:

$ pip install --pre marinholab-sas-core==26.9.13
$ PYTHONPATH=other python -c "import marinholab.other_package"   # other/marinholab/other_package/__init__.py
ModuleNotFoundError: No module named 'marinholab.other_package'

This currently breaks mmmarinho/ur3e_r820: marinholab.ur3e_r820 can't be imported in any environment that has marinholab-sas-core. That includes ghcr.io/marinholab/sas-full:jazzy, whose ROS sas_core package needs marinholab-sas-core. marinholab-solvers-qpoases already leaves its marinholab/ without an __init__.py.

Changes

  • Delete marinholab/__init__.py and marinholab/sas/__init__.py. They held only a docstring. Both directories are now PEP 420 namespace packages.
  • One package list. [tool.setuptools.packages.find] in pyproject.toml is now the only list, with namespaces = true (the default, now explicit, with a comment explaining why). The explicit packages= list in setup.py is removed; it also left out marinholab.sas.core.modeling.
  • CI smoke test: it now imports marinholab.sas.core next to a marinholab.other_package on PYTHONPATH, and asserts that neither marinholab nor marinholab.sas has a __file__.

Testing

  • Wheel contents: python -m build --wheel (macOS arm64, Python 3.14) gives the same files as before, minus the two __init__.py.
  • New CI check: run locally, it passes on this wheel and fails on the published 26.9.13 with the error above.
  • Side by side with other marinholab.* packages: I installed this wheel with marinholab-solvers-qpoases 26.4.0.64 and dqrobotics 26.4.0a7, plus marinholab.ur3e_r820 from source. marinholab.sas.core, marinholab.solvers.qpoases and marinholab.ur3e_r820 import together. curve_revolution_vfi's tests that use SerialManipulatorSimulatorFriendly pass (27), and ur3e_r820's Python tests pass (33).
  • Ubuntu: cd docker && docker compose run --rm --build marinholab_sas_core passes all its checks: API, finite-difference Jacobian, examples, no linked dqrobotics shared library, installed files.
  • pyright: standard mode reports 0 errors.

🤖 Generated with Claude Code

marinholab/__init__.py and marinholab/sas/__init__.py made both regular
packages. Installed next to another distribution with a marinholab.*
package, the regular package wins and hides the other: with
marinholab-sas-core installed, `import marinholab.ur3e_r820` fails
(MarinhoLab/ur3e_r820), and so would marinholab.solvers if
marinholab-solvers-qpoases were installed in a directory searched later.
marinholab-solvers-qpoases already leaves its marinholab/ without an
__init__.py.

- Delete both __init__.py; they held only a docstring.
- pyproject: packages.find with namespaces = true (the default, now
  explicit and explained) is the one package list; setup.py's explicit
  `packages=` list, which also missed marinholab.sas.core.modeling, goes.
- CI smoke test: import marinholab.sas.core next to a marinholab.other_package
  on PYTHONPATH and assert that neither marinholab nor marinholab.sas has a
  __file__. It fails on the published 26.9.13 and passes here.

The wheel holds the same files as before minus the two __init__.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@mmmarinho mmmarinho left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍

@mmmarinho
mmmarinho merged commit ca0ce74 into main Oct 1, 2026
25 checks passed
@mmmarinho
mmmarinho deleted the namespace-packages branch October 1, 2026 13:04
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