Skip to content

Add py.typed marker to fix mypy type detection (fixes #446)#452

Open
daniel7an wants to merge 1 commit intouiri:masterfrom
daniel7an:fix/issue-446-mypy-types
Open

Add py.typed marker to fix mypy type detection (fixes #446)#452
daniel7an wants to merge 1 commit intouiri:masterfrom
daniel7an:fix/issue-446-mypy-types

Conversation

@daniel7an
Copy link

Problem

Mypy does not recognize the toml package's inline type stubs, producing:

error: Library stubs not installed for "toml"  [import]
note: Hint: "python3 -m pip install types-toml"

This happens because the package is missing the PEP 561 py.typed marker file, even though it ships .pyi stub files.

Fix

  • Add toml/py.typed marker file (empty, as per PEP 561)
  • Add package_data to setup.py to ensure py.typed and .pyi files are included in built distributions

Related

Fixes uiri#446. The package has .pyi stub files but was missing the PEP 561
py.typed marker file, causing mypy to not recognize the inline type
information and instead request installation of types-toml.

This commit:
- Adds the py.typed marker file to the toml package
- Adds package_data to setup.py to ensure py.typed and .pyi files are
  included in the built distribution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mypy not catching correctly the toml library

1 participant