Skip to content

Commit

Permalink
fix(pypi): include pyi files in data attribute (#2558)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rickeylev authored Jan 13, 2025
1 parent 51f1047 commit 1aa0d9f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ Unreleased changes template.
`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
Expand Down
4 changes: 3 additions & 1 deletion python/private/pypi/whl_library_targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,13 @@ def whl_library_targets(
)

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.
Expand Down
2 changes: 0 additions & 2 deletions tests/pypi/whl_library_targets/whl_library_targets_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ def _test_whl_and_library_deps(env):
"**/*.py",
"**/*.pyc",
"**/*.pyc.*",
"**/*.pyi",
"**/*.dist-info/RECORD",
] + glob_excludes.version_dependent_exclusions(),
),
Expand Down Expand Up @@ -325,7 +324,6 @@ def _test_group(env):
"**/*.py",
"**/*.pyc",
"**/*.pyc.*",
"**/*.pyi",
"**/*.dist-info/RECORD",
] + glob_excludes.version_dependent_exclusions(),
),
Expand Down

0 comments on commit 1aa0d9f

Please sign in to comment.