[Pandas-dev] Decoupling type stubs for the public API from the pandas distribution

Joris Van den Bossche jorisvandenbossche at gmail.com
Tue Dec 7 11:30:02 EST 2021


Hi Irv,

I am not very familiar with the typing space so some questions below.

Can you explain a bit more what would be the consequence of the type
annotations in pandas itself? I suppose we wouldn't remove those? (we also
have type annotations for non-public APIs) Or how would those be kept in
sync?

Another question: what is the main advantage for doing so? I suppose this
doesn't make it necessarily easier for the user, but is the goal the make
the type stubs better maintainable?
Would the type-stubs package be for a specific pandas version (and get
somewhat synced releases?)

Joris

On Tue, 23 Nov 2021 at 17:22, Irv Lustig <irv at princeton.com> wrote:

> I discovered this feature of typing:
> https://www.python.org/dev/peps/pep-0561/#stub-only-packages
>
> The idea is that for a package like pandas, we can have a separate package
> "pandas-stubs" that would contain the type stubs for pandas.  We wouldn't
> have to worry about including a `py.typed` file or `.pyi` files in our
> standard pandas distribution - all typing for the public API would be in
> the separate package.  That would allow pandas typing for the public API to
> be maintained separately (different GitHub repo).  We could start by just
> copying over what Microsoft created at
> https://github.com/microsoft/python-type-stubs/tree/main/pandas and then
> we maintain it as a separate repo, which could be installed via pip and
> conda.
>
> Any thoughts on whether we should consider doing this?
>
> -Irv
>
> _______________________________________________
> Pandas-dev mailing list
> Pandas-dev at python.org
> https://mail.python.org/mailman/listinfo/pandas-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/pandas-dev/attachments/20211207/adae689f/attachment.html>


More information about the Pandas-dev mailing list