Skip to content

Commit

Permalink
Rename bazel "pip_deps" hub_name.
Browse files Browse the repository at this point in the history
rules_python recommends not using "pip_deps" as a hub name unless the module is guaranteed to always be the root module, as the name must be unique between modules.

PiperOrigin-RevId: 715435028
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Jan 14, 2025
1 parent 7d1b040 commit 32838e8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_depen

[
pip.parse(
hub_name = "pip_deps",
hub_name = "protobuf_pip_deps",
python_version = python_version,
requirements_lock = "//python:requirements.txt",
)
for python_version in SUPPORTED_PYTHON_VERSIONS
]

use_repo(pip, "pip_deps")
use_repo(pip, "protobuf_pip_deps")

crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate", dev_dependency = True)
crate.spec(
Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ http_archive(
load("@system_python//:pip.bzl", "pip_parse")

pip_parse(
name = "pip_deps",
name = "protobuf_pip_deps",
requirements = "//python:requirements.txt",
)

load("@pip_deps//:requirements.bzl", "install_deps")
load("@protobuf_pip_deps//:requirements.bzl", "install_deps")

install_deps()

Expand Down
4 changes: 2 additions & 2 deletions python/dist/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@pip_deps//:requirements.bzl", "requirement")
load("@protobuf_pip_deps//:requirements.bzl", "requirement")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
load("@rules_python//python:packaging.bzl", "py_wheel")
Expand Down Expand Up @@ -304,7 +304,7 @@ genrule(
srcs = [":source_tarball"],
outs = ["protobuf-%s.tar.gz" % PROTOBUF_PYTHON_VERSION],
cmd = """
export PYTHONPATH=$$PWD/external/pip_deps_setuptools/site-packages
export PYTHONPATH=$$PWD/external/protobuf_pip_deps_setuptools/site-packages
set -eux
tar -xzvf $(location :source_tarball)
cd protobuf/
Expand Down
2 changes: 1 addition & 1 deletion python/dist/system_python.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def _system_python_impl(repository_ctx):
# Pip dependencies can optionally be specified using a wrapper around rules_python's repository rules:
# load("@system_python//:pip.bzl", "pip_install")
# pip_install(
# name="pip_deps",
# name="protobuf_pip_deps",
# requirements = "@com_google_protobuf//python:requirements.txt",
# )
# An optional argument `requirements_overrides` takes a dictionary mapping python versions to alternate
Expand Down
4 changes: 2 additions & 2 deletions python/google/protobuf/internal/numpy/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Protobuf python numpy Tests
# This is removed from other tests to keep numpy (and @pip_deps) as a test-only dependency
# This is removed from other tests to keep numpy (and @protobuf_pip_deps) as a test-only dependency

load("@pip_deps//:requirements.bzl", "requirement")
load("@protobuf_pip_deps//:requirements.bzl", "requirement")
load("//python:internal.bzl", "internal_py_test")

# TODO: b/278896688 - Remove this target and replace with py_library
Expand Down

0 comments on commit 32838e8

Please sign in to comment.