chore(examples): replace compile_pip_requirements with uv lock() - #4110
chore(examples): replace compile_pip_requirements with uv lock()#4110rickeylev wants to merge 7 commits into
Conversation
Modernize requirement locking across Bzlmod-enabled examples and documentation to use uv via the lock() rule instead of pip-compile. Migrate requirement targets in Bzlmod examples to lock() and update universal and Windows lockfiles. Canonicalize platform labels in lock() so submodules resolve targets correctly.
Format multi-word flag arguments as key=value pairs (--flag=val) for clarity. Add DO NOT SUBMIT comment in other_module/MODULE.bazel to consider making uv auto-used before switching all examples over to it.
Note that platform labels in lock() are canonicalized for submodules.
Move [tool.uv] settings subsection directly under uv pip compile (bzlmod) before the pip compile (WORKSPACE) section.
Update bzlmod_lockfile MODULE.bazel.lock after canonical label changes in common_labels.bzl and lock.bzl.
Clarify that consideration of making uv auto-used is a DO NOT MERGE condition.
| # DO NOT MERGE: consider making uv auto-used before switching | ||
| # everything over to it. |
There was a problem hiding this comment.
What about uv not being present in WORKSPACE?
There was a problem hiding this comment.
This is a good question. CI didn't have any failures for workspace mode. Which is weird -- how is that possible? Shouldn't at least one of them failed?
|
Do we need #4029 to be able to fully switch? |
I don't see why? That PR seems more like an ergonomic fix, e.g. being able to generate a lock for something in an arbitrary location. Each sub-module will still need its own lock() target, no? |
My thinking was that:
But maybe it is fine to not have that ergonomic feature. |
That actually sounds appealing. I was trying to process the dependabot backlog and it mostly boiled down to "update requirements" in all the various examples and integration tests. AI made this easier, but it was still a bit of a chore having to find and run all the lock files. Presumably we would just have a single e.g. |
|
Yeah, I started that in the |
Using
pip-compileviacompile_pip_requirementsis slower and beingsuperseded by
uvfor requirement locking under Bzlmod. Demonstratinglock()in the examples ensures users follow modern best practicesand benefit from faster dependency resolution.
Migrate Bzlmod-enabled example workspaces and documentation to use the
lock()macro in place ofcompile_pip_requirements, updating theassociated requirements targets and lockfiles. Additionally,
canonicalize platform labels within
lock()so submodules resolvetargets reliably.
DO NOT MERGE: consider making uv auto-used before switching everything
over to it.