stdlibs: Python Standard Library Module Listing
The `stdlibs` Python package (also known as `stdlib-list` on GitHub) provides a static, programmatic listing of modules in the Python standard library. It offers lists for various Python major releases, dating back to Python 2.3, and combined lists for all 3.x or 2.x modules. This package is primarily used by tools for static analysis, linting, and other applications that need an authoritative, historical record of standard library module names. As of version 2026.2.26, it continues to track changes in the CPython standard library and appears to follow a date-based release cadence, indicating active maintenance.
Warnings
- gotcha For Python 3.10 and newer, the built-in `sys.stdlib_module_names` attribute provides a list of standard library modules for the *currently running* interpreter. The `stdlibs` package remains valuable for historical data, cross-version analysis, or pre-release listings, but might be redundant for simple runtime introspection on newer Python versions.
- breaking The actual Python standard library is dynamic across major versions. Python 3.11, 3.12, and 3.13 notably removed many legacy modules (e.g., those specified in PEP 594). The `stdlibs` package accurately reflects these removals in its version-specific lists (e.g., `stdlibs.py313` will not contain removed modules). Developers performing static analysis across Python versions must account for these module deprecations and removals, as code relying on removed modules will break in newer environments.
Install
-
pip install stdlibs
Imports
- module_names
import stdlibs print(stdlibs.module_names)
- py_module_names
import stdlibs print(stdlibs.py310)
Quickstart
import stdlibs
# Get a list of all module names ever available in Python 3.x
all_py3_modules = stdlibs.py3_all
print(f"Total Python 3.x modules recorded: {len(all_py3_modules)}")
# Get the list of modules for a specific Python version (e.g., Python 3.9)
py39_modules = stdlibs.py39
print(f"Python 3.9 modules: {py39_modules[:5]}...")
# Check if a module exists in a specific version
is_asyncio_in_py34 = 'asyncio' in stdlibs.py34
print(f"Is 'asyncio' in Python 3.4 stdlib? {is_asyncio_in_py34}")