Skip to content

Run Pyrefly in CI - #14499

Merged
AA-Turner merged 19 commits into
sphinx-doc:masterfrom
yangdanny97:pyrefly-ci
Oct 23, 2026
Merged

AA-Turner merged 19 commits into
sphinx-doc:masterfrom
yangdanny97:pyrefly-ci

Conversation

@yangdanny97

@yangdanny97 yangdanny97 commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Per discussion on #14496, this PR replaces the ty github action with pyrefly, another Rust-based Python type checker.

Pyrefly was already included as a development dependency, but it was not pinned to a specific version. This PR pins it to 1.1.1, so that updates do not break the CI unless maintainers choose to upgrade. The local Pyrefly configuration has been updated to better-reflect mypy's configurations, and newly-introduced errors have been suppressed (~50 total).

closes #14496
fixes #14238

Comment thread sphinx/_cli/__init__.py Resolved
@yangdanny97

Copy link
Copy Markdown
Contributor Author

filed a few tracking issues to pyrefly. I don't think any of these should be blocking, when they get fixed (hopefully by the next release) and this project upgrades the version, the suppressions can be cleaned up with pyrefly suppress --remove-unused

pyrefly-org/pyrefly#4481
pyrefly-org/pyrefly#4480
pyrefly-org/pyrefly#4478

@jdillard

jdillard commented Aug 11, 2026 •

Copy link
Copy Markdown
Member

I'm not the most versed in type checking, so weight my opinion appropriately, but I think we should eventually merge this, but it should run along side the pinned ty in CI. Running both in parallel for a while lets us get a feel for how Pyrefly behaves against our codebase.

Pyrefly's pyrefly suppress --remove-unused gives us a path to reconcile suppressions on version bumps, which seems to be a contributing factor in leaving ty unpinned originally. If Pyrefly proves itself over a few releases, or the first time ty causes us friction again, we pull ty out at that point. Removing ty later seems like it should be fairly easy whenever we decide to.

# Conflicts:
#	pyproject.toml
#	pyrefly.toml
#	sphinx/builders/gettext.py
#	sphinx/environment/adapters/toctree.py
#	sphinx/ext/autodoc/_sentinels.py
#	sphinx/ext/napoleon/__init__.py
#	sphinx/util/inspect.py
#	uv.lock
@AA-Turner

AA-Turner commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

thanks @yangdanny97, but let's add pyrefly in CI instead of replacing Ty

@AA-Turner
AA-Turner merged commit a74616a into sphinx-doc:master Oct 23, 2026
32 checks passed
@AA-Turner

Copy link
Copy Markdown
Member

thanks @yangdanny97!

A

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: the 'ty' typechecking is failing

4 participants