From f9744eca92599158206a489d7efb7f9337699880 Mon Sep 17 00:00:00 2001 From: Aaron Sky Date: Mon, 30 Jun 2025 22:00:24 -0400 Subject: [PATCH 1/4] fix: add py.typed to runfiles py_wheel so it gets packaged fixes #2503 --- python/runfiles/BUILD.bazel | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/python/runfiles/BUILD.bazel b/python/runfiles/BUILD.bazel index 2040403b10..d9bb8f8e6c 100644 --- a/python/runfiles/BUILD.bazel +++ b/python/runfiles/BUILD.bazel @@ -22,13 +22,18 @@ filegroup( visibility = ["//python:__pkg__"], ) +filegroup( + name = "py_typed", + srcs = ["py.typed"], +) + py_library( name = "runfiles", srcs = [ "__init__.py", "runfiles.py", ], - data = ["py.typed"], + data = [":py_typed"], imports = [ # Add the repo root so `import python.runfiles.runfiles` works. This makes it agnostic # to the --experimental_python_import_all_repositories setting. @@ -57,5 +62,8 @@ py_wheel( # this can be replaced by building with --stamp --embed_label=1.2.3 version = "{BUILD_EMBED_LABEL}", visibility = ["//visibility:public"], - deps = [":runfiles"], + deps = [ + ":py_typed", + ":runfiles", + ], ) From e6960eff3c021967116624836bed1081f8f0104c Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Wed, 2 Jul 2025 16:37:20 -0700 Subject: [PATCH 2/4] comment what py.typed is --- python/runfiles/BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/python/runfiles/BUILD.bazel b/python/runfiles/BUILD.bazel index d9bb8f8e6c..73663472dc 100644 --- a/python/runfiles/BUILD.bazel +++ b/python/runfiles/BUILD.bazel @@ -24,6 +24,7 @@ filegroup( filegroup( name = "py_typed", + # See PEP 561: py.typed is a special file that indicates the code supports type checking srcs = ["py.typed"], ) From fa4601ab13a9ebf8fcdb33f9cbb3ef35d18b7b47 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Wed, 2 Jul 2025 16:40:41 -0700 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cb5ca3f9f..a66fcbd0ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,8 @@ END_UNRELEASED_TEMPLATE * (pypi) Wheels with BUILD.bazel (or other special Bazel files) no longer result in missing files at runtime ([#2782](https://github.com/bazel-contrib/rules_python/issues/2782)). +* (runfiles) The pypi runfiles package now includes `py.typed` to indicate it + supports type checking. {#v0-0-0-added} ### Added From 4e176664f3bb69eb8598a5e95932685fd613bb52 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Wed, 2 Jul 2025 16:42:42 -0700 Subject: [PATCH 4/4] add issue ref to changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a66fcbd0ba..e82bb097c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,7 +68,8 @@ END_UNRELEASED_TEMPLATE result in missing files at runtime ([#2782](https://github.com/bazel-contrib/rules_python/issues/2782)). * (runfiles) The pypi runfiles package now includes `py.typed` to indicate it - supports type checking. + supports type checking + ([#2503](https://github.com/bazel-contrib/rules_python/issues/2503)). {#v0-0-0-added} ### Added