Skip to content

Commit

Permalink
fix: use PyInfo from rules_python (#311)
Browse files Browse the repository at this point in the history
Switches to using `PyInfo` from rules_python, rather than relying on the
builtin one from Java.

Note that this doesn't add any interoperability between the **native**
`py_*` rules (java based) and the exports from rules_python. As such,
using rules_python with the native java based rules and providers is no
longer supported after this commit.

If we want, we could support it, but being able to consume and return
both providers.

---

### Type of change

- Bug fix (change which fixes an issue)

**For changes visible to end-users**

- Breaking change (this change will force users to change their own code
or config)
- Suggested release notes are provided below:

Use `PyInfo` provider as loaded from rules_python, and drop support for
dependency edges from native `py_*` rules.

### Test plan

- Covered by existing test cases
  • Loading branch information
Matt Mackay authored Mar 20, 2024
1 parent 9f0a49b commit df191bd
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions py/private/py_binary.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Implementation for the py_binary and py_test rules."""

load("@rules_python//python:defs.bzl", "PyInfo")
load("@aspect_bazel_lib//lib:paths.bzl", "BASH_RLOCATION_FUNCTION", "to_rlocation_path")
load("@aspect_bazel_lib//lib:expand_make_vars.bzl", "expand_locations", "expand_variables")
load("//py/private:py_library.bzl", _py_library = "py_library_utils")
Expand Down
1 change: 1 addition & 0 deletions py/private/py_library.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Implementation for the py_library rule"""

load("@rules_python//python:defs.bzl", "PyInfo")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_skylib//lib:new_sets.bzl", "sets")
load("//py/private:providers.bzl", "PyVirtualInfo")
Expand Down
1 change: 1 addition & 0 deletions py/private/py_unpacked_wheel.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Unpacks a Python wheel into a directory and returns a PyInfo provider that represents that wheel"""

load("@rules_python//python:defs.bzl", "PyInfo")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("//py/private:py_library.bzl", _py_library = "py_library_utils")
load("//py/private/toolchain:types.bzl", "PY_TOOLCHAIN", "UNPACK_TOOLCHAIN")
Expand Down
1 change: 1 addition & 0 deletions py/private/py_venv.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Implementation for the py_binary and py_test rules."""

load("@rules_python//python:defs.bzl", "PyInfo")
load("@aspect_bazel_lib//lib:paths.bzl", "BASH_RLOCATION_FUNCTION", "to_rlocation_path")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("//py/private:providers.bzl", "PyVirtualInfo")
Expand Down
1 change: 1 addition & 0 deletions py/tests/import-pathing/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_python//python:defs.bzl", "py_library")
load(":tests.bzl", "py_library_import_pathing_test_suite")

# This is used in the py_library import pathing tests
Expand Down
1 change: 1 addition & 0 deletions py/tests/internal-deps/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_python//python:defs.bzl", "py_library")
load("//py:defs.bzl", "py_binary", "py_test", rules_py_py_library = "py_library")

rules_py_py_library(
Expand Down

0 comments on commit df191bd

Please sign in to comment.