Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jorenham
Copy link
Member

@jorenham jorenham commented Jan 26, 2026

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

@jorenham jorenham added this to the 2.5.0 Release milestone Jan 26, 2026
@jorenham
Copy link
Member Author

cc @MarcoGorelli

Copy link
Member

@MarcoGorelli MarcoGorelli left a 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

@jorenham
Copy link
Member Author

jorenham commented Jan 29, 2026

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?

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)

@jorenham
Copy link
Member Author

If a # pyrefly:ignore[deprecated] the reported line and then run uvx pyrefly check --remove-unused-ignores, it removes it 🤷‍♂️

@MarcoGorelli
Copy link
Member

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 uvx here instead of spin run pyrefly check?

@jorenham
Copy link
Member Author

jorenham commented Jan 29, 2026

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)

Hmm, strange... I opened facebook/pyrefly#2258

for my understanding, any reason to use uvx here instead of spin run pyrefly check?

It avoids having to install most dependencies, so it's just a performance thing.

BTW, spin pyrefly also works :)

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.

2 participants