Build identity (--version) and a manual release workflow - #112
Merged
Conversation
Prerequisites for running against live funds. Verified state before this:
NO CI at all, no git tags, version never moved off 0.1.0, no --version --
"run it live" meant running whatever happened to be checked out.
keel --version reports version + commit + WORKING-TREE STATE. The last
part is the point: "0.1.0 (abc123, DIRTY)" and "0.1.0 (abc123)" are
materially different claims, and the first corresponds to no commit at
all. Non-reproducible builds print a loud warning against live use.
Two sources: keel/_build_info.py stamped by the release workflow (so an
INSTALLED artifact identifies itself with no git and no repo present),
else git. A STALE stamp in a modified checkout would otherwise claim
[release] and hide a dirty tree -- the exact misreport this exists to
prevent -- so when git disagrees with the stamp, git wins.
Workflows: ci.yml (tests+ruff on push/PR, plus a --version smoke) and
release.yml (workflow_dispatch ONLY -- nothing that moves money ships on
a merge). The release job refuses to bump the version itself: that is a
human decision in a reviewed PR, so CI never writes to main. It also
refuses a non-semver input, a mismatch with pyproject, or an existing tag.
TWO REAL PROBLEMS FOUND BY TESTING THE RELEASE PATH LOCALLY RATHER THAN
TRUSTING THE YAML:
1. uv build alone produces an UNINSTALLABLE wheel -- keel depends on
workspace members (keel-core, keel-broker-*) published nowhere. Fixed
with --all-packages plus --find-links.
2. THE DISTRIBUTION NAME "keel" IS TAKEN ON PyPI by an unrelated project
("Kill proccesses effectively and easily"). pip preferred it over our
local wheel and silently installed a STRANGER'S PACKAGE. For a tool
that places orders with a live API key that is a supply-chain hazard,
not a cosmetic clash. Distribution renamed to keel-trader; the import
package and the CLI command both stay keel. Release notes instruct
installing BY PATH and warn against installing by name.
Verified end to end locally: stamp -> uv build --all-packages -> install
into a clean venv by path -> keel --version from outside any git repo
reports "keel 0.1.0 (<sha>) [release]", no DIRTY, exit 0.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites for running against live funds. Verified state before this: no CI at all, no tags,
versionnever moved off0.1.0, no--version. "Run it live" meant running whatever happened to be checked out.keel --versionReports version + commit + working-tree state. That last part is the point:
Two sources:
keel/_build_info.pystamped by the release workflow (so an installed artifact identifies itself with no git and no repo present), else git.[release]and hide a dirty tree — precisely the misreport this exists to prevent. When git disagrees with the stamp, git wins. There is a test for it.Workflows
ci.yml— tests + ruff on push/PR, pluskeel --versionas an import-time smoke. The release gate is only worth something ifmaindoes not drift red between releases.release.yml—workflow_dispatchonly. Nothing that moves money ships on a merge.The release job refuses to bump the version itself — that is a human decision in a reviewed PR, so CI never writes to
main. It also refuses a non-semver input, a mismatch withpyproject.toml, or an existing tag.1.
uv buildalone produces an uninstallable wheel.keeldepends on workspace members (keel-core,keel-broker-*) published nowhere. Fixed with--all-packagesplus--find-links.2. ⛔ The distribution name
keelis taken on PyPI — by an unrelated project, "Kill proccesses effectively and easily". pip preferred it over our local wheel and silently installed a stranger's package. For a tool that places orders with a live API key that is a supply-chain hazard, not a cosmetic clash.Distribution renamed to
keel-trader; the import package and CLI command both staykeel, so nothing changes day to day. Release notes instruct installing by path and warn against installing by name.Verified end to end, locally
stamp →
uv build --all-packages→ install into a clean venv by path →keel --versionfrom outside any git repo →keel 0.1.0 (c11baba726af) [release], noDIRTY, exit 0.Verification
1255 tests pass (up from 1241), ruff clean.
🤖 Generated with Claude Code