Manual releases of think-dsp via GitHub Trusted Publishing.
You choose when to release by running the workflow in the Actions UI — nothing
publishes on push or tag.
The PyPI distribution name is think-dsp. The import name remains thinkdsp
(import thinkdsp).
In the repo: Settings → Environments → New environment → name it exactly pypi.
Optional but useful: require reviewers on that environment so “Run workflow” still needs an approval before upload.
Until the first successful publish, the project does not exist yet. Create a pending publisher:
- Sign in at https://pypi.org (account that should own
think-dsp) - Account settings → Publishing (or https://pypi.org/manage/account/publishing/)
- Under Add a new pending publisher → GitHub, set:
- PyPI project name:
think-dsp - Owner:
AllenDowney - Repository name:
ThinkDSP - Workflow name:
publish.yml - Environment name:
pypi
- PyPI project name:
- Save
The pending publisher creates the PyPI project on first successful workflow run. It does not reserve the name until that run succeeds.
After the first release, the pending publisher becomes a normal publisher on the project; you can manage it under the project’s Publishing settings.
.github/workflows/publish.yml is triggered only by workflow_dispatch
(Actions UI → publish → Run workflow).
Edit pyproject.toml:
[tool.poetry]
version = "0.2.0" # bump thisCommit and push to master (the branch you run the workflow from).
- https://github.com/AllenDowney/ThinkDSP/actions/workflows/publish.yml
- Run workflow
- Choose branch
master - Confirm; if the
pypienvironment has required reviewers, approve the deploy
- https://pypi.org/project/think-dsp/
pip install think-dspimport thinkdsp
Tags are documentation only with this setup (they do not publish):
git tag v0.2.0
git push origin v0.2.0Still useful before clicking Run workflow:
conda activate ThinkDSP
rm -rf dist/ build/
python -m build
python -m twine check dist/*Do not need twine upload once Trusted Publishing works.
If Trusted Publishing is unavailable, use a user-scoped API token for the first upload (project-scoped tokens cannot create a new project), then a project-scoped token afterward. See https://pypi.org/manage/account/token/
python -m twine upload dist/*- Package Name (PyPI):
think-dsp - Import Name:
thinkdsp - Current Version: check
pyproject.toml - Publish trigger:
workflow_dispatchonly - Trusted publisher workflow:
publish.yml - GitHub environment:
pypi