Skip to content

Add a PyPI release workflow and a tested quick start - #8

Draft
juaristi22 wants to merge 1 commit into
mainfrom
pypi-release
Draft

juaristi22 wants to merge 1 commit into
mainfrom
pypi-release

Conversation

@juaristi22

Copy link
Copy Markdown

Summary

popdgp is not on PyPI, so nothing can depend on a released version of it. This adds what a first release needs: a release workflow, a check that the built wheel works, and install instructions with a tested example. The package's code and version (0.1.0) are unchanged.

The first consumer is the imputation paper, which is to depend on a pinned popdgp in place of its own copy of the harness (item 3 of PolicyEngine/imputation-paper#1).

What changes

  • .github/workflows/release.yml. When a GitHub Release is published, the workflow checks that the tag is the package version (0.1.0 or v0.1.0), runs the tests, builds, runs the quick start against the built wheel, and uploads to PyPI. Run by hand, it builds and checks without publishing.
  • .github/workflows/ci.yml. The build job also runs the quick start against the built wheel, so a distribution that does not import with its declared dependencies fails before a release.
  • README.md. Install and quick-start sections. The quick start is examples/quickstart.py.
  • tests/test_packaging.py. The version string matches the installed metadata, the README shows the example verbatim, and the example runs.
  • CONTRIBUTING.md. A Releasing section with the steps and the one-time PyPI setup.

To publish 0.1.0 after this merges

  1. An owner of the PyPI account adds a pending trusted publisher: owner PolicyEngine, repository popdgp, workflow release.yml, environment pypi. This also reserves the name, which is free today.
  2. Publish a GitHub Release tagged 0.1.0. The workflow uploads.

For the maintainer to decide

  • Trusted publishing or the org token. The workflow uses PyPI trusted publishing, with no stored token, as policyengine.py and microimpute do. The org secret PYPI is also visible to this repository; using it would remove step 1 above. Say if you prefer it.
  • When a release happens. Here a release is a deliberate act: publishing a GitHub Release. The org's other packages bump the version and publish on every merge to main, from towncrier fragments. This repository has no changelog, and I did not add that machinery.
  • The pypi environment. GitHub creates it on first use without protection rules. Limiting it to main needs a repository admin.

Not in this PR

Checks

  • uv run pytest: 32 passed, 0 skipped. uv run ruff check . and uv run ruff format --check . pass.
  • uv build and uvx twine check dist/* pass. The wheel holds the four package modules and the licence.
  • The wheel imports and runs the quick start in a clean environment.
  • A dry-run install of the wheel into the imputation paper's environment would add popdgp 0.1.0 and change no other package: the two projects have the same dependency floors.
  • The release workflow has not run. It can only run on GitHub, and its publish step needs the PyPI setup above.

🤖 Generated with Claude Code

popdgp is not on PyPI yet, so nothing can depend on a released version.

- .github/workflows/release.yml: on a published GitHub Release, check
  that the tag is the package version, run the tests, build, run the
  quick start against the built wheel, and upload to PyPI by trusted
  publishing (pypi environment, no stored token). Run by hand, it
  builds and checks without publishing.
- CI's build job also runs the quick start against the built wheel, so
  a distribution that does not import with its declared dependencies
  fails before a release.
- README: install and quick-start sections. The quick start is
  examples/quickstart.py.
- tests/test_packaging.py: the version string matches the installed
  metadata, the README shows the example verbatim, and the example runs.
- CONTRIBUTING.md: how to release, and the one-time PyPI setup.

No change to the package's code or version (0.1.0).

Co-Authored-By: Claude Fable 5.2 <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.

1 participant