Skip to content

Publish pysvzerod wheels to PyPI - #248

Merged
ncdorn merged 32 commits into
SimVascular:masterfrom
ncdorn:codex/pypi-publishing
Oct 9, 2026
Merged

ncdorn merged 32 commits into
SimVascular:masterfrom
ncdorn:codex/pypi-publishing

Conversation

@ncdorn

@ncdorn ncdorn commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Current situation

Closes #247. Also addresses #44; the package keeps its existing name, pysvzerod.

Right now pysvzerod can only be installed from this repository (pip install git+https://github.com/simvascular/svZeroDSolver.git), which compiles the C++ solver on the user's machine. There is no workflow that builds wheels or publishes to PyPI.

Release Notes

  • Once released, pip install pysvzerod installs a prebuilt wheel. Wheels cover CPython 3.9–3.15 on Linux x86_64 (manylinux and musllinux), Windows AMD64, and macOS Intel and Apple Silicon. Other platforms fall back to the source distribution.
  • New workflow .github/workflows/pypi.yml:
    • Packaging PRs and manual runs: builds the source distribution and every wheel, and tests each wheel by running tests/test_solver.py and the svzerodsolver command.
    • Pushing a v* tag: checks the tag against the pyproject.toml version, then publishes to PyPI through trusted publishing. No API tokens are stored in the repo.
  • For maintainers: the package version is now 3.1, following the repository's release tags (Karthik's JOSS Release is tagged v3.0). From now on every new v* tag must equal v plus the pyproject.toml version, including a tag created for a GitHub release. Otherwise the workflow fails before it builds anything.
  • Build changes:
    • CMake asks for Python's Development.Module instead of Development, because the manylinux images have no libpython.
    • pybind11 v3.1.0 and a pinned pybind11_json commit are downloaded as SHA256-checked archives, instead of tracking master.
    • setup.py passes the building interpreter to CMake.
    • pyproject.toml adds project URLs and BSD-3-Clause license metadata, and requires setuptools >= 77.
    • New MANIFEST.in defines the source distribution's contents.

Documentation

  • New docs/PYPI_RELEASE.md: first-time setup (the pypi GitHub environment and the trusted publisher in the SimVascular PyPI organization), testing the CI wheels on other machines before a release, and the steps for each release.
  • README: a short "Python package" section.

Testing

  • This PR changes packaging files, so the new workflow builds and tests every wheel on it. The publish jobs are skipped on pull requests.
  • Checked locally on macOS:
    • CMake configures and the module builds with the archive downloads.
    • tests/test_solver.py passes against that build: 38 passed, 2 known failures marked as expected.
    • cibuildwheel 4.3.0 lists the intended build identifiers.
    • The source distribution builds and passes twine check.
  • Not yet exercised: the PyPI upload, which needs the setup below.

Setup before the first release

  1. Create a pypi environment in this repository. Limit it to v* tags and add a required reviewer, since a PyPI upload can't be undone.
  2. On PyPI, create pysvzerod in the SimVascular organization and add a GitHub trusted publisher: owner SimVascular, repository svZeroDSolver, workflow pypi.yml, environment pypi.
  3. After merging, run the workflow manually on master and try its wheels on a couple of machines (see docs/PYPI_RELEASE.md), then create the v3.1 release.

Code of Conduct & Contributing Guidelines

🤖 Generated with Claude Code

ncdorn and others added 5 commits October 7, 2026 13:07
Request only Python's Development.Module so CMake configures in
manylinux and musllinux images, which ship no libpython. Set up MSVC
and build only AMD64 on Windows. Build every supported CPython except
free-threaded, and test each wheel by running the solver test cases
and the svzerodsolver command.

Check the release tag before any build starts, publish to PyPI only on
tag pushes, skip files already on TestPyPI, and give build jobs a
read-only token. Fetch pybind11 and pybind11_json as hashed archives,
add SPDX license metadata, and update the README and release notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Run the sdist and wheel builds and tests on pull requests that change
packaging files, so they are checked before merge. The publish jobs stay
limited to manual runs (TestPyPI) and tag pushes (PyPI).

Set the package version to 3.1 so it follows the repository's release
tags, which reached v3.0. Document the SimVascular PyPI organization
setup and the rule that every v* tag must match the package version.

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

@claude claude Bot 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.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

ncdorn and others added 2 commits October 7, 2026 16:13
Pull request and manual runs already build and test every wheel, and
their artifacts can be installed directly on other machines. A
TestPyPI upload would only rehearse a separate project and publisher,
not the production setup.

Document testing the CI wheels before a release, yanking a broken
release, and pre-releases for large packaging changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zasexton
zasexton self-requested a review October 8, 2026 16:37
@zasexton

zasexton commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

@ncdorn looking through this branch now and will give review over the next few hours

@zasexton

zasexton commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

I have some changes and github plumbing that I will be adding via a PR request against your branch @ncdorn so please review this sub-PR and if you agree with it then I think we can go ahead and wrap this up

Add manual versioned PyPI publishing and GitHub releases

@zasexton zasexton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good for testing on the testpypi server so let's go ahead and merge to see if we can do this

@ncdorn
ncdorn merged commit 0ce331f into SimVascular:master Oct 9, 2026
21 checks passed
ncdorn added a commit to ncdorn/svZeroDSolver that referenced this pull request Oct 14, 2026
Brings in the PyPI release work (SimVascular#248), the pysvzerod -> svzerod package
rename (SimVascular#249), and the 3.2 version bump.

Only README.md conflicted: upstream added a "Python package" install
section and this branch added the "Impedance BC" section, both appended
after the documentation links. Kept both, with the install section first.

The rename applied cleanly to this branch's files; no references to the
old module name remain.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

Create a PyPi package for the solver

2 participants