Skip to content

fix(runfiles): update Path method signatures for Python 3.14 compatibility and fix match() - #4100

Merged
rickeylev merged 6 commits into
bazel-contrib:mainfrom
rickeylev:import_runfiles_pr_4023
Aug 23, 2026
Merged

fix(runfiles): update Path method signatures for Python 3.14 compatibility and fix match()#4100
rickeylev merged 6 commits into
bazel-contrib:mainfrom
rickeylev:import_runfiles_pr_4023

Conversation

@rickeylev

@rickeylev rickeylev commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Align runfiles.Path method signatures with Python 3.14 typeshed stubs to
avoid type checker errors on newer Python releases. This also fixes a
bug where pattern matching failed on Python 3.12+.

This change splits the runfiles compatibility updates from PR #4023.

…ility

Align runfiles.Path method signatures with Python 3.14 typeshed stubs to prevent type checker errors under newer Python versions.

This updates method signatures (including glob, rglob, exists, is_dir, is_file, and read_text) and applies typing.override decorators where available.
Test runfiles and pathlib test suites across all supported Python versions (3.10 through 3.14) using pytest_test's python_versions attribute instead of separate targets.

Additionally override Path.match() to delegate to _as_path(), fixing a Python 3.12 compatibility bug where pattern matching failed on runfile path objects.
Document the updated runfiles.Path method signatures for Python 3.14 compatibility and the fix for Path.match on Python 3.12+.
…E pytest_test deps

Update runfiles.Path.is_dir, is_file, and read_text to check for Python 3.13+ before forwarding keyword arguments added in 3.13, ensuring Pyrefly compatibility across Python 3.10-3.14. Include exceptiongroup in pytest_test default dependencies to fix Python 3.10 test execution under WORKSPACE mode.
…st as bzlmod-only

Replace Pyrefly ignore comment in Path.read_text with a sys.version_info >= (3, 13) check before passing the newline keyword argument. Revert exceptiongroup dependency from pytest_test macro and restrict multi-version runfiles pytest targets to Bzlmod mode via SUPPORTS_BZLMOD.
@rickeylev
rickeylev marked this pull request as ready for review August 23, 2026 06:21
@rickeylev
rickeylev requested a review from aignas as a code owner August 23, 2026 06:21
@rickeylev
rickeylev enabled auto-merge August 23, 2026 06:54

@aignas aignas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the python_versions attr for things like this.

@rickeylev
rickeylev added this pull request to the merge queue Aug 23, 2026
Merged via the queue into bazel-contrib:main with commit 0c23701 Aug 23, 2026
5 checks passed
@rickeylev
rickeylev deleted the import_runfiles_pr_4023 branch August 23, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants