diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cb5ca3f9f..e82bb097c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,9 @@ 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 + ([#2503](https://github.com/bazel-contrib/rules_python/issues/2503)). {#v0-0-0-added} ### Added diff --git a/python/runfiles/BUILD.bazel b/python/runfiles/BUILD.bazel index 2040403b10..73663472dc 100644 --- a/python/runfiles/BUILD.bazel +++ b/python/runfiles/BUILD.bazel @@ -22,13 +22,19 @@ filegroup( visibility = ["//python:__pkg__"], ) +filegroup( + name = "py_typed", + # See PEP 561: py.typed is a special file that indicates the code supports type checking + 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 +63,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", + ], )