Skip to content

Can't find package when using --package without a py.typed file #18129

@AAriam

Description

@AAriam

Crash Report

This is similar to #17048:

When an installed package does not contain a py.typed file, trying to type-check it with mypy --package returns a Can't find package error.

To Reproduce

  1. Create a package:
.
├── src/
│   └── test_package/
│       └── __init__.py
└── pyproject.toml

with pyproject.toml:

[project]
name = "test_package"
version = "0.0.0"

[build-system]
requires = ["setuptools >= 72.1.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["src"]
  1. Install the package: pip install .
  2. Run mypy: mypy --package test_package

Your Environment

  • Mypy version used: mypy 1.13.0 (compiled: yes)
  • Mypy command-line flags: --package
  • Python version used: 3.13.0
  • Operating system and version: macOS 13.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions