Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR]: Switch to uv for venv creation and for pip compile #345

Closed
jab opened this issue Jun 3, 2024 · 3 comments · Fixed by #412
Closed

[FR]: Switch to uv for venv creation and for pip compile #345

jab opened this issue Jun 3, 2024 · 3 comments · Fixed by #412
Assignees
Labels
enhancement New feature or request

Comments

@jab
Copy link

jab commented Jun 3, 2024

What is the current behavior?

  • As of #233, to create virtualenv's, aspect_rules_py has maintained its own Rust implementation (that predates uv by only a couple months -- what timing!).

    aspect_rules_py's venv binary does not work on older Linux systems such as RHEL7, resulting in an error like venv: /lib64/libc.so.6: version 'GLIBC_2.18' not found at runtime. Unfortunately this blocks adoption of aspect_rules_py by some organizations that are still stuck on older Linux systems (such as my own).

  • For pip compile functionality, aspect_rules_py currently does not provide a solution, leaving this up to the user to handle with some other tool.[1]

Describe the feature

Switching to uv (perhaps even via rules_uv) could provide the following benefits:

  • Compatibility: uv (and likewise rules_uv) works on older Linux systems.

  • Reduced maintenance costs associated with maintaining aspect_rules_py's own implementation of venv.

  • Given how popular uv has already become, uv represents a more "standard" and more field-tested implementation.

  • If uv is adopted for venv creation, using it to also provide pip_compile functionality would make aspect_rules_py even more useful.

Subsumes #300.


[1] A previous version of this description incorrectly assumed from #300 that aspect_rules_py provides this functionality directly by depending on pip-tools.

@jab jab added the enhancement New feature or request label Jun 3, 2024
@github-actions github-actions bot added the untriaged Requires traige label Jun 3, 2024
@mattem
Copy link
Collaborator

mattem commented Jun 3, 2024

The impl in rules_py has some extra considerations for handling things for bazel. A previous blocker for adopting uv was they only provide a binary, with no library API, a request that was closed as not planned when asked.

For pip compile functionality, aspect_rules_py currently calls pip-tools' pip-compile.
For pip_compile functionality, switching to uv could provide a dramatic speedup.

rules_py has no dependency on pip-tools, or pip-compile and does not provide this layer. It accepts dependencies from any py_library, how you get those py_library rules for external dependencies is up to the user. For example, there are a number of users that use rules_py with rules_pycross, which provides dependency resolver support for poetry etc. See this Slack post if you are unsure of the layering, https://bazelbuild.slack.com/archives/CA306CEV6/p1716575058135819

Given that we may need to own a layer over uv to provide the required bazel specific parts, I'm unclear how much of the maintenance and support older Linux distros items apply. The rules_py layer is already a thin wrapper over rattler. I'd be happy to accept contributions that add support for older linux distros if that's what is needed.

IMO, the biggest plus to switching to uv would be to use a actively maintained package, rather than rattler, but it would be dependant on a number of constraints.

@mattem mattem added discussion needed Discussion required to progress further and removed untriaged Requires traige labels Jun 3, 2024
@jab
Copy link
Author

jab commented Jun 3, 2024

Thanks, makes sense!

And thanks for clarifying about pip-tools here (I'm new to this codebase and got this mistaken impression by misreading "rules_python" in #300's description as "rules_py" 🙃). I've updatead this issue's description accordingly.

@jab
Copy link
Author

jab commented Jun 3, 2024

@mattem mattem self-assigned this Oct 17, 2024
@mattem mattem removed the discussion needed Discussion required to progress further label Oct 17, 2024
@mattem mattem closed this as completed in ca62068 Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants