Skip to content

Commit 630723c

Browse files
committed
Pin requires-python in poetry test project to match the conda env
Poetry's resolver was rejecting torchvision 0.27.0 because the project's open-ended `requires-python = ">=3.11"` (generated by `poetry new`) had to be satisfied across every Python in that range, and torchvision 0.27.0 excludes Python 3.14.1 specifically: - torchvision requires Python !=3.14.1,>=3.10 - test-poetry requires Python >=3.11 - 3.14.1 is in the project range but excluded by torchvision - therefore no version of torchvision can be locked This was only visible after dropping `--quiet` in the prior commit. Narrow the project's requires-python to ">=3.11,<3.12" (or whatever MATRIX_PYTHON_VERSION resolves to), which both unblocks resolution and makes the test reflect the actual runtime we set up in conda. Authored with Claude Code.
1 parent 00b27d8 commit 630723c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

.github/scripts/validate_poetry.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ poetry --version
1212
poetry new test_poetry
1313
cd test_poetry
1414

15+
# `poetry new` emits an open-ended requires-python = ">=X.Y", which causes
16+
# resolution to fail whenever a target wheel excludes a future Python that
17+
# falls inside that range (e.g. torchvision 0.27.0 excludes Python 3.14.1,
18+
# so Poetry refuses to lock it across ">=3.11"). Pin the range to the conda
19+
# env's exact Python minor so resolution matches the runtime we actually
20+
# test against.
21+
PY_MAJOR="${MATRIX_PYTHON_VERSION%.*}"
22+
PY_MINOR="${MATRIX_PYTHON_VERSION#*.}"
23+
PY_NEXT_MINOR=$((PY_MINOR + 1))
24+
sed -i -E "s|^requires-python\\s*=.*|requires-python = \">=${MATRIX_PYTHON_VERSION},<${PY_MAJOR}.${PY_NEXT_MINOR}\"|" pyproject.toml
25+
sed -i -E "s|^python\\s*=\\s*\".*\"|python = \">=${MATRIX_PYTHON_VERSION},<${PY_MAJOR}.${PY_NEXT_MINOR}\"|" pyproject.toml
26+
1527
TEST_SUFFIX=""
1628
if [[ ${TORCH_ONLY} == 'true' ]]; then
1729
TEST_SUFFIX=" --package torchonly"

0 commit comments

Comments
 (0)