Releasing¶
AgentLens is published to PyPI by the workflow
.github/workflows/release.yml
when a version tag vX.Y.Z is pushed. It uses trusted publishing: PyPI trusts this workflow
through OpenID Connect, so there is no API token to create, store or rotate.
flowchart LR
tag["git push origin v0.1.0"] --> build["build<br/>uv build · twine check<br/>tag == __version__<br/>smoke test of the wheel"]
build --> publish["publish<br/>environment pypi<br/>id-token: write"]
publish --> release["github-release<br/>notes from CHANGELOG.md<br/>sdist + wheel attached"]
The distribution is agentlens-toolkit
https://pypi.org/project/agentlens/ belongs to an unrelated project, and a trusted publisher
can only be added to a project you own (or as a pending publisher for a name that does not
exist yet). AgentLens is therefore published as agentlens-toolkit (maintainer's decision,
2026-11-14); the import name agentlens and the agentlens command are unchanged.
One-time setup¶
-
PyPI trusted publisher. Sign in to PyPI → Your account → Publishing → Add a new pending publisher (for a project that does not exist yet; for an existing project you own: project → Settings → Publishing), GitHub tab:
Field Value PyPI Project Name agentlens-toolkitOwner ggbifulcoRepository name agentlensWorkflow name release.ymlEnvironment name pypi -
GitHub environment. Repository → Settings → Environments → New environment →
pypi. Recommended: Required reviewers (yourself), so every upload waits for a click, and Deployment branches and tags → Selected → tag rulev*. -
Optional TestPyPI dry run. Same as step 1 on https://test.pypi.org with environment name
testpypi, and atestpypienvironment on GitHub. Then Actions → Release → Run workflow with testpypi ticked builds, checks and uploads to TestPyPI without tagging (an already uploaded version is skipped: TestPyPI, like PyPI, never accepts the same version twice).
Without a tag, Run workflow (testpypi unticked) runs only the build job: a release rehearsal that builds, checks the metadata and smoke-tests the wheel.
Release steps¶
- Version. Set
__version__insrc/agentlens/__init__.py(the single source of the version:pyproject.tomlreads it through hatchling) following Semantic Versioning;0.xminors may break the API. - Changelog. In
CHANGELOG.md, move the[Unreleased]entries under a new## [X.Y.Z] - YYYY-MM-DDheading (the release date), leave## [Unreleased]empty above it, and update the compare links at the bottom. The section body becomes the GitHub release notes. -
Check locally.
-
Merge these changes to
mainthrough a pull request (CI green). -
Tag and push from the merged
main: -
Approve the
pypideployment in the workflow run (if reviewers are required). The workflow publishes the sdist and wheel, then creates the GitHub release AgentLens vX.Y.Z with the CHANGELOG section as notes and the distributions attached. A draft release prepared for the same tag is replaced. - Verify:
pip install agentlens-toolkit==X.Y.Zin a fresh environment,agentlens --version.
If the build job fails (tag and version differ, missing CHANGELOG section, broken wheel),
nothing has been published: delete the tag (git push --delete origin vX.Y.Z,
git tag -d vX.Y.Z), fix, and tag again. Once a version is on PyPI it can never be uploaded
again, even after deleting it there: fix forward with X.Y.Z+1.