Repository navigation
feat: package as python_vpp for PyPI - #65
Conversation
- move the code to src/python_vpp/ and the model coefficient data to src/python_vpp/dat/, loaded relative to the package (DATA_DIR) so the VPP runs from any working directory - ship the YD-41 righting arm curve as the fallback when no GZ is given and there is no righting_moment.json in the working directory - expose VPP, Yacht, appendages and sails at the package top level, with __version__ from the installed metadata - relative imports inside the package; drop the sys.path hacks - pyproject: wheel package path, project URLs, keywords, slim sdist - README: pip install, usage example and release steps Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JN4y2NWa8kFMBZ5FV92jkj
|
The release takes two steps:
Once it's out, you can check it with pip install python-vpp in a fresh environment. |
There was a problem hiding this comment.
🔵 Needs a closer look
It is a release-critical repackaging whose core risk—whether the built wheel actually bundles the dat/ coefficient data—cannot be confirmed without a human build-and-inspect step.
No open issues 🎉
What changed in this PR
This PR restructures the project so it can be published to PyPI as the python_vpp distribution. The source moves from src/ into a proper package directory src/python_vpp/, model coefficient data moves to src/python_vpp/dat/ and is loaded relative to the package (via a new DATA_DIR) so the VPP runs from any working directory, and the previous sys.path hacks plus absolute src.* imports are replaced with package-relative imports. The package top level now exposes the key classes and a metadata-derived __version__, and the YD-41 righting-arm curve ships as a fallback when no GZ is provided and no righting_moment.json exists in the working directory.
Changes:
- Introduced
src/python_vpp/package with__init__.pyexports (VPP,Yacht, appendages, sails) and__version__; converted all intra-package imports to relative imports. - Added
DATA_DIRand loaded all.dat/.csv/.jsoncoefficient data package-relative; bundled packaged data (including a fallbackrighting_moment.json). - Updated packaging (
pyproject.tomlwheel/sdist, URLs, keywords),Procfile, docs, README (install/usage/release), and all test/script/demo imports to the new package path.
| File | Description |
|---|---|
| src/python_vpp/__init__.py | New package init exposing public API and resolving __version__ from installed metadata |
| src/python_vpp/UtilsMod.py | Adds DATA_DIR and loads .dat files package-relative |
| src/python_vpp/SailMod.py | Loads sail coefficient data via DATA_DIR; drops local os import |
| src/python_vpp/HydroMod.py | Loads ORC drag surfaces via DATA_DIR |
| src/python_vpp/YachtMod.py | Righting-moment load falls back to packaged YD-41 curve; docstring updated |
| src/python_vpp/AeroMod.py / VPPMod.py / api.py | Switched to package-relative imports; removed sys.path hack in api |
| src/python_vpp/dat/** | Model coefficient/data files relocated into the package |
| src/__init__.py | Removed obsolete namespace init |
| pyproject.toml | Wheel package path, sdist include, project URLs, keywords, classifiers |
| Procfile | gunicorn now --chdir src and loads python_vpp.api:app |
| README.md | Adds install/usage/release docs for the packaged workflow |
| sphinx/conf.py, sphinx/index.rst | Point autodoc at ../src and python_vpp.VPPMod |
| runVPP.py, scripts/Resistance.py, benchmark/benchmark.py, demos/pages/1_VPP_⛵.py | Updated imports to the new package path |
| tests/*.py | Updated imports from src.* to python_vpp.* |
Review effort: Balanced
Resolve the import conflicts in src/python_vpp/VPPMod.py and tests/test_utils.py to the package imports, and document write_csv in the README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JN4y2NWa8kFMBZ5FV92jkj
Claude-Session: https://claude.ai/code/session_01JN4y2NWa8kFMBZ5FV92jkj