Repository navigation
build: prepare the 0.2.0 release to pypi - #27
Merged
Merged
Conversation
pyproject.toml, kindkit.__version__ and the lockfile's own entry all move to 0.2.0, the version the first PyPI release will carry. Signed-off-by: Cameron Brooks <95648474+CameronBrooks11@users.noreply.github.com>
A v* tag runs the same gates check.yml runs on a pull request, plus the reusable workflow on the toy tree, then builds the sdist and wheel. The build refuses a tag that disagrees with the built version, a wheel carrying anything outside kindkit/ and its dist-info, and a wheel whose __version__ disagrees with its metadata, that imports a non-stdlib module, or whose runner cannot both pass the toy kind and fail its negative control. Only then does the publish job, in the pypi environment, upload through PyPI's trusted publisher. workflow_dispatch is a dry run: publish is skipped off a tag. The push trigger is tags only, so no job here produces a required check on a pull request head. Signed-off-by: Cameron Brooks <95648474+CameronBrooks11@users.noreply.github.com>
The status line said not on PyPI. It now names the package, the install command and the release that first carries the report and gate-report contract the reusable workflow needs. Signed-off-by: Cameron Brooks <95648474+CameronBrooks11@users.noreply.github.com>
A workflow_dispatch run against a tag ref sets github.ref to refs/tags/v*, which the pypi environment admits, so a guard on the ref alone let a dispatch publish. The publish job now also requires github.event_name == 'push', which makes a dispatch a dry run on any ref. Signed-off-by: Cameron Brooks <95648474+CameronBrooks11@users.noreply.github.com>
tools/validate_case_tree.py and tools/mutation_gate.py both read case-tree/expect.schema.json, and the sdist shipped tools/ without it: from an unpacked sdist the validator exited 2, unable to read the schema. The convention, its schema and their CC0 LICENSE now ship. Signed-off-by: Cameron Brooks <95648474+CameronBrooks11@users.noreply.github.com>
The build job unpacks the built sdist into a temporary directory and runs tools/validate_case_tree.py from it, so an include list that drops a file the shipped tools read fails the release instead of the person who unpacks it. With /case-tree removed from the include the step exits 2, unable to read the schema. Signed-off-by: Cameron Brooks <95648474+CameronBrooks11@users.noreply.github.com>
The sentence naming 0.2.0 as the first release with the report keys ran to 104 columns; it now wraps like the rest of the paragraph. Signed-off-by: Cameron Brooks <95648474+CameronBrooks11@users.noreply.github.com>
tests/test_tooling.py checks that the ruff hook in .pre-commit-config.yaml runs the ruff uv.lock resolves, and the sdist shipped the test without either file, so it failed from an unpacked sdist with FileNotFoundError. Both files only name public package and hook sources. From the unpacked sdist the full suite now passes. Signed-off-by: Cameron Brooks <95648474+CameronBrooks11@users.noreply.github.com>
The sdist step now runs the shipped suite with uv run --exact --locked from the unpacked sdist before the validator, so an include list that drops a file the tests read fails the release. Removing /case-tree, /uv.lock or /.pre-commit-config.yaml from the include each turns the step red. Signed-off-by: Cameron Brooks <95648474+CameronBrooks11@users.noreply.github.com>
PYTHONPYCACHEPREFIX mirrors the source's absolute path, and a recursive `**` glob skips dot-directories, so the precondition assert failed for anyone whose temporary directory sits under one, such as ~/.cache. Match hidden directories too. The suite now ships in the sdist, where that is likelier. Signed-off-by: Cameron Brooks <95648474+CameronBrooks11@users.noreply.github.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.
Prepares kindkit's first PyPI release, 0.2.0. Nothing is tagged or published by this PR: publication happens only when a
v0.2.0tag is pushed after merge.What changes
.github/workflows/release.yml(new), modelled on rowspec's. On av*tag:gate:just check,just test,just mutants(the same gatescheck.ymlruns on a PR), andkindcallskind.ymlon the toy tree exactly ascheck.ymldoes.build(needs both):uv build, then refuseskindkit/and its.dist-info, or missingkindkit/py.typed,uv run --exact --locked pytest) ortools/validate_case_tree.py tests/fixtures/kvfails when run from the unpacked sdist,kindkit.__version__disagrees with its metadata, that imports a non-stdlib module, that resolveskindkitfrom the checkout instead of the wheel, or whose runner cannot both pass the toy kind (Good) and fail its negative control (Raw).publish(needsbuild;if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')):environment: pypi,id-token: write,pypa/gh-action-pypi-publishat the same full SHA rowspec pins (v1.14.2).Every action is pinned by commit SHA, with the same SHAs rowspec and
check.ymluse.workflow_dispatchis a dry run on any ref, a tag included. Every gate and the build run, andpublishis skipped because the event is notpush. A guard on the ref alone would not be enough:gh workflow run release.yml --ref v0.2.0setsgithub.reftorefs/tags/v0.2.0, which thepypienvironment admits. rowspec's workflow has noif:on publish at all. rowspec's release workflow creates no GitHub Release, so this one doesn't either. Its action-pin and published-action jobs have no counterpart here, because kindkit ships noaction.yml.sdist ships
case-tree/(with its CC0LICENSE).tools/validate_case_tree.pyandtools/mutation_gate.pyreadcase-tree/expect.schema.json, and the sdist shippedtools/without it. Before this change, from an unpacked sdist,python3 -I tools/validate_case_tree.py tests/fixtures/kvprintederror: cannot read schema '.../case-tree/expect.schema.json'and exited 2. It now prints0 invalid case(s) across 6 case(s) in 1 tree(s)and exits 0.sdist ships
uv.lockand.pre-commit-config.yaml.tests/test_tooling.pyreads both to check the ruff hook against the locked ruff, and from the unpacked sdist it failed withFileNotFoundErrorattests/test_tooling.py:22. Both files are already public in this repository and name only public sources (pypi.org, and the GitHub repositories of the pre-commit hooks). From the unpacked sdist,uv run --exact --locked pytest -qnow gives220 passed, the same count as the checkout, with none skipped. No test needs a git checkout: the git tests build their own repositories undertmp_path.Version 0.2.0 in
pyproject.toml,kindkit.__version__anduv.lock's own entry (viauv lock).README status line: "not on PyPI" becomes "published on PyPI as
kindkitfromv*tags, starting at0.2.0; install withpip install kindkit". The "Using the workflow" section now says 0.2.0 is the first release that has the report keysv0.1.0lacks. The claim that rowspec pins kindkit to a commit still holds:git -C rowspec show origin/main:pyproject.toml | grep kindkitshowskindkit @ git+...@8e21b558....Changes since v0.1.0
kindkit has no CHANGELOG. From
git log --oneline v0.1.0..origin/main:Evidence
just checkjust test220 passed, exit 0just mutants148 mutations, 148 caught, 0 survived, 0 broken, exit 0uv buildkindkit-0.2.0.tar.gz,kindkit-0.2.0-py3-none-any.whlzipfile.ZipFile(whl).namelist()kindkit/{__init__,cli,gitmerge,mutation,runner}.py,kindkit/py.typed,kindkit-0.2.0.dist-info/{METADATA,WHEEL,RECORD},licenses/LICENSE,licenses/LICENSES/{Apache-2.0,CC-BY-4.0,CC0-1.0,MIT}.txtMETADATAName: kindkit,Version: 0.2.0,License-Expression: MITpython3 -m venv v && v/bin/pip install kindkit-0.2.0-py3-none-any.whl && v/bin/python -I -c 'import kindkit; print(kindkit.__version__)'0.2.0, from the venv's site-packagesrun:block of thebuildjob, extracted with PyYAML and run withbash -ein a copy of the checkoutGITHUB_REF_NAME=v0.2.0) exit 0; wheel contents exit 0; smoke exit 0, printing0 failure(s)forGoodand2 failure(s)forRawv0.2.1: exit 1.__version__ = "0.0.0", wheeltests/__init__.py, wheel withoutpy.typed,python -Pdropped,Rawswapped forAlt,import yamlinrunner.py: allcaught (exit 1). Controls exit 0kk28-sdist-sweep.sh: the step'srun:block extracted with PyYAML, run on a copy of the checkout, then rerun with each new include entry deleted, hashingpyproject.tomlbefore and after each220 passed,0 invalid case(s) across 6 case(s) in 1 tree(s))./case-treeremoved (d3e04a28e132 -> 73c2cbdeefdf): exit 1,FileNotFoundError: .../case-tree/expect.schema.json./uv.lockremoved (-> c9f49de5ef26): exit 2,Unable to find lockfile at uv.lock, but --locked was provided./.pre-commit-config.yamlremoved (-> 2f7e849b0096): exit 1,FileNotFoundErrorattests/test_tooling.py:22220 passed in 11.06sandin 33.24s). In CI this is an estimate, not a measurement: roughly that plus an environment sync. The step cannot run until the workflow is onmaintar -tzf kindkit-0.2.0.tar.gzcase-tree/{CASE-TREE.md,LICENSE,expect.schema.json},uv.lockand.pre-commit-config.yamlcheck_required_checks.py --loadon a--public-onlysnapshot with thisrelease.ymladded to kindkit's workflows0 finding(s), 0 not evaluated, exit 0push:stripped of itstags:filterDUPLICATE kindkit: ... release.yml: job 'kind' ... also produces 'kind / conformance' on push to other branches, exit 1The
python -Pguard caught a real defect while this was being written. A script read from stdin puts the working directory onsys.path, so without-Pthe smoke test importedkindkitfrom the checkout and not from the wheel.Not covered here
publishjob and thekindcall from a tag ref have not run. Aworkflow_dispatchonmainafter merge exercises everything exceptpublish.check.ymlis unchanged. This workflow adds nopull_requesttrigger and pushes only on tags.