Skip to content

typing: numpy.__version__ not visible to mypy #18270

@henryiii

Description

@henryiii

Reproducing code example:

import numpy as np
np.__version__

Error message:

mypy tmp.py --python-version=3.7
tmp.py:2: error: Module has no attribute "__version__"; maybe "version"?
Found 1 error in 1 file (checked 1 source file)

NumPy/Python version information:

Notice that numpy.__version__ is literally in the issue template! It should be public, typable API:

Output from 'import sys, numpy; print(numpy.__version__, sys.version)'

1.20.0 3.8.2 (default, Nov  4 2020, 21:23:28)
[Clang 12.0.0 (clang-1200.0.32.28)]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions