Skip to content

fix: Exclude broken hatchling 1.32.1 from isolated build envs - #25

Open
leongdl wants to merge 1 commit into
mainlinefrom
fix/exclude-hatchling-1.32.1
Open

leongdl wants to merge 1 commit into
mainlinefrom
fix/exclude-hatchling-1.32.1

Conversation

@leongdl

@leongdl leongdl commented Sep 16, 2026

Copy link
Copy Markdown

What was the problem/requirement? (What/Why)

hatchling 1.32.1 imports hatch, which is absent from the isolated build environment that hatch build creates, so every build fails with ModuleNotFoundError: No module named 'hatch' (pypa/hatch#2427). All four reusable workflows here that run hatch build were exposed.

Same intent as aws-deadline/deadline-cloud#1359, which excluded 1.32.1 in pyproject.toml build-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 writes hatchling!=1.32.1 to $RUNNER_TEMP/build-constraints.txt and points UV_CONSTRAINT and PIP_CONSTRAINT at it.

Why a constraint and not a pin on the pip install hatch line: that line only populates the CLI environment. The failure is in the isolated env hatch builds for build-system.requires. Measured with hatch 1.16.4 on a throwaway project: a hatchling==1.31.0 constraint via UV_CONSTRAINT changed the installed build-env hatchling to 1.31.0; the same file via PIP_CONSTRAINT did 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 to shell: bash because that job also runs on windows-latest, where the default pwsh would not evaluate the POSIX redirection.

What is the impact of this change?

hatch build, hatch run lint and hatch run test in 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?

  • YAML parses for all three files.
  • The $GITHUB_ENV snippet was run locally under bash and produced the two expected lines.
  • The constraint mechanism was measured locally as described above (hatch 1.16.4, uv-installed build env honours UV_CONSTRAINT; hatchling!=1.32.1 resolves to 1.32.0).
  • Not verified: an actual run of these reusable workflows on a caller repo, and the Windows leg. Happy to trigger one against a caller if a reviewer wants it before merge.

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.

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>
@leongdl
leongdl requested a review from a team as a code owner September 16, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant