-
-
Notifications
You must be signed in to change notification settings - Fork 12k
TYP: Type-checking with Pyrefly #30729
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
base: main
Are you sure you want to change the base?
Conversation
6c27bba to
21911ad
Compare
MarcoGorelli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
I noticed that
WARN `chararray` is deprecated [deprecated]
--> numpy/char/__init__.pyi:7:5
|
7 | chararray,
| ---------
|
The chararray class is deprecated and will be removed in a future release. Use an ndarray with a string or bytes dtype instead.
Warning: `chararray` is deprecated
is in the logs, is that worth silencing?
Encouraging that this only takes 2 seconds anyway
Also, it's nice that pyrefly flags something like
class Foo:
bar: tuple[int, ...]
class Bar(Foo):
bar: tuple[int, int]which does look like a safety concern is bar were written to, even though pyright/mypy don't flag anything
Hmm yea, you're right: https://github.com/numpy/numpy/actions/runs/21372731006/job/61521224077?pr=30729 But are you able to reproduce that locally? Because I don't see it 🤔 $ uvx pyrefly check
INFO Checking project configured at `/home/joren/Workspace/numpy/pyproject.toml`
INFO 0 errors (238 suppressed)$ spin pyrefly
$ pyrefly check
INFO Checking project configured at `/home/joren/Workspace/numpy/pyproject.toml`
INFO 0 errors (238 suppressed) |
|
If a |
|
yeah i get $ spin run pyrefly check
$ /home/marcogorelli/miniconda3/envs/numpy-dev/bin/python3.12 vendored-meson/meson/meson.py compile -C build
$ /home/marcogorelli/miniconda3/envs/numpy-dev/bin/python3.12 vendored-meson/meson/meson.py install --only-changed -C build --destdir ../build-install
WARN PYTHONPATH environment variable is set to `/home/marcogorelli/numpy-dev/build-install/usr/lib/python3.12/site-packages`. Checks in other environments may not include these paths.
INFO Checking project configured at `/home/marcogorelli/numpy-dev/pyproject.toml`
INFO 0 errors (238 suppressed)for my understanding, any reason to use |
Hmm, strange... I opened facebook/pyrefly#2258
It avoids having to install most dependencies, so it's just a performance thing. BTW, |
Currently only mypy type-checks the stubs. But since mypy is rather slow and has several open bugs, it could be to use idea to add type-checker. Pyrefly is still in beta, but I've had good experiences with it in scipy-stubs, and it's significantly faster than mypy. Another important advantage is that, unlike mypy, it has/is an LSP.
The next step will be to also use pyrefly for type-testing, i.e. type-checking the stuff under
numpy/typing/tests