facebook / facebook/pyrefly

Numpy typing is a little weird

Open
#3,376 7 comments 0 reactions 0 assignees View on GitHub
configuration language-server
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

Some of the numpy types being inferred are technically correct, but not as expected.
```python
import numpy as np
from numpy.typing import NDArray

def calculate() -> NDArray:
return np.zeros(1000)
```
In a minimal example as above, I get the type hint that zeros is an attribute:

Image

When I navigate to zeros, it takes me to the __all__ list that exports it, but not to the function:

Image

It also doesn't understand the NDArray return type at all:

Image

Neovim version:
```
NVIM v0.12.2
Build type: Release
LuaJIT 2.1.1774638290
```
Pyrefly version: `1.0.0`
Numpy version: `2.4.2`
Python version: `3.14`

Please let me know what other information is needed, not sure what logs would be helpful, but happy to provide whatever requested

### Sandbox Link

_No response_

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.