Skip to content

Release to PyPI via Trusted Publishing (v1.2.1) - #8

Closed
rasidi3112 wants to merge 1 commit into
mainfrom
chore/pypi-release
Closed

rasidi3112 wants to merge 1 commit into
mainfrom
chore/pypi-release

Conversation

@rasidi3112

Copy link
Copy Markdown
Owner

Summary

Prepares quantumlab for PyPI. The name is currently free on both PyPI and TestPyPI.

Workflow publish.yml

  • build job:
    • checks that the release tag matches the package version;
    • rewrites README links for PyPI;
    • runs python -m build and twine check --strict;
    • smoke-tests the wheel in a clean virtual environment.
  • TestPyPI: running the workflow manually ("Run workflow") uploads to TestPyPI only.
  • PyPI: publishing a GitHub release uploads to TestPyPI first, then to PyPI.
  • Trusted Publishing (OIDC): no API tokens or passwords are stored in the repository or its secrets.

README on PyPI

PyPI cannot resolve repository-relative paths, so at build time .github/scripts/pypi_readme.py rewrites them to URLs pinned to the release (images to raw.githubusercontent.com, other files to GitHub). The README in the repository itself is unchanged.

Metadata

  • Development Status changes from 5 (Production/Stable) to 4 (Beta).
  • requires-python changes from >=3.9 to >=3.10, matching the range tested in CI (3.9 is end-of-life).
  • Authors, keywords and project URLs (docs, issues, changelog) are added, with no email addresses.
  • Version is 1.2.1 in pyproject.toml, the package and CITATION.cff.

One-time setup on PyPI (repository owner)

Add a pending trusted publisher on pypi.org (environment pypi) and on test.pypi.org (environment testpypi). Both use owner rasidi3112, repository quantum-simulation and workflow publish.yml.

Test plan

  • Clean build: twine check --strict PASSED for wheel (66 KB) and sdist (77 KB)
  • Wheel installed in an empty venv: imports from site-packages; oscillator spectrum exact; norm 1.0
  • Metadata: Beta, Requires-Python >=3.10, MIT, no author email, 5 project URLs
  • PyPI README: 34 absolute image URLs, 0 relative paths; all 41 rewritten URLs return HTTP 200
  • pytest: 118 passed, 12 skipped (CUDA-only)
  • CI on this PR
  • Manual TestPyPI run after merge

- publish.yml: build, twine check --strict and a clean-venv smoke test;
  a manual run uploads to TestPyPI; publishing a GitHub release uploads
  to TestPyPI and then PyPI; OIDC trusted publishing, no stored tokens;
  the release tag must match the package version
- .github/scripts/pypi_readme.py: rewrites relative README links to URLs
  pinned to the release so images render on PyPI
- metadata: Development Status 4 - Beta, requires-python >= 3.10 (the
  tested range; 3.9 is end-of-life), authors, keywords, project URLs,
  Python 3.14 classifier
- version 1.2.1 in pyproject, package and CITATION.cff
@rasidi3112

Copy link
Copy Markdown
Owner Author

Closing for now: publishing to PyPI is not planned at the moment. The branch can be restored from this pull request if needed.

@rasidi3112 rasidi3112 closed this Oct 24, 2026
@rasidi3112
rasidi3112 deleted the chore/pypi-release branch October 24, 2026 08:22
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