aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorChris Love <335402+chrislovecnm@users.noreply.github.com>2023-06-15 10:58:54 -0600
committerGitHub <noreply@github.com>2023-06-15 16:58:54 +0000
commit1c581242c25925a1bd6764608877ec170724f11d (patch)
treebff22522e101d14a53064e7055e38bf374c21cbf /README.md
parent3903d1a5b94cf5908cdd571d5c09bb27a5310ce2 (diff)
downloadbazelbuild-rules_python-1c581242c25925a1bd6764608877ec170724f11d.tar.gz
feat(bzlmod)!: Calling pip multiple times allowing for multiple Python versions (#1254)
Implementing the capability to call pip bzlmod extension multiple times. We can now call the pip extension with the same hub name multiple times. This allows a user to have multiple different requirement files based on the Python version. With workspace, we need incompatible aliases because you get @pip//tabulate or @pip_tabulate//:pkg. The requirement() macro hides this, but changing the flag becomes a breaking change if you've manually referenced things. With bzlmod, though, the @pip_tabulate style isn't a realistic option (you'd have to use_repo everything, which is a huge pain). So we have chosen to have `@pip//tabulate`. This commit implements that capability for pip.parse to determine the Python version from programmatically the provided interpreter. See https://github.com/bazelbuild/rules_python/blob/76aab0f91bd614ee1b2ade310baf28c38695c522/python/extensions/pip.bzl#L88 For more in-depth implementation details. INTERFACE CHANGE:: - pip.parse argument python_version is introduced but not required. When possible, it is inferred. BREAKING CHANGE: * `pip.parse()` extension: the `name` attribute is renamed `hub_name`. This is to reflect that the user-provided name isn't unique to each `pip.parse()` call. We now have a hub that is created, and each pip.parse call creates a spoke. * `pip.parse()` extension: the `incompatible_generate_aliases` arg is removed; behavior has changed to assume it is always True. * `pip.parse()` calls are collected under the same `hub_name` to support multiple Python versions under the same resulting repo name (the hub name0. Close: #1229
Diffstat (limited to 'README.md')
-rw-r--r--README.md5
1 files changed, 2 insertions, 3 deletions
diff --git a/README.md b/README.md
index cf4b04e..69be729 100644
--- a/README.md
+++ b/README.md
@@ -96,8 +96,7 @@ use_repo(interpreter, "interpreter")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
- name = "pip",
- incompatible_generate_aliases = True,
+ hub_name = "pip",
python_interpreter_target = "@interpreter//:python",
requirements_lock = "//:requirements_lock.txt",
requirements_windows = "//:requirements_windows.txt",
@@ -201,7 +200,7 @@ central external repo and individual wheel external repos.
```python
pip.parse(
- name = "my_deps",
+ hub_name = "my_deps",
requirements_lock = "//:requirements_lock.txt",
)