Skip to content

Add a py.typed marker file so type hints can be picked up by Mypy?Β #1527

@ooloth

Description

@ooloth

What is your feature request?

Thanks for this very helpful package!

I notice this library includes excellent type hinting, but in case you are not aware, Mypy and IDEs currently do not pick up those types on the consumer side. All that's missing is a py.typed marker file (as described in PEP 561) and that will be fixed.

In the meantime, all types are treated as Any (so no type checking or editor completions).

Could you please add that marker file?

Are there any workarounds?

We can manually import this library's types and assign them to variables. But that's a bit laborious and error prone (we need to go to the docs and hopefully copy/paste the right types. That's not a great substitute for accurate type hints being picked up automatically.

Code Snippets

Mypy shows us type errors like this:

Skipping analyzing "plexapi.video": module is installed, but missing library stubs or py.typed marker mypy (import-untyped)

Additional Context

This is a pretty common oversight fwiw, but nice and quick to fix. Here's a blog post showing how:

https://blog.whtsky.me/tech/2021/dont-forget-py.typed-for-your-typed-python-package/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions