Replace failing ty with Pyrefly#14496
Conversation
|
I don't think we should point it at main, that would cause too many issues because Pyrefly is actively developed and CI would change day to day. Should change I would suggest the PR be limited to adding Pyrefly + resolving any issues Pyrefly flags, rather than deleting the ty config, to avoid doing too much. |
|
@yangdanny97 then instructions at https://pyrefly.org/en/docs/installation/#using-the-github-action-recommended should somehow reflect the latest stable version. Right now they point to |
@yangdanny97 I pinned action to Still the same error with pinned version. I am not sure why |
|
yeah I think maybe ignore the instructions on the website, I need to fix that. what i mean is:
|
|
@yangdanny97 if |
|
@abitrolly I don't understand what you mean - the type checkers and type stubs are listed in their own dependency group, so I don't think they're downloaded when a regular user downloads the package. Listing it like this allows developers to run the correct version of the type checker locally, without needing to submit to Github and waiting for CI (and if CI reads the version from the same place then it's easy to keep them both in sync) |
|
@yangdanny97 the point is to replace failing |
|
I don't understand why we are actually having 3 different type checkers. I know that mypy is slow but for our needs, mypy has been used for a very long time. And If we want to ditch ty for pyrefly, pyrefly should be declared a dependency not in the CI but for local dev as well. It doesn't make sense otherwise to locally use ty but not for CI checks. |
|
Pyrefly is fairly stable now, given that it's past v1.0. There is a migration script that can handle changes to suppressed errors and whatnot during version bumps. Re: multiple type checkers, I was under the impression that outside of custom extensions sphinx is mostly called from the CLI rather than used as a library, is that accurate? |
Yes, AFAIK usually you use Sphinx but you don't write extensions for it. However, I still fail to see why sphinx itself should have multiple type checkers. |
|
The main benefit of running multiple type checkers for library maintainers is that they can verify the common usage patterns are compatible with their users' tooling. The usual guidance we'd give is to pick 1 type checker to run on the source code of the library, and only run multiple type checkers on the code that represents what the users would write. For most libraries this would be the test suite, but in this case I guess it would be any sample/built-in extensions that are in this repo. Whether or not it's worth the hassle to maintain this setup if only a small fraction of users write extensions is something that you can decide for yourselves. I personally think running a single type checker for the whole project is perfectly fine in this case, and additional checkers only adds marginal benefits. That said, the Pyrefly team (of which I am a member) is happy to provide support & bug fixes if you do choose to use Pyrefly, and there are benefits like having a faster tool that has better IDE integration than mypy. |
|
Generally, I‘d be in favor of switching to pyrefly. It seems currently the best solution, and the lock-in effect is weak. We can always change again later. |
|
According to pip, pyrefly 1.1.1 should be available through pip, so can you pin that in pyproject.toml first and use that one for the CI instead of the GHA? I don't know whether it's better if we use GHA or uv here though but since the CI uses pip everywhere, I'd prefer keeping the same structure for now (and later we can switch to GHA for all actions). By pinning somethjing in pyproject.toml we also ensure that we don't have divergent results when checking locally. And if we drop ty, I would also remove it from pyproject.toml. |
Purpose
Fix CI/CD failures in PRs and main branch.
References
Fixes #14238
AI Disclosure
No AI tools used