Skip to content

Add py.typed file to officialy declare that the module is typed - #113

Merged
hynek merged 1 commit into
hynek:mainfrom
mkniewallner:add-typing-marker
Dec 9, 2021
Merged

hynek merged 1 commit into
hynek:mainfrom
mkniewallner:add-typing-marker

Conversation

@mkniewallner

Copy link
Copy Markdown
Contributor

Typing was added in the module in #112.
But according to PEP 561, to officially declare that type checking is supported, libraries are expected to distribute a py.typed file in the built package:

Package maintainers who wish to support type checking of their code MUST add a marker file named py.typed to their package supporting typing.

Without this file, the module is not considered as typed, and type checkers like mypy will raise errors like:

error: Skipping analyzing "argon2": found module but no type hints or library stubs  [import]

even if the module is fully typed.

This PR simply adds a py.typed file to officially declare that the module is typed.

To ensure that it is correctly distributed in the built package, I ran:

$ python -m build
$ tar -xvf dist/argon2-cffi-21.3.0.dev0.tar.gz | grep "py.typed"

argon2-cffi-21.3.0.dev0/src/argon2/py.typed

@hynek
hynek merged commit a3a4a4d into hynek:main Dec 9, 2021
@hynek

hynek commented Dec 9, 2021

Copy link
Copy Markdown
Owner

Arghhh now this is embarrassing! πŸ€¦β€β™‚οΈ I'll wait a moment if anything else comes up and cut 21.3.0 later this week. Thanks!

hynek added a commit that referenced this pull request Dec 9, 2021
@mkniewallner
mkniewallner deleted the add-typing-marker branch December 9, 2021 18:49
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.

2 participants