Releasing¶
Names¶
| What | Name |
|---|---|
| PyPI distribution | fa-quant |
| Import package | financial_agent (declared as PEP 794 import-names) |
| Command | fa-quant |
financial-agent on PyPI is an unrelated project that also ships a
financial_agent module. Never document pip install financial-agent.
Cutting a release¶
- The release PR bumps
[project] versioninpyproject.toml, runsuv lock, moves theCHANGELOG.md[Unreleased]entries under## [X.Y.Z] - DATE, and updates the link references. The version line in safety.md changes with it. - After the squash merge, tag the merge commit and push the tag:
git tag -a vX.Y.Z -m vX.Y.Z <merge-sha>
git push origin vX.Y.Z
- The Release workflow reruns the full
checks. It confirms the tag matches the version and that a CHANGELOG section
exists. It builds the sdist and builds the wheel from that sdist, runs
twine check --strict, and smoke-tests the installed wheel. Then it uploads to PyPI (once enabled) and creates the GitHub release with the CHANGELOG notes. If the PyPI upload fails, no GitHub release is created. Rerun the failed jobs after fixing the cause.
The sdist contains only what building the wheel needs: src/financial_agent,
the two harness helpers the wheel copies from agents/, the README, LICENSE and
CHANGELOG. The PyPI description is the README with the Mermaid diagram removed
and repository links pointed at the release tag.
financial_agent.trading ships in the wheel but is not part of the public API.
It is historical research code kept for the saved notebooks, and names in it can
change or be removed in any release.
PyPI trusted publishing (one-time owner setup)¶
The workflow publishes with PyPI trusted publishing (OIDC), so no API token is stored. Configure it once:
- On TestPyPI and on
PyPI, add a pending publisher:
project
fa-quant, ownerBichengWang, repositoryfinancial-agent, workflowrelease.yml, environmenttestpypiandpypirespectively. - Optional: in GitHub Settings → Environments, give
pypia required reviewer, so every upload waits for approval. - Rehearse: Actions → Release → Run workflow on
main. Thetestpypijob uploads the current version; a rerun of a version already uploaded is skipped. Check the project page, then install it:
pip install --index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ fa-quant
fa-quant demo --sessions 3 --state-dir /tmp/fa-quant-testpypi
- Enable: in Settings → Secrets and variables → Actions → Variables, set
PYPI_PUBLISHtotrue. From then on everyv*tag uploads to PyPI.
PyPI never accepts the same version twice, even after deletion. Releases up to v1.2.0 were tagged before publishing was enabled and are not on PyPI; v1.2.1 was the first upload.