Skip to content

mypy fails with *-stubs is not a valid Python package name #8229

Closed
@c4f3a0ce

Description

@c4f3a0ce

According to PEP 561 stub-only package:

The name of the stub package MUST follow the scheme foopkg-stubs for type stubs for the package named foopkg.

However if we invoke mypy on such package providing only path it fails with

*-stubs is not a valid Python package name

This can be reproduced on the example package:

git clone https://github.com/ethanhs/stub-package
cd stub-package
mypy ./typedpkg-stubs
typedpkg-stubs is not a valid Python package name

Invoking mypy with -p option works

mypy -p typedpkg-stubs
Success: no issues found in 2 source files

but the former behavior is rather confusing.

Expected behavior:

  • mypy should recognize *-stubs paths as roots of stub-only packages.

Tested with:

  • mypy 0.761
  • mypy-0.770+dev.9101707bd0c96624d09cb31fe573d7e25c89a35c

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions