Breathe
Breathe is a Sphinx plugin that provides a bridge between the Sphinx documentation system and Doxygen's XML output. It allows users to integrate Doxygen's comprehensive technical documentation of C, C++, and other languages directly into Sphinx-generated documentation, offering an 'autodoc'-like experience for non-Python projects. The current stable version is 4.36.0, with releases typically occurring a few times a year to maintain compatibility with Sphinx and Doxygen updates.
Warnings
- breaking Breathe v4.36.0 and later require Python 3.9 or higher. Earlier versions supported Python 3.7+ (e.g., v4.35.0). Projects on older Python versions will need to upgrade Python or pin Breathe to an older compatible version.
- breaking Breathe v4.36.0 and later require Sphinx 7.2 or higher. Earlier versions had compatibility with older Sphinx versions (e.g., v4.35.0 added support for Sphinx 6, fixed tests for Sphinx 5.3). Ensure your Sphinx installation meets this requirement.
- gotcha Breathe relies entirely on Doxygen's XML output. If Doxygen is not run correctly with `GENERATE_XML = YES` enabled in its configuration file (Doxyfile), Breathe will not find any documentation to render.
- gotcha Incorrectly configured `breathe_projects` paths or `breathe_default_project` names are common sources of 'project not found' or 'file not found' errors. The paths must be absolute or correctly relative to `conf.py`.
- gotcha While v4.36.0 is the current stable release, alpha versions like `v5.0.0a2` are available. Installing without version pinning (`pip install breathe`) may lead to unexpected changes or instabilities if a new major alpha becomes the 'latest' on PyPI.
Install
-
pip install breathe
Imports
- breathe
extensions = ['sphinx.ext.autodoc', 'breathe']
Quickstart
# 1. In your Doxyfile (generated by Doxygen -g), ensure:
# GENERATE_XML = YES
# 2. In your Sphinx conf.py:
import os
project = 'MyProject'
copyright = '2026, MyName'
author = 'MyName'
extensions = [
'sphinx.ext.autodoc',
'breathe'
]
# Path to the directory containing Doxygen's XML output
breathe_projects = {
"myproject": os.path.abspath(os.path.join(os.path.dirname(__file__), "_build/doxygen/xml"))
}
breathe_default_project = "myproject"
# 3. In an .rst file (e.g., index.rst or a new file like api.rst):
# .. doxygenclass:: MyNamespace::MyClass
# :project: myproject
# :members:
#
# .. doxygenfunction:: my_function(int, int)
# :project: myproject