Python Standard Library List
A Python library that provides lists of all standard library modules for various Python versions (currently 2.7 through 3.14). It is actively maintained with updates for new Python releases. This library is particularly useful for static analysis and tooling that needs to differentiate between standard library and third-party modules. For Python 3.10 and newer, `sys.stdlib_module_names` offers similar functionality.
Warnings
- gotcha For Python 3.10 and newer, Python's built-in `sys.stdlib_module_names` and `sys.builtin_module_names` provide similar functionality to identify standard library modules. This library might be redundant for such environments if only the currently running Python's stdlib list is needed.
- breaking Support for Python 3.7 and 3.8 was dropped starting from `stdlib-list` version 0.11.0. Users on these Python versions will need to use an older `stdlib-list` version.
- deprecated The `types-stdlib-list` package is a separate type stub package that becomes unnecessary for `stdlib-list` versions 0.9.0 and newer, as type annotations are now included directly in the main library.
- gotcha The `stdlib-list` project was originally archived by its creator after version 0.8.0. It was subsequently transferred to the `pypi` organization and is now actively maintained by new contributors. While the transition was managed to ensure continuity, it's a historical note if referencing very old documentation or issues.
Install
-
pip install stdlib-list
Imports
- stdlib_list
from stdlib_list import stdlib_list
Quickstart
from stdlib_list import stdlib_list
# Get a list of standard library modules for Python 3.9
libraries_3_9 = stdlib_list("3.9")
print(f"Python 3.9 stdlib modules (first 5): {libraries_3_9[:5]}")
# Get a list for the latest supported Python version (e.g., 3.14 in v0.12.0)
libraries_latest = stdlib_list("3.14")
print(f"Python 3.14 stdlib modules (first 5): {libraries_latest[:5]}")
# Check if a module is in the standard library for a specific version
is_os_in_3_9 = "os" in libraries_3_9
print(f"'os' in Python 3.9 stdlib: {is_os_in_3_9}")