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

Policy on external dependencies for third party stubs #10150

Closed
hamdanal opened this issue May 6, 2023 · 4 comments · Fixed by #10156
Closed

Policy on external dependencies for third party stubs #10150

hamdanal opened this issue May 6, 2023 · 4 comments · Fixed by #10156

Comments

@hamdanal
Copy link
Contributor

hamdanal commented May 6, 2023

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.

@hauntsaninja
Copy link
Collaborator

hauntsaninja commented May 6, 2023

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 :-)

@hamdanal
Copy link
Contributor Author

hamdanal commented May 6, 2023

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.

@Avasam
Copy link
Collaborator

Avasam commented May 8, 2023

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 )

@hamdanal
Copy link
Contributor Author

hamdanal commented May 8, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants