Registry / devops / mkdocstrings-python-legacy

mkdocstrings-python-legacy

JSON →
library0.2.7pypypiunverified

mkdocstrings-python-legacy is a Python handler for the mkdocstrings documentation generator. It facilitates the automatic collection of documentation from Python source code, relying on `pytkdocs` for data extraction. The handler supports popular docstring styles like Google, Numpydoc, and reStructuredText. While actively maintained, receiving updates as recently as May 2025, it is considered a legacy component, and users are strongly advised to migrate to the newer `mkdocstrings-python` handler, which offers improved functionality based on Griffe.

pip install mkdocstrings-python-legacy
INSTALL
IMPORT
SIG · MKDOCSTRINGS-PYTHO
M
mkdocstrings-python-legacy
devopspythonv0.2.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

To use mkdocstrings-python-legacy, first ensure it's installed. Then, configure your `mkdocs.yml` file to include `mkdocstrings` in the plugins section and specify the `python` handler within `mkdocstrings.handlers`. You'll need to define `paths` to indicate where your Python source code is located. Once configured, you can inject documentation into your Markdown files using the `:::` syntax, followed by the Python object's dotted path.

# mkdocs.yml plugins: - mkdocstrings: handlers: python: paths: [src] # Adjust to your source code directory options: docstring_style: google # or numpy, restructured-text members: !docstrings_replace # Example: show only documented members # docs/index.md # ::: my_package.my_module
Debug
Known issues
deprecatedThis handler is considered legacy. Users are strongly recommended to migrate to the newer `mkdocstrings-python` handler for improved features and future compatibility, which is based on Griffe.
fix
Install `mkdocstrings-python` (e.g., `pip install mkdocstrings-python` or `pip install 'mkdocstrings[python]'`) and update your `mkdocs.yml` configuration to use the new handler.
affects: All versions
breakingSupport for Python 3.8 has been dropped. Ensure you are running Python 3.9 or newer.
fix
Upgrade your Python environment to version 3.9 or higher.
affects: >=0.2.5
gotchaWhen using Numpy-style docstrings, having a 'Methods' section within a class docstring can lead to parsing issues.
fix
Avoid including a 'Methods' section directly within class-level Numpy-style docstrings. Refer to the `pytkdocs` documentation for full details or restructure your docstrings.
affects: All versions
gotchaFor code blocks within docstrings or admonitions to render correctly, the `pymdownx.superfences` Markdown extension must be enabled. Newlines within docstring code blocks may also require escaping.
fix
Add `pymdownx.superfences` to your `markdown_extensions` in `mkdocs.yml`. For code blocks in docstrings, use raw strings (prefix with `r`) or escape newlines (e.g., `\n` instead of `\n`).
affects: All versions
Errors
Common errors & fixes
Some objects are not rendered (they do not appear in the generated docs)
Incorrect configuration of handler options, incorrectly formatted docstrings, or Python modules not being discoverable (e.g., missing `__init__.py` files or incorrect `paths` setting).
fix
Verify `mkdocs.yml` handler options. Ensure docstrings follow a supported style. Add `__init__.py` to directories containing modules. Configure the `paths` option in `mkdocs.yml` to point to your source code directory (e.g., `paths: [src]`). Run `mkdocs build -v` for verbose output.
WARNING - Documentation file 'reference/parsers/docstrings.md' contains a link to 'reference/parsers/pytkdocs.parsers.docstrings.Section' which is not found in the documentation files.
A cross-reference link in your Markdown uses parentheses `()` instead of brackets `[]`.
fix
Change cross-references from `[Title](path.to.object)` to `[Title][path.to.object]` or `[path.to.object][]` for automatic linking.
mkdocstrings not finding module
The Python handler cannot locate your Python packages or modules. This is often due to an incorrect `paths` configuration in `mkdocs.yml` or an improperly set `PYTHONPATH` environment variable.
fix
Explicitly configure the `paths` option under the `python` handler in your `mkdocs.yml` (e.g., `paths: [src]`). Ensure this path is relative to your `mkdocs.yml` file. Alternatively, ensure your `PYTHONPATH` environment variable correctly points to your project's source root or install your package in the environment.
Upgrade
Version history
0.2.7latest on PyPI · released May 22, 2025
Audit
Dependencies
mkdocstringsrequiredCore dependency for integrating documentation generation.
pytkdocsrequiredUsed by the legacy handler for collecting Python object documentation.
PythonrequiredRequires Python 3.9 or newer.
pytkdocs[numpy-style]optionalRequired for parsing Numpy-style docstrings.
Agent activity
6 hits · last 30 days
node
6
Resources
mkdocstrings-python-legacy — pip install mkdocstrings-python-legacy · libregistry