You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Policy on external dependencies for third party stubs #10150
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.
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.
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 @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.
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.
Activity
hauntsaninja commentedon 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 commentedon 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 commentedon 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 commentedon May 8, 2023
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.
Reference the stub_uploader issue discussing externals deps in the co…
Reference the stub_uploader issue discussing externals deps in the co…
Add matplotlib and pandas-stubs to the external requirements allowlist