List of packages in the stdlib
Project description
stdlibs
Simple list of top-level packages in Python's stdlib
Note: If you only need the live module names on 3.10+, just use
sys.stdlib_module_names
. This is not exactly a backport, but a static list of
those for most useful Python versions.
If someone wants to add alternate runtimes, PRs welcome.
Usage
Currently stdlibs.module_names
is stdlibs.py3.module_names
-- the top-level
names that are valid in some version of py3 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
Install
You can install it from PyPI:
$ pip install stdlibs
Regenerating
If you need to regenerate the list, install libcst, add the url to
stdlibs/fetch.py
, and run that file. Make sure any new versions are added to
KNOWN_VERSIONS
.
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.2.2.tar.gz
.
File metadata
- Download URL: stdlibs-2022.2.2.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc03d51e0a29fb727ce89a22b71424fe8ab7856f186c9d1281457443ed8facc0 |
|
MD5 | 14553a249fcac9095ed69cd691d2695e |
|
BLAKE2b-256 | 1a164caf7fe5649536fa987b6832ba08e6096b2e9fab3e94caaaf089eff70e59 |
File details
Details for the file stdlibs-2022.2.2-py3-none-any.whl
.
File metadata
- Download URL: stdlibs-2022.2.2-py3-none-any.whl
- Upload date:
- Size: 46.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.27.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab08f11e6e523a8b7b0bcba490bf2de2452e1b2f5c1299f070727ebf5f1f7914 |
|
MD5 | 46335e1f4248e6929a7aed657a3861b2 |
|
BLAKE2b-256 | 09ea03eb0425e8a4c0f665fc995d8613454e8c3489722b1f612831f4a481a175 |