Skip to content

Commit

Permalink
Remove dependency on rules_python (#40)
Browse files Browse the repository at this point in the history
## Issue

The rules_python maintainers would like to depend on rules_uv to re-publish the `pip_compile` macro, but there's some uncertainty around whether a circular dependency between rules_uv and rules_python would cause problems. rules_uv only depends on there existing a Python toolchain at execution time, and otherwise doesn't need the explicit dependency, so we can remove it.

## Summary

Remove the rules_python dependency from the main module and add it back in examples. Update the readme to help users continue to have a functioning ruleset.
  • Loading branch information
mark-thm authored May 22, 2024
1 parent 9226b04 commit 6965c28
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 0 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ bazel_dep(name = "buildifier_prebuilt", version = "6.1.2")
bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "rules_multitool", version = "0.4.0")

# required for venv
bazel_dep(name = "rules_python", version = "0.31.0")

multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
multitool.hub(lockfile = "//uv/private:uv.lock.json")
use_repo(multitool, "multitool")
1 change: 1 addition & 0 deletions examples/typical/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module(
)

bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "rules_python", version = "0.31.0")
bazel_dep(name = "rules_uv", version = "0.0.0")
local_path_override(
module_name = "rules_uv",
Expand Down
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Installing with bzlmod, add to MODULE.bazel (adjust version as appropriate):
bazel_dep(name = "rules_uv", version = "<version>")
```

**Note**: rules_uv requires a Python toolchain to be available. One can be obtained by having [rules_python](https://github.com/bazelbuild/rules_python) installed using:

```starlark
bazel_dep(name = "rules_python", version = "<rules_python version>")
```

### pip_compile

Create a requirements.in or pyproject.toml -> requirements.txt compilation target and diff test:
Expand Down

0 comments on commit 6965c28

Please sign in to comment.