Skip to content

Numpy typing is a little weird #3376

@JonoLF

Description

@JonoLF

Describe the Bug

Some of the numpy types being inferred are technically correct, but not as expected.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    language-serverIssues specific to our IDE integration rather than type checking

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions