Skip to content

MYPYPATH not working with local -stubs package #5386

Closed
@Dentosal

Description

@Dentosal

This is a bug report. However, if the current behavior is not a bug, then this is request to improve documentation.

Description

Mypy doesn't recognise my local library typing stub.

Reproduction:

Actual Python file

import aiomysql

Directory tree

pythonlibtypes/
└── aiomysql-stubs
    ├── __init__.pyi
    ├── connection.pyi
    ├── cursors.pyi
    ├── pool.pyi
    ├── py.typed
    └── utils.pyi

Mypy command

MYPYPATH="/path/to/project/pythonlibtypes/" pipenv run -- mypy --config mypy.ini module_to_check

mypy.ini:

[mypy]
warn_redundant_casts = True
warn_unused_ignores = True
incremental = True
follow_imports = normal

Actual behavior

path/to/file.py:1: error: Cannot find module named 'aiomysql'

Expected behavior

Import succeeds, Mypy uses the stub

Versions

Python 3.6.5

mypy 0.620

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions