Repository navigation
Conversation
Bzlmod supports `pip.parse(uv_lock = ...)` to install PyPI dependencies from a universal `uv.lock` file, but `WORKSPACE` setups still required platform- or version-specific `requirements.txt` files for `pip_parse`. Maintaining separate lockfile formats across `MODULE.bazel` and `WORKSPACE` duplicated lockfile generation targets and complicated dependency updates. Add the `uv_lock` macro to `//python:pip.bzl` for `WORKSPACE` builds. It decodes `uv.lock` with `@toml.bzl`, converts it to requirements format via `uv_lock_to_requirements`, and renders the PyPI hub (and multi-version spoke repositories when `python_interpreter_target` is a dict) using the shared `pip_repository` rendering logic. Migrate repository, example, and test lockfiles that used `uv` from `requirements.txt` to unified `uv.lock` files.
Collaborator
Author
|
AI Disclosure
This is an automatically generated agent comment. |
Collaborator
Author
|
@aignas is core of this implementation for a low-effort workspace macro to handle uv.lock look promising? Just look at the files under python/private/pypi, the uv_lock.bzl and uv_lock_repo.bzl. (everything else is migration noise). The basic impl is to convert the uv.lock to requirements using the uv_lock_to_requirements helper. It basically just converts uv.lock to requirements, then feeds that into the pip rules and pip hub rules. With just a year left for workspace, I didn't want to put a ton of effort into e.g. full API compatibility with pip_parse. But enough that we can move our own workspace off it |
…on PR Propagate transitive dependency-edge markers in uv_lock_to_requirements and move the repository, example, and test lockfile migrations into a stacked child PR.
This branch has not been deployed
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.
Bzlmod supports
pip.parse(uv_lock = ...)to install PyPI dependenciesfrom a universal
uv.lockfile, butWORKSPACEsetups still requiredplatform- or version-specific
requirements.txtfiles forpip_parse.Maintaining separate lockfile formats across
MODULE.bazelandWORKSPACEduplicated lockfile generation targets and complicateddependency updates.
Add the
uv_lockmacro to//python:pip.bzlforWORKSPACEbuilds.It decodes
uv.lockwith@toml.bzl, converts it to requirementsformat via
uv_lock_to_requirements, and renders the PyPI hub (andmulti-version spoke repositories when
python_interpreter_targetis adict) using the shared
pip_repositoryrendering logic.