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
I'm not sure we can expose it any more than we already have. _typeshed is where we put our types that may also be useful for external consumers. The reason why _typeshed is prefixed with an underscore is because the folder doesn't exist at runtime, so it's only importable inside an if TYPE_CHECKING block.
After the protocol has been around for long enough to be considered stable, we can maybe consider adding it to typing/typing_extensions. But I don't think we should do that now; and when it has been around for long enough for it to be considered stable, that conversation will need to happen over at the CPython/typing_extensions repos rather than here.
After the protocol has been around for long enough to be considered stable, we can maybe consider adding it to typing/typing_extensions. But I don't think we should do that now;
Yes, I understand. This is just for tracking purposes so that if it is exposed one day, I'll know to update my code.
This is just for tracking purposes so that if it is exposed one day, I'll know to update my code.
Okay, but there's nothing actionable for typeshed here, so I'm going to close this for now — sorry, but it's nice to keep our issue list somewhat under control :)
https://github.com/python/typing might be a better place to open an issue to discuss finding a long-term home for this protocol, whether it's CPython, typing_extensions, or some other place entirely :)
I don't know how much visibility my comment here is going to get, but I personally have had multiple instances where I've wanted to accept a DataclassInstance. Typically I do something with the object being passed in, such as call dataclasses.fields on it. I didn't realize this was importable through if TYPE_CHECKING, so I ended up copying the protocol to a local utility module. I suspect I'm not the only one writing code like this, and I imagine it could be useful to others if it was exposed in a simple way that is importable both at type-checking time and at runtime.
While this anecdote doesn't add much to this conversation, I find that frequently in the typing community features are dismissed as lacking sufficient interest when people don't post about them, belying the actual amount of interest in them.
@AlexWaygood I propose we move this to python/typing and reopen, since while there is nothing actionable for typeshed, this is a potential typing feature.
The protocol is now exposed at runtime via https://github.com/hauntsaninja/useful_types, @gandhis1, which is designed as a minimal third-party package exposing typeshed protocols at runtime that are useful to users, and which are possible candidates for inclusion in the CPython standard library in the future. I'm a maintainer of the package, as is @hauntsaninja and @JelleZijlstra -- all three of us are maintainers of typeshed, typing_extensions and CPython.
python/cpython#102699 is a CPython issue that is already open that discusses potentially adding this protocol to the CPython standard library. (I'm open to the idea, but I'd want it to stew for a while longer in useful_types before doing so, to see if it achieves widespread adoption, and/or to see if there are any issues with it.)
I'm not sure opening another issue at python/typing would be helpful at this point -- I feel like it existing in useful_types + the CPython issue should cover everything important? :)
Reacted by Sebastian Rittau, Ellie Pratt and Erlend E. Aasland
Oh, sorry! Github shows it when I search: is:issue state:open archived:false author:@me sort:updated-desc. I guess "not planned" is still open afa github is concerned :( Or maybe I misread--anyway, sorry!
Activity
AlexWaygood commentedon Feb 14, 2023
I'm not sure we can expose it any more than we already have.
_typeshedis where we put our types that may also be useful for external consumers. The reason why_typeshedis prefixed with an underscore is because the folder doesn't exist at runtime, so it's only importable inside anif TYPE_CHECKINGblock.After the protocol has been around for long enough to be considered stable, we can maybe consider adding it to
typing/typing_extensions. But I don't think we should do that now; and when it has been around for long enough for it to be considered stable, that conversation will need to happen over at the CPython/typing_extensions repos rather than here.NeilGirdhar commentedon Feb 14, 2023
Yes, I understand. This is just for tracking purposes so that if it is exposed one day, I'll know to update my code.
AlexWaygood commentedon Feb 14, 2023
Okay, but there's nothing actionable for typeshed here, so I'm going to close this for now — sorry, but it's nice to keep our issue list somewhat under control :)
https://github.com/python/typing might be a better place to open an issue to discuss finding a long-term home for this protocol, whether it's CPython, typing_extensions, or some other place entirely :)
gandhis1 commentedon Nov 2, 2023
I don't know how much visibility my comment here is going to get, but I personally have had multiple instances where I've wanted to accept a
DataclassInstance. Typically I do something with the object being passed in, such as calldataclasses.fieldson it. I didn't realize this was importable throughif TYPE_CHECKING, so I ended up copying the protocol to a local utility module. I suspect I'm not the only one writing code like this, and I imagine it could be useful to others if it was exposed in a simple way that is importable both at type-checking time and at runtime.While this anecdote doesn't add much to this conversation, I find that frequently in the typing community features are dismissed as lacking sufficient interest when people don't post about them, belying the actual amount of interest in them.
srittau commentedon Nov 2, 2023
@AlexWaygood I propose we move this to python/typing and reopen, since while there is nothing actionable for typeshed, this is a potential typing feature.
AlexWaygood commentedon Nov 2, 2023
The protocol is now exposed at runtime via https://github.com/hauntsaninja/useful_types, @gandhis1, which is designed as a minimal third-party package exposing typeshed protocols at runtime that are useful to users, and which are possible candidates for inclusion in the CPython standard library in the future. I'm a maintainer of the package, as is @hauntsaninja and @JelleZijlstra -- all three of us are maintainers of typeshed, typing_extensions and CPython.
python/cpython#102699 is a CPython issue that is already open that discusses potentially adding this protocol to the CPython standard library. (I'm open to the idea, but I'd want it to stew for a while longer in
useful_typesbefore doing so, to see if it achieves widespread adoption, and/or to see if there are any issues with it.)I'm not sure opening another issue at python/typing would be helpful at this point -- I feel like it existing in
useful_types+ the CPython issue should cover everything important? :)NeilGirdhar commentedon May 18, 2026
Looks like it's been added to the typshed, so feel free to close this!
AlexWaygood commentedon May 18, 2026
It's been closed for 2.5 years!
NeilGirdhar commentedon May 18, 2026
Oh, sorry! Github shows it when I search:
is:issue state:open archived:false author:@me sort:updated-desc. I guess "not planned" is still open afa github is concerned :( Or maybe I misread--anyway, sorry!