Repository navigation
fix(ci): install test requirements with hatch's uv - #308
Merged
Merged
Conversation
When hatch builds the environment with uv (HATCH_ENV_TYPE_VIRTUAL_UV_PATH
is set by the shared CI workflow), the env has no pip, so the bare
`pip install -r requirements-testing.txt` in pre-install-commands runs
against the interpreter outside the env. Test requirements then land in the
wrong site-packages and `hatch run test` fails with
`ModuleNotFoundError: No module named 'deadline'`.
Use `{env:HATCH_UV} pip install` instead, which works whether the env was
built with uv or virtualenv. Same change as deadline-cloud-worker-agent.
Signed-off-by: wyongzhi <276409147+wyongzhi@users.noreply.github.com>
godobyte
approved these changes
Oct 26, 2026
|
Claude review · advisory Reviewed Open: 0 blocking · 0 should-fix · 0 nit. ✅ Nothing blocking. Fix or reply to each thread; the next revision's review re-checks open threads and resolves those it agrees are handled. Resolving a thread yourself also closes it. Later revisions review only what changed. |
leongdl
approved these changes
Oct 26, 2026
1 of 2 tasks
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)
hatch run testfails in CI since aws-deadline/.github#125. The shared workflow now exportsHATCH_ENV_TYPE_VIRTUAL_UV_PATH, so hatch builds its environments with uv. A uv-built env has nopip, so the barepip install -r requirements-testing.txtinpre-install-commandsresolves to the system pip and installs the test requirements into the wrong interpreter. The systempytestthen runs without thedeadlinepackage:Same failure on #305 (dependabot) and #306.
What was the solution? (How)
Use
{env:HATCH_UV} pip installinpre-install-commandsandsyncfor thedefault,integandinteg-cienvs.HATCH_UVis set by hatch for both uv- and virtualenv-backed envs. Same fix as aws-deadline/deadline-cloud-worker-agent#1114.What is the impact of this change?
CI only. No source or behaviour change.
How was this change tested?
Locally with a fresh hatch env, both ways:
HATCH_ENV_TYPE_VIRTUAL_UV_PATH=$(which uv) hatch run teston mainline reproduces the INTERNALERROR (pytest loaded from the system site-packages). With this change: 480 passed, pytest resolved from inside the hatch env.hatch run test(virtualenv-backed): 480 passed.Was this change documented?
No, CI-internal.
Did you modify schema files?
Is this a breaking change?
No.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.