Skip to content

feat: package as python_vpp for PyPI - #65

Merged
marinlauber merged 2 commits into
masterfrom
pr/packaging
Oct 20, 2026
Merged

marinlauber merged 2 commits into
masterfrom
pr/packaging

Conversation

@marinlauber

Copy link
Copy Markdown
Owner
  • 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

Claude-Session: https://claude.ai/code/session_01JN4y2NWa8kFMBZ5FV92jkj

- 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
Copilot AI balanced review requested due to automatic review settings October 17, 2026 09:44
@marinlauber

Copy link
Copy Markdown
Owner Author

The release takes two steps:

  1. On PyPI: go to Your account → Publishing → Add a pending publisher. Enter project python-vpp, owner marinlauber, repo Python-VPP, workflow python-publish.yml, and leave the environment empty.
  2. On GitHub: create a release with the tag v1.0.0 on master. The workflow then builds the package and uploads it to PyPI.

Once it's out, you can check it with pip install python-vpp in a fresh environment.

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.

🔵 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__.py exports (VPP, Yacht, appendages, sails) and __version__; converted all intra-package imports to relative imports.
  • Added DATA_DIR and loaded all .dat/.csv/.json coefficient data package-relative; bundled packaged data (including a fallback righting_moment.json).
  • Updated packaging (pyproject.toml wheel/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
@marinlauber
marinlauber merged commit 141ea66 into master Oct 20, 2026
3 checks passed
@marinlauber
marinlauber deleted the pr/packaging branch October 20, 2026 13:26
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