Skip to content

Commit 9604754

Browse files
committed
feat: make pypi-generated targets include pyi files
1 parent 1cb4f8f commit 9604754

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ Unreleased changes template.
6767
`python_version` attribute is still used to specify the Python version.
6868
* (pypi) Updated versions of packages: `pip` to 24.3.1 and
6969
`packaging` to 24.2.
70+
* (pypi) For pypi-generated targets, `*.pyi` files are included in the
71+
`pyi_srcs` attribute instead of the `data` attribute.
7072

7173
{#v0-0-0-deprecations}
7274
#### Deprecations
@@ -120,6 +122,7 @@ Unreleased changes template.
120122
only dependencies added. See {obj}`py_library.pyi_srcs` and
121123
`py_library.pyi_deps` (and the same named attributes for `py_binary` and
122124
`py_test`).
125+
* (pypi) pypi-generated targets set `pyi_srcs` to include `*.pyi` files.
123126
* (providers) {obj}`PyInfo` has new fields to aid static analysis tools:
124127
{obj}`direct_original_sources`, {obj}`direct_pyi_files`,
125128
{obj}`transitive_original_sources`, {obj}`transitive_pyi_files`.

python/private/pypi/whl_library_targets.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ def whl_library_targets(
226226
"**/*.py",
227227
"**/*.pyc",
228228
"**/*.pyc.*", # During pyc creation, temp files named *.pyc.NNNN are created
229+
"**/*.pyi",
229230
# RECORD is known to contain sha256 checksums of files which might include the checksums
230231
# of generated files produced when wheels are installed. The file is ignored to avoid
231232
# Bazel caching issues.
@@ -244,6 +245,9 @@ def whl_library_targets(
244245
# pure-Python code, e.g. pymssql, which is written in Cython.
245246
allow_empty = True,
246247
),
248+
pyi_srcs = native.glob(
249+
["site-packages/**/*.pyi"],
250+
),
247251
data = data + native.glob(
248252
["site-packages/**/*"],
249253
exclude = _data_exclude,

0 commit comments

Comments
 (0)