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

Some modules missing #7

Closed
takluyver opened this issue Oct 17, 2017 · 12 comments
Closed

Some modules missing #7

takluyver opened this issue Oct 17, 2017 · 12 comments

Comments

@takluyver
Copy link

Thanks, this is a really useful project. However, I've just tried classifying a list of loaded modules, and there are a number of standard library modules which weren't picked up. I think these are ones which aren't listed in the docs.

A few selected examples (there are others):

_hashlib
email.feedparser
encodings
encodings.utf_8
importlib._bootstrap
json.decoder
posixpath
sqlite3.dbapi2
sre_compile
typing.io  # Not a real module, but in sys.modules
xml.parsers

Maybe the answer is that the undocumented modules are out of scope for this project. I don't know of a good way to get a list including the undocumented ones. But it would be useful for my purposes to have such a list, so I'd be interested if we can figure out a way.

@takluyver
Copy link
Author

Also a number of asyncio modules, such as asyncio.tasks.

@thebjorn
Copy link

I've collected some more modules (many, but not all of the ones you're listing) in https://github.com/thebjorn/pydeps/blob/master/pydeps/pystdlib.py

I'd love it if python-stdlib-list could be the "one true list" :-)

@takluyver
Copy link
Author

Thanks! Did you collect them manually, or are they the result of some automated process?

@thebjorn
Copy link

The pydeps tool analyzes a module's Python import graph and IIRC I compared the found modules' __file__ attribute with sys.prefix (so sort of automated, but relying on which modules the inspected code imports).

@takluyver
Copy link
Author

Maybe one option would be to install Python in a controlled way, and then go through the files it puts in the stdlib directory? Then there's sys.builtin_module_names to add to that. And if an automated process can do 99%, maybe the corner cases can be added by hand.

@jackmaney
Copy link
Contributor

Good catch!

Yes, it seems as though it'll be necessary to go through the site-packages directory on fresh installs, as well as look at sys.builtin_module_names to help fill in those gaps. This week is a busy one, so I'll put something together this weekend.

@takluyver
Copy link
Author

Thanks Jack :-)

@takluyver
Copy link
Author

I've refined the tool I'm working on a bit more, and I thought that a longer list of stdlib modules it's currently missing might be useful for testing:

https://gist.github.com/takluyver/ddf61f88ad84ca458cf073f67a656019

It's split into two parts: modules which have __file__ and modules which don't (builtins, dynamically defined modules, maybe namespace packages).

@takluyver
Copy link
Author

Any progress? Do you want me to try to have a look at this?

@takluyver
Copy link
Author

If anyone's curious what I'm using this for, I'm trying to capture the modules loaded by an application, and then group them according to where they came from:

https://pypi.python.org/pypi/kartoffel

@woodruffw
Copy link
Member

From a quick look, all of the modules originally listed (except for typing.io) are now included in the 3.9 listing; I'll make a new release to propagate that shortly.

Some of the others in the longer gist are still missing, though. Not sure what to do about those yet; open to ideas.

@woodruffw
Copy link
Member

Folding this under #80.

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

No branches or pull requests

4 participants