Skip to content

Policy on external dependencies for third party stubs #10150

Closed

Description

@hamdanal

Hello typeshed team. I want to know what is the current policy on third party stubs that have external dependencies. I am mainly interested in adding stubs for the seaborn library.

seaborn has 3 dependencies: matplotlib, pandas and numpy. pandas and numpy are already typed, matplotlib merged a massive PR matplotlib/matplotlib#24976 including stub files and a py.typed to be released in the next minor (3.8) release.

I have a prototype stub for seaborn here https://github.com/hamdanal/python-stubs/tree/main/stubs/seaborn that I wish to move to typeshed so that more people can use it. The prototype still needs a lot of work (remove private modules, test with all type checkers, stubtest, etc.) hence my question:
Should I go ahead and start working on this? of course it cannot be merged until the typed matplotlib release happen. If the policy is that external dependencies are not allowed I guess there is no point on working on this as seaborn depends heavily on matplotlib and has to use its types to be useful.

Activity

  1. hauntsaninja commented on May 6, 2023

    @hauntsaninja
    Collaborator

    Thanks for raising the question!

    We do allow our stub packages to have external dependencies. We're still figuring out what exactly the right policy should be, but broadly the criteria are a) dependencies of the stub package should be dependencies of the actual package, b) dependencies should have a relatively high level of trust in the ecosystem.

    For more discussion, see:

    I think seaborn's dependencies fall comfortably under what we allow, so I'd go ahead! One minor point is that I believe pandas isn't itself typed, but there is an official stubs package and that should be fine to include as a dependency.

    Thanks helping make things better :-)

  2. hamdanal commented on May 6, 2023

    @hamdanal
    ContributorAuthor

    Thanks @hauntsaninja for the context. I'll start working on the move and we'll figure out the additions to stub_uploader's allowlist when the time comes. Also you are right about pandas, the stubs live here https://github.com/pandas-dev/pandas-stubs and are uploaded to PyPI as pandas-stubs.

    One more question. Would it make sense to add a sentence to the contributing guide about external dependencies? IMO a link to typeshed-internal/stub_uploader#90 would be sufficient. I didn't find any information about this situation in typeshed and didn't think to go look in the stub_uploader issue tracker.

  3. Avasam commented on May 8, 2023

    @Avasam
    SponsorCollaborator

    If you add seaborn stubs, that'll be one more reason to remove it from https://github.com/microsoft/python-type-stubs (see microsoft/python-type-stubs#270 )

  4. hamdanal commented on May 8, 2023

    @hamdanal
    ContributorAuthor

    If you add seaborn stubs, that'll be one more reason to remove it from https://github.com/microsoft/python-type-stubs (see microsoft/python-type-stubs#270 )

    You are totally right, I support deleting/improving those stubs.

    If you don't want to wait for the matplotlib release and for the seaborn stubs to be moved here and if the maintainers over at microsoft refuse to delete the stubs, feel free to copy those at https://github.com/hamdanal/python-stubs/tree/main/stubs/seaborn over to https://github.com/microsoft/python-type-stubs. They are in no way complete and may not be 100% correct as I don't test them but they are of a much higher quality than what they have.

  5. added a commit that references this issue on May 8, 2023
    dd743e2
  6. added a commit that references this issue on May 10, 2023
    3add7f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions