Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include py.typed file to make typing annotations available for library users #223

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

karlicoss
Copy link
Contributor

Hi! Mistletoe has type hints, but sadly they aren't available when you're using it as a library unless you include py.typed file (for example see https://blog.whtsky.me/tech/2021/dont-forget-py.typed-for-your-typed-python-package )

I checked the change locally: before the change running mypy on my project would result in this

src/promnesia/sources/markdown.py:7:1:7:1: error: Skipping analyzing "mistletoe": module is installed, but missing library stubs or py.typed marker  [import-untyped]
    import mistletoe
    ^
src/promnesia/sources/markdown.py:8:1:8:1: error: Skipping analyzing "mistletoe.span_token": module is installed, but missing library stubs or py.typed marker  [import-untyped]
    from mistletoe.span_token import AutoLink, Link
    ^

After the change that works! And now it's catching possible typos etc when using mistletoe

@pbodnar pbodnar added this to the 1.5.0 milestone Aug 20, 2024
@coveralls
Copy link

Coverage Status

coverage: 94.207%. remained the same
when pulling 99c2ef4 on karlicoss:pytyped
into 14b1876 on miyuchina:master.

@pbodnar pbodnar merged commit 0b7cdf7 into miyuchina:master Aug 20, 2024
9 checks passed
@pbodnar
Copy link
Collaborator

pbodnar commented Aug 20, 2024

@karlicoss, thank you! 👍 Testing took me a while because I hit some related issues, but this seems to work just fine in the end. :)

@karlicoss karlicoss deleted the pytyped branch August 23, 2024 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants