-
Notifications
You must be signed in to change notification settings - Fork 32
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
typing.{io,re}
missing in 3.10
#117
Comments
Thanks for the report @gmesch! Could you say a bit more about the "awkward way"? This may be something we are able to patch in the module collection script. |
I only read the 3.10 implementation of
Here is the code that creates the
|
Thanks for digging into it! Hmm, this is indeed pretty awkward -- our generation tooling uses >>> import typing.io
>>> import inspect
>>> inspect.ismodule(typing.io)
False I'm not 100% sure to do about that -- |
I also poked at this a bit, read some docs, and the best idea I could come up with was to snapshot Missing |
Yeah, I should really write that policy 😅. I've got some time today, so I'll send a PR for it in a bit.
I think this would work, although it still wouldn't pass the |
@gmesch I'm thinking about ways to address this. One possibility is us adding a new API, something like
This would make things like |
We use this in a tool that computes the dependencies of python programs on pip packages from the So if just matching the prefix would be correct, we don't need a new API for that, we can just check all prefixes of an imported module name, in addition to the full module name, using the current API. However, I think that would be wrong, because I think that a pip package can supply its modules in a namespace package that shares a path prefix with modules in the standard library. I.e. I think it would be legitimate if e.g. a pip package |
FWIW, the approach to import each file found in the standard library and capture the delta in the I.e. I just want to know whether an |
Btw. I also took note of the hint in the documentation,
But I could not quite decide which of the two would be right, and I detected already this discrepancy:
I doublechecked that the file So it did not seem to be straightforward to just use |
Thanks for the responses @gmesch!
Yeah, this is unfortunately true: >>> sys.modules['os.lol'] = object()
>>> from os import lol
>>> lol
<object object at 0x1023f9e90> This is arguably something that packages should never do, but Python is too dynamic to prevent it. Notably, this also means that any amount of >>> import sys
>>> sys.modules['os'] = object()
>>> import os
>>> os
<object object at 0x1049305e0> In other words, you can't (perfectly) infer that a package isn't loaded just because it wasn't imported by a non-stdlib
Yeah,
So unfortunately you can't use it for specific sub-packages/modules 🙁 -- it's really just meant for a top-level check. TL;DR: I'm not of aware of a sound way to guarantee that |
The modules
typing.io
andtyping.re
are missing in3.10
. They are present only in3.8
and nowhere else, even though they exist at least in3.10
, albeit created in an awkward way.The text was updated successfully, but these errors were encountered: