Skip to content

Commit 1aa0d9f

Browse files
authored
fix(pypi): include pyi files in data attribute (bazel-contrib#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.
1 parent 51f1047 commit 1aa0d9f

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

CHANGELOG.md

-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ Unreleased changes template.
8888
`python_version` attribute is still used to specify the Python version.
8989
* (pypi) Updated versions of packages: `pip` to 24.3.1 and
9090
`packaging` to 24.2.
91-
* (pypi) For pypi-generated targets, `*.pyi` files are included in the
92-
`pyi_srcs` attribute instead of the `data` attribute.
9391

9492
{#v1-1-0-deprecations}
9593
#### Deprecations

python/private/pypi/whl_library_targets.bzl

+3-1
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,13 @@ def whl_library_targets(
222222
)
223223

224224
if hasattr(rules, "py_library"):
225+
# NOTE: pyi files should probably be excluded because they're carried
226+
# by the pyi_srcs attribute. However, historical behavior included
227+
# them in data and some tools currently rely on that.
225228
_data_exclude = [
226229
"**/*.py",
227230
"**/*.pyc",
228231
"**/*.pyc.*", # During pyc creation, temp files named *.pyc.NNNN are created
229-
"**/*.pyi",
230232
# RECORD is known to contain sha256 checksums of files which might include the checksums
231233
# of generated files produced when wheels are installed. The file is ignored to avoid
232234
# Bazel caching issues.

tests/pypi/whl_library_targets/whl_library_targets_tests.bzl

-2
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ def _test_whl_and_library_deps(env):
252252
"**/*.py",
253253
"**/*.pyc",
254254
"**/*.pyc.*",
255-
"**/*.pyi",
256255
"**/*.dist-info/RECORD",
257256
] + glob_excludes.version_dependent_exclusions(),
258257
),
@@ -325,7 +324,6 @@ def _test_group(env):
325324
"**/*.py",
326325
"**/*.pyc",
327326
"**/*.pyc.*",
328-
"**/*.pyi",
329327
"**/*.dist-info/RECORD",
330328
] + glob_excludes.version_dependent_exclusions(),
331329
),

0 commit comments

Comments
 (0)