Skip to content

Set UV_BUILD_CONSTRAINT for uv installer build constraint support - #389

Merged
ryanking13 merged 5 commits into
mainfrom
copilot/fix-pyodide-build-uv-constraints
Jun 15, 2026
Merged

ryanking13 merged 5 commits into
mainfrom
copilot/fix-pyodide-build-uv-constraints

Conversation

Copilot AI commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

uv ignores PIP_BUILD_CONSTRAINT/PIP_CONSTRAINT when installing build dependencies into isolated environments, using its own UV_BUILD_CONSTRAINT instead. This meant per-package constraints defined in meta.yaml under requirements.constraint were silently skipped when uv was the active installer.

Changes

  • pyodide_build/recipe/builder.py: Set UV_BUILD_CONSTRAINT alongside PIP_CONSTRAINT and PIP_BUILD_CONSTRAINT when preparing the build environment in RecipeBuilder._compile().
constraints_file = str(self._create_constraints_file())
build_env["PIP_CONSTRAINT"] = constraints_file
build_env["PIP_BUILD_CONSTRAINT"] = constraints_file
build_env["UV_BUILD_CONSTRAINT"] = constraints_file  # added
  • pyodide_build/tests/test_cli.py: Extended the existing test_build_constraint to also verify that UV_BUILD_CONSTRAINT is set and matches PIP_CONSTRAINT/PIP_BUILD_CONSTRAINT in the environment passed to pypabuild.build.

  • CHANGELOG.md: Added entry under [Unreleased] documenting the fix.

Copilot AI linked an issue Jun 15, 2026 that may be closed by this pull request
…AINT

uv uses UV_BUILD_CONSTRAINT instead of PIP_BUILD_CONSTRAINT when
installing build dependencies. Without this, package-level constraints
(from meta.yaml `requirements.constraint`) were ignored when using uv
as the installer, causing test failures.

Fixes #358
Copilot AI changed the title [WIP] Fix build constraints for pyodide and uv compatibility Set UV_BUILD_CONSTRAINT for uv installer build constraint support Jun 15, 2026
Copilot AI requested a review from ryanking13 June 15, 2026 08:17
@ryanking13

Copy link
Copy Markdown
Member

@copilot add changelog and test

- Add test_compile_sets_uv_build_constraint to verify UV_BUILD_CONSTRAINT
  is set alongside PIP_CONSTRAINT/PIP_BUILD_CONSTRAINT in _compile()
- Add CHANGELOG entry for the fix

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot add changelog and test

Added in 753e71b:

  • test_compile_sets_uv_build_constraint in pyodide_build/tests/recipe/test_builder.py — patches pypabuild.build to capture the env dict and asserts UV_BUILD_CONSTRAINT is set and matches PIP_CONSTRAINT/PIP_BUILD_CONSTRAINT
  • Changelog entry under [Unreleased] in CHANGELOG.md

@ryanking13

Copy link
Copy Markdown
Member

@copilot don't need a separate test entry, just update the existing test that checks pip_build_constraint and add UV_BUILD_CONSTRAINT there. Also in the changelog entry, use the PR number not the original issue number

…changelog PR number

- Remove separate test_compile_sets_uv_build_constraint test
- Add UV_BUILD_CONSTRAINT assertion to existing test_build_constraint in
  test_cli.py using a capturing wrapper around pypabuild.build
- Update changelog to reference PR #389 instead of issue #358

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot don't need a separate test entry, just update the existing test that checks pip_build_constraint and add UV_BUILD_CONSTRAINT there. Also in the changelog entry, use the PR number not the orig...

Done in the latest commit. Removed the separate test and added UV_BUILD_CONSTRAINT assertions into the existing test_build_constraint (using a capturing wrapper around pypabuild.build). Also updated the changelog to reference PR #389.

@ryanking13
ryanking13 marked this pull request as ready for review June 15, 2026 11:09
@ryanking13
ryanking13 merged commit 78a23e2 into main Jun 15, 2026
12 checks passed
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.

pyodide-build and uv build constraints

2 participants