Skip to content

Package project locks with uv build’s fast path - #22067

Closed
konstin wants to merge 7 commits into
mainfrom
konsti/build-packaged-lock
Closed

konstin wants to merge 7 commits into
mainfrom
konsti/build-packaged-lock

Conversation

@konstin

@konstin konstin commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

uv build can include a project's runtime lock in distributions. Under the locked-tools preview, it adds pylock.toml to the source distribution and wheel when the bundled uv_build fast path is used and the project’s dependencies use PyPI sources. tool.uv.export-lock and UV_EXPORT_LOCK can require export for other sources, or disable it.

The frontend checks workspace locks offline before packaging. Automatic export skips the lock when it cannot be packaged, including when it is missing, stale, or unverifiable. Explicitly requested export fails instead. Automatic export uses the lock to determine eligible sources, so a stale lock that still refers to non-PyPI sources can cause export to be skipped. Run uv lock before building, or explicitly enable export to require a lock. The packaged lock covers the project's runtime dependencies, rather than the full workspace lock. Dependencies on other workspace members are not supported. Locks restricted to specific environments retain those restrictions. The exported lock does not include optional extras or dependency groups; automatic export checks both for non-PyPI sources.

For uv_build, the frontend passes the formatted lock to the bundled fast path, which writes it during the build. Lock checks apply the build command's constraints and hash policy to any metadata builds.

Export runs in uv build through the bundled fast path. PEP 517 builds do not export the lock. Other frontends such as python -m build do not export the lock. The build backend does not need the lock exporter or its HTTP dependencies.

@astral-sh-bot

This comment has been minimized.

@codspeed

codspeed Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 7 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 89 untouched benchmarks
⏩ 84 skipped benchmarks1


Comparing konsti/build-packaged-lock (c504e99) with main (4ec9e68)

Open in CodSpeed

Footnotes

  1. 84 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@konstin
konstin force-pushed the konsti/build-packaged-lock branch from c0fc577 to c41baa9 Compare September 29, 2026 14:35
@konstin
konstin force-pushed the konsti/build-packaged-lock branch from c41baa9 to 34d4b59 Compare September 29, 2026 14:58
@konstin
konstin force-pushed the konsti/build-packaged-lock branch from 34d4b59 to fa80349 Compare September 30, 2026 10:49
@konstin
konstin force-pushed the konsti/build-packaged-lock branch from fa80349 to 26b27b9 Compare September 30, 2026 10:55
@konstin
konstin force-pushed the konsti/build-packaged-lock branch from 26b27b9 to 7c471ba Compare September 30, 2026 11:15
@konstin
konstin force-pushed the konsti/build-packaged-lock branch from 7c471ba to e152ddf Compare September 30, 2026 12:51
@konstin
konstin force-pushed the konsti/build-packaged-lock branch 2 times, most recently from e152ddf to 3fca949 Compare September 30, 2026 13:01
@konstin
konstin force-pushed the konsti/build-packaged-lock branch from 3fca949 to f37ab2b Compare September 30, 2026 16:02
@konstin
konstin force-pushed the konsti/build-packaged-lock branch from 6b2ad68 to 5d0341b Compare October 2, 2026 12:58
@konstin
konstin force-pushed the konsti/build-packaged-lock branch from 5d0341b to fee1e52 Compare October 2, 2026 13:06
@konstin
konstin force-pushed the konsti/build-packaged-lock branch from aa268bd to 3466cf1 Compare October 2, 2026 13:34
@konstin
konstin force-pushed the konsti/build-packaged-lock branch from 3466cf1 to 90cef4e Compare October 12, 2026 09:07
@konstin
konstin force-pushed the konsti/build-packaged-lock branch from 24fd33d to f81fe2a Compare October 12, 2026 13:55
@konstin
konstin force-pushed the konsti/build-packaged-lock branch from f81fe2a to 094493d Compare October 15, 2026 08:40
@konstin
konstin force-pushed the konsti/build-packaged-lock branch from 440400b to 00321d3 Compare October 15, 2026 12:00
@konstin
konstin changed the base branch from main to konsti/pylock-environments October 15, 2026 12:00

This branch was previously deployed

1 inactive deployment
automations — c504e995 Deployed Nov 17, 2026 by konstin via review | security / security review #54034
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.

2 participants