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)
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']
>>>
>>> sorted(stdlib_module_names("3.7") - stdlib_module_names("3.6"))
['_abc', '_contextvars', '_py_abc', '_queue', '_uuid', '_xxtestfuzz', 'contextvars', 'dataclasses']
>>>
>>> from moreorless.click import echo_color_unified_diff
>>> prev = None
>>> for v in KNOWN_VERSIONS:
... cur = ''.join([f"{name}\n" for name in sorted(stdlib_module_names(v))])
... if prev:
... echo_color_unified_diff(prev, cur, f"new-in-{v}")
... prev = cur
--- a/new-in-2.4
+++ b/new-in-2.4
@@ -19,7 +19,6 @@
DocXMLRPCServer
ERRNO
EasyDialogs
-FCNTL
FILE
FL
FileDialog
<snip>
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
Hashes for stdlibs-2021.3.30-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddd003c50e974fc20247d3dfaaca1d7d29ba27718c9fbf3c587f91244a92761e |
|
MD5 | a45f51e33c3a1c8a25a6e2293de4fcf6 |
|
BLAKE2b-256 | 68e619026aa1dda7c723421c15737b44b4eac49b8d2a6a24dd825d4e51603c95 |