Skip to content

GH-51474: [Python][Annotations] Add pyrefly check to CI - #51475

Open
samwgoldman wants to merge 1 commit into
apache:mainfrom
samwgoldman:GH-51474-pyrefly
Open

samwgoldman wants to merge 1 commit into
apache:mainfrom
samwgoldman:GH-51474-pyrefly

Conversation

@samwgoldman

Copy link
Copy Markdown

Rationale for this change

pyarrow's stubs are checked with mypy, pyright, and ty (#48618). This adds pyrefly, as discussed in #48622 (comment).

What changes are included in this PR?

  • ci/scripts/python_test_type_annotations.sh installs pyrefly and runs pyrefly check --summarize-errors after the other checkers.
  • python/pyproject.toml gets a [tool.pyrefly] section that mirrors the existing configs: it checks only pyarrow-stubs, targets Python 3.11, and puts pyarrow-stubs on the search path so import pyarrow resolves to the stubs rather than the source package.
  • The Python development guide documents running pyrefly.

Are these changes tested?

Locally, ci/scripts/python_test_type_annotations.sh passes with all four checkers on main. I also checked the stubs from #48622 (7 stub files, about 1,070 lines): all four checkers report 0 errors, and pyrefly takes about 0.2s. Pyrefly also reports an error planted in a stub, so it's checking the stubs rather than skipping them.

Are there any user-facing changes?

No.

Was AI used for this PR?

In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

Run pyrefly alongside mypy, pyright, and ty in
ci/scripts/python_test_type_annotations.sh, with a [tool.pyrefly] section in
python/pyproject.toml that mirrors the existing checkers (check only
pyarrow-stubs, resolve pyarrow from pyarrow-stubs first, Python 3.11), and
document it in the developer guide.
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #51474 has been automatically assigned in GitHub to PR creator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant