Python Docs Theme
The Sphinx theme for the CPython docs and related projects. It provides a clean, responsive design and includes features like a dark mode, code copy buttons, and internationalization support. The library is actively maintained with frequent releases, typically on a monthly or bi-monthly cadence. The current version is 2026.3.
Common errors
-
Theme error: no theme named 'python_docs_theme' found (missing theme.conf?)
cause The `python-docs-theme` package is either not installed in the Sphinx build environment or `html_theme` is misspelled in `conf.py`.fixEnsure the theme is installed with `pip install python-docs-theme` and that `html_theme = 'python_docs_theme'` is correctly set in your `conf.py` file. -
ValueError: The 'python-docs-theme' requires Python 3.12 or newer.
cause Attempting to build documentation with `python-docs-theme` version 2025.4 or newer using a Python interpreter older than 3.12.fixUpgrade your Python environment to 3.12 or a later version, or if unable to upgrade, pin the theme version to `python-docs-theme<2025.4`. -
Theme error: The 'python-docs-theme' requires Sphinx 7.3 or newer.
cause Attempting to build documentation with `python-docs-theme` version 2025.4 or newer using a Sphinx version older than 7.3.fixUpgrade your Sphinx installation to 7.3 or a later version using `pip install -U Sphinx`, or if unable to upgrade, pin the theme version to `python-docs-theme<2025.4`.
Warnings
- breaking Version 2025.4 and newer dropped support for Python 3.10 and 3.11.
- breaking Version 2025.4 and newer requires Sphinx 7.3 or newer.
- gotcha The behavior of code block copy buttons was enhanced across versions. Initially, they appeared on hover/click (2025.5), then specifically enabled for shell sessions and consoles (2026.2).
- gotcha Custom configurations for `html_sidebars`, `html_theme_path`, or `html_theme_config` in `conf.py` can interfere with the theme's default layout and features.
Install
-
pip install python-docs-theme
Imports
- html_theme
html_theme = 'python_docs_theme'
Quickstart
mkdir my_docs cd my_docs sphinx-quickstart # Follow prompts, choose 'y' for separate source/build, 'y' for autodoc # Edit source/conf.py (or conf.py directly if not using separate source/build) # Add or modify the following line: # html_theme = 'python_docs_theme' # Create a simple reStructuredText file (e.g., source/index.rst) # .. toctree:: # :maxdepth: 2 # :caption: Contents: # # intro # Create source/intro.rst # My First Page # ============ # # Hello, world! This is my first page using the Python Docs Theme. make html # or sphinx-build -b html source build