Skip to content

Commit

Permalink
fix(bzlmod)!: Changing repository name "python_aliases" to "python_ve…
Browse files Browse the repository at this point in the history
…rsions" (#1304)

I think this name is more informative for a public API. The
functionality it exposes are rules/macros that use a specific Python
version to be used. These aren't really aliases.

This commit renames "python_aliases" to "python_versions". This isn't
technically a breaking
change because bzlmod support is still beta, but we'll flag it as such
just in case.

BREAKING CHANGE:
* The `python_aliases` repo is renamed to `python_versions`. You will
need to either
update references from `@python_aliases` to `@python_versions`, or use
repo-remapping
to alias the old name (`use_repo(python,
python_aliases="python_versions")`)

Closes #1273
  • Loading branch information
chrislovecnm authored Jul 10, 2023
1 parent a068d1b commit 523b9de
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions examples/bzlmod/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@pip//:requirements.bzl", "all_requirements", "all_whl_requirements", "requirement")
load("@python_3_9//:defs.bzl", py_test_with_transition = "py_test")
load("@python_aliases//3.10:defs.bzl", compile_pip_requirements_3_10 = "compile_pip_requirements")
load("@python_aliases//3.9:defs.bzl", compile_pip_requirements_3_9 = "compile_pip_requirements")
load("@python_versions//3.10:defs.bzl", compile_pip_requirements_3_10 = "compile_pip_requirements")
load("@python_versions//3.9:defs.bzl", compile_pip_requirements_3_9 = "compile_pip_requirements")
load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")

# This stanza calls a rule that generates targets for managing pip dependencies
Expand Down
2 changes: 1 addition & 1 deletion examples/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ python.toolchain(
# See the tests folder for various examples on using multiple Python versions.
# The names "python_3_9" and "python_3_10" are autmatically created by the repo
# rules based on the `python_version` arg values.
use_repo(python, "python_3_10", "python_3_9", "python_aliases")
use_repo(python, "python_3_10", "python_3_9", "python_versions")

# This extension allows a user to create modifications to how rules_python
# creates different wheel repositories. Different attributes allow the user
Expand Down
6 changes: 3 additions & 3 deletions examples/bzlmod/tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@python_aliases//3.10:defs.bzl", py_binary_3_10 = "py_binary", py_test_3_10 = "py_test")
load("@python_aliases//3.11:defs.bzl", py_binary_3_11 = "py_binary", py_test_3_11 = "py_test")
load("@python_aliases//3.9:defs.bzl", py_binary_3_9 = "py_binary", py_test_3_9 = "py_test")
load("@python_versions//3.10:defs.bzl", py_binary_3_10 = "py_binary", py_test_3_10 = "py_test")
load("@python_versions//3.11:defs.bzl", py_binary_3_11 = "py_binary", py_test_3_11 = "py_test")
load("@python_versions//3.9:defs.bzl", py_binary_3_9 = "py_binary", py_test_3_9 = "py_test")
load("@rules_python//python:defs.bzl", "py_binary", "py_test")

py_binary(
Expand Down
2 changes: 1 addition & 1 deletion python/extensions/python.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def _python_impl(module_ctx):
# This is require in order to support multiple version py_test
# and py_binary
multi_toolchain_aliases(
name = "python_aliases",
name = "python_versions",
python_versions = {
version: entry.toolchain_name
for version, entry in global_toolchain_versions.items()
Expand Down

0 comments on commit 523b9de

Please sign in to comment.