Skip to content

Conversation

@dungdm93
Copy link

I'd like to use mypy to check type hint in my project. But it's failed with following error (apache/iceberg#6254)
image

pandas seem support for type hint already, however, because of missing py.typed marker, mypy can't analyze this package and report the error.

@dungdm93 dungdm93 changed the title add missing py.typed marker TYP: add missing py.typed marker Nov 23, 2022
@TomAugspurger
Copy link
Contributor

xref #28142. cc @Dr-Irv on whether we're ready to add this or not yet.

@Dr-Irv
Copy link
Contributor

Dr-Irv commented Nov 23, 2022

We should not do this. If people want to get type checking with pandas, they should install pandas-stubs

@MarcoGorelli
Copy link
Member

We should not do this. If people want to get type checking with pandas, they should install pandas-stubs

thanks @Dr-Irv - closing then, but thanks @dungdm93 for your PR

@dungdm93
Copy link
Author

Thanks @Dr-Irv, but is their any reason why we should not use builtin type checking?

@Dr-Irv
Copy link
Contributor

Dr-Irv commented Nov 24, 2022

Thanks @Dr-Irv, but is their any reason why we should not use builtin type checking?

There are a few reasons:

  1. The types inside of pandas are not complete.
  2. The types inside of pandas are meant more for internal type checking of the code, and less for users of pandas.
  3. Many of the API functions are not typed in the pandas source.

That's why we created pandas-stubs. It's meant to support type checking of user code, and we can do a LOT more checking there than is possible within the pandas code itself. We also have a testing mechanism that tests the validity of those type stubs.

Install pandas-stubs and use it. You'll be glad you did!

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.

4 participants