Conversation
hatchling 1.32.1 imports `hatch`, which is absent from the isolated build environment `hatch build` creates, so every build fails with ModuleNotFoundError (pypa/hatch#2427). The release has been yanked, so unpinned resolution already skips it; this makes the exclusion explicit in the four reusable workflows that run `hatch build`. Same intent as aws-deadline/deadline-cloud#1359, which excluded 1.32.1 in pyproject.toml build-system.requires. Reusable workflows cannot edit the calling repo's pyproject.toml, so the exclusion is applied as a constraint file instead. Measured with hatch 1.16.4: the build env is installed by uv and honours UV_CONSTRAINT (a `hatchling==1.31.0` constraint changed the installed version; the same file via PIP_CONSTRAINT did not), so both variables are set to cover either installer. A `hatchling!=1.32.1` pin on the `pip install hatch` line alone would only reach the CLI environment. The Install Hatch step in reusable_python_build.yml is forced to bash because that job also runs on windows-latest, where the default pwsh shell would not evaluate the POSIX redirection. Signed-off-by: David Leong <116610336+leongdl@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.
What was the problem/requirement? (What/Why)
hatchling 1.32.1 imports
hatch, which is absent from the isolated build environment thathatch buildcreates, so every build fails withModuleNotFoundError: No module named 'hatch'(pypa/hatch#2427). All four reusable workflows here that runhatch buildwere exposed.Same intent as aws-deadline/deadline-cloud#1359, which excluded 1.32.1 in
pyproject.tomlbuild-system.requires.What was the solution? (How)
A reusable workflow cannot edit the calling repo's
pyproject.toml, so the exclusion is applied as a constraint file instead: each build step writeshatchling!=1.32.1to$RUNNER_TEMP/build-constraints.txtand pointsUV_CONSTRAINTandPIP_CONSTRAINTat it.Why a constraint and not a pin on the
pip install hatchline: that line only populates the CLI environment. The failure is in the isolated env hatch builds forbuild-system.requires. Measured with hatch 1.16.4 on a throwaway project: ahatchling==1.31.0constraint viaUV_CONSTRAINTchanged the installed build-env hatchling to 1.31.0; the same file viaPIP_CONSTRAINTdid not, because hatch installs that env with uv. Both variables are set so a pip-installed env is covered too.reusable_python_build.yml's Install Hatch step is forced toshell: bashbecause that job also runs onwindows-latest, where the default pwsh would not evaluate the POSIX redirection.What is the impact of this change?
hatch build,hatch run lintandhatch run testin the four reusable workflows can no longer resolve hatchling 1.32.1. No other package is constrained. Note 1.32.1 has since been yanked on PyPI, so unpinned resolution already skips it; this makes the exclusion explicit rather than relying on the yank.How was this change tested?
$GITHUB_ENVsnippet was run locally under bash and produced the two expected lines.UV_CONSTRAINT;hatchling!=1.32.1resolves to 1.32.0).Was this change documented?
Inline comments in each workflow point at pypa/hatch#2427 and explain why the pin has to be a constraint.
Is this a breaking change?
No. Callers need no change.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.