Skip to content

Commit

Permalink
Added type hints to @rules_python//python/runfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre committed Dec 24, 2023
1 parent 02591a5 commit a4352e9
Show file tree
Hide file tree
Showing 6 changed files with 209 additions and 174 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/mypy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: mypy

on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize

defaults:
run:
shell: bash

jobs:
ci:
runs-on: ubuntu-20.04
steps:
# Checkout the code
- uses: actions/checkout@v2
- uses: jpetrucciani/mypy-check@master
with:
requirements: 1.6.0
python_version: 3.11
path: 'python/runfiles'
- uses: jpetrucciani/mypy-check@master
with:
requirements: 1.6.0
python_version: 3.11
path: 'tests/runfiles'

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ A brief description of the categories of changes:

### Changed

* (runfiles) `rules_python.python.runfiles` now directly implements type hints
and drops support for python2 as a result.

* (toolchains) `py_runtime`, `py_runtime_pair`, and `PyRuntimeInfo` now use the
rules_python Starlark implementation, not the one built into Bazel. NOTE: This
only applies to Bazel 6+; Bazel 5 still uses the builtin implementation.
Expand Down
2 changes: 2 additions & 0 deletions python/runfiles/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ py_library(
"__init__.py",
"runfiles.py",
],
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.
Expand All @@ -49,6 +50,7 @@ py_wheel(
dist_folder = "dist",
distribution = "bazel_runfiles",
homepage = "https://github.com/bazelbuild/rules_python",
python_requires = ">=3.7",
strip_path_prefixes = ["python"],
twine = "@publish_deps_twine//:pkg",
# this can be replaced by building with --stamp --embed_label=1.2.3
Expand Down
Empty file added python/runfiles/py.typed
Empty file.
Loading

0 comments on commit a4352e9

Please sign in to comment.