fix(pypi): include pyi files in data attribute (#2558)
Restore the previous behavior of pyi files being included in data. This
is because
certain packages (librosa, at least) expect the pyi files to be
available at runtime.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7f4c60b..3c71f7e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -88,8 +88,6 @@
`python_version` attribute is still used to specify the Python version.
* (pypi) Updated versions of packages: `pip` to 24.3.1 and
`packaging` to 24.2.
-* (pypi) For pypi-generated targets, `*.pyi` files are included in the
- `pyi_srcs` attribute instead of the `data` attribute.
{#v1-1-0-deprecations}
#### Deprecations
diff --git a/python/private/pypi/whl_library_targets.bzl b/python/private/pypi/whl_library_targets.bzl
index 461a75c..c390da2 100644
--- a/python/private/pypi/whl_library_targets.bzl
+++ b/python/private/pypi/whl_library_targets.bzl
@@ -222,11 +222,13 @@
)
if hasattr(rules, "py_library"):
+ # NOTE: pyi files should probably be excluded because they're carried
+ # by the pyi_srcs attribute. However, historical behavior included
+ # them in data and some tools currently rely on that.
_data_exclude = [
"**/*.py",
"**/*.pyc",
"**/*.pyc.*", # During pyc creation, temp files named *.pyc.NNNN are created
- "**/*.pyi",
# RECORD is known to contain sha256 checksums of files which might include the checksums
# of generated files produced when wheels are installed. The file is ignored to avoid
# Bazel caching issues.
diff --git a/tests/pypi/whl_library_targets/whl_library_targets_tests.bzl b/tests/pypi/whl_library_targets/whl_library_targets_tests.bzl
index 5d10cf0..ba04e1d 100644
--- a/tests/pypi/whl_library_targets/whl_library_targets_tests.bzl
+++ b/tests/pypi/whl_library_targets/whl_library_targets_tests.bzl
@@ -252,7 +252,6 @@
"**/*.py",
"**/*.pyc",
"**/*.pyc.*",
- "**/*.pyi",
"**/*.dist-info/RECORD",
] + glob_excludes.version_dependent_exclusions(),
),
@@ -325,7 +324,6 @@
"**/*.py",
"**/*.pyc",
"**/*.pyc.*",
- "**/*.pyi",
"**/*.dist-info/RECORD",
] + glob_excludes.version_dependent_exclusions(),
),