List of packages in the stdlib
Project description
stdlibs
Simple list of top-level packages in Python's stdlib
This package provides a static listing of all known modules in the Python standard library, with separate lists available for each major release dating back to Python 2.3. It also includes combined lists of all module names that were ever available in any 3.x release, any 2.x release, or both.
Note: On Python versions 3.10 or newer, a list of module names for the active runtime
is available sys.stdlib_module_names
. This package exists to provide an historical
record for use with static analysis and other tooling.
This package only includes listings for CPython releases. If other runtimes would be useful, open an issue and start a discussion on how best that can be accomodated.
Install
You can install it from PyPI:
$ pip install stdlibs
Usage
The recommended usage is to reference stdlibs.module_names
— the top-level
names that are valid in some version of Python 3.x on some platform. This is a
superset of top-level names you may have, and a superset of those in
sys.stdlib_module_names
.
>>> from stdlibs import module_names
>>> print("os" in module_names)
True
>>> print("peg_parser" in module_names) # 3.9+
True
If you need a specific version, those are available as other modules:
>>> from stdlibs.py36 import module_names as module_names_py36
>>> print("os" in module_names_py36)
True
>>> print("peg_parser" in module_names_py36)
False
If you intend to process more than one version, you may find the string api easier:
>>> from stdlibs import stdlib_module_names, KNOWN_VERSIONS
>>> [v for v in KNOWN_VERSIONS if "dataclasses" in stdlib_module_names(v)]
['3.7', '3.8', '3.9', '3.10', '3.11']
>>>
>>> sorted(stdlib_module_names("3.7") - stdlib_module_names("3.6"))
['_abc', '_contextvars', '_py_abc', '_queue', '_uuid', '_xxtestfuzz', 'contextvars', 'dataclasses']
>>>
>>> from moreorless.click import unified_diff
>>> prev = None
>>> buf = []
>>> for v in KNOWN_VERSIONS:
... cur = ''.join([f"{name}\n" for name in sorted(stdlib_module_names(v))])
... if prev:
... buf.append(unified_diff(prev, cur, f"new-in-{v}"))
... prev = cur
>>> print(''.join(''.join(buf).splitlines(True)[:10]), end='')
--- a/new-in-2.4
+++ b/new-in-2.4
@@ -19,7 +19,6 @@
DocXMLRPCServer
ERRNO
EasyDialogs
-FCNTL
FILE
FL
FileDialog
Regenerating
Add or update the list of releases and download URLs in stdlibs/fetch.py
, then
execute the stdlibs.fetch
module:
$ make distclean virtualenv
$ source .venv/bin/activate
(.venv) $ python -m stdlibs.fetch
License
stdlibs is copyright John Reese, and licensed under
the MIT license. I am providing code in this repository to you under an open
source license. This is my personal repository; the license you receive to
my code is from me and not from my employer. See the LICENSE
file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file stdlibs-2022.6.8.tar.gz
.
File metadata
- Download URL: stdlibs-2022.6.8.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa978cbf5105474a416c515e82752a8a3d833f4513977da0a6a599a3e608b438 |
|
MD5 | 002e3a2cf9956f62b80457b05c169a7e |
|
BLAKE2b-256 | b20f4c76898030f5c688f3dec7129a15e0d90352c6be6b996c14d37373654869 |
File details
Details for the file stdlibs-2022.6.8-py3-none-any.whl
.
File metadata
- Download URL: stdlibs-2022.6.8-py3-none-any.whl
- Upload date:
- Size: 49.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79abd3966d80b3eb5edb6ec4be5a57b7c97ae6402dadaa52180983d13d46dc50 |
|
MD5 | 64639b1d26dffd6519003d802377cabd |
|
BLAKE2b-256 | c283922bd8c3019372cad696acc07abbb37625eafad7e38eae098d1fa26def56 |