Repository navigation
ci: check the wheel's version and upload the distributions publish.yml releases - #63
Merged
Merged
Conversation
The clean-install check imported each module with `python -c` from the repository root, so a flat-layout package would import from the source tree rather than the wheel, and it never compared the declared version with the one the wheel installs. The check now runs isolated (-I), imports the listed modules, reads the distribution name from pyproject.toml (it may differ from the import name) and fails when the package's __version__ differs from importlib.metadata.version of that distribution. A package that declares no __version__ has only the metadata version and passes. The install and the check are separate steps, and the tests run the check's step under the runner's shell against a fake installed wheel: a matching, a contradicting and an absent version, a module that does not import, and a source tree that would shadow the wheel.
A repository's publish.yml releases the distributions its CI built, downloading the artifact `python-package-distributions`, and the shared gates' Build job uploaded nothing. The first Python leg now uploads `dist/` under that name, after the import check, so a release carries only distributions every check passed. One leg uploads because an artifact name is unique within a run; no files is an error.
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.
The two Build changes a repository needs before its
publish.ymlcan release what the shared gates built. txpert-nnx and state-nnx are the first callers.The import check compares
__version__with the installed metadata.pyproject.toml, because it can differ from the import name (avitai-txpert-nnxandtxpert_nnx).__version__differs fromimportlib.metadata.versionof that distribution.__version__passes on its metadata version alone. artifex, avitai-knowledge, image-reconstruction and ai-for-science-hub declare none.-I). Before, it ranpython -cfrom the repository root, so a flat-layout package would have imported from the source tree instead of the wheel.The first Python leg uploads
dist/aspython-package-distributions.publish.ymldownload.dist/is an error.Tests. They run the check's own step under the runner's shell (
bash --noprofile --norc -eo pipefail) against a fake installed wheel, in five cases:Each new test failed before its step existed. As a control, removing
-Imakes the shadowing test fail withfakepkg.__version__ is 9.9, but fake-dist 1.0 is installed. actionlint 1.7.12 with shellcheck passes, and a planted SC2086 is caught.Blast radius.
publish.ymlbuilds in its own run, so the artifact name doesn't collide.origin/mainof each repository, every stack package that declares a version matches itspyproject.toml: seven read it from__init__.pythrough hatchling, curifex's static0.1.0matches, and four read the installed metadata. Adopting the check turns no repository red.