Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(runfiles): Added type hints to @rules_python//python/runfiles #1654

Merged
merged 5 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.8
path: 'python/runfiles'
- uses: jpetrucciani/mypy-check@master
with:
requirements: 1.6.0
python_version: 3.8
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
Loading