Install & Compatibility
Where this runs
tested against v0.0.16 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.062s · 18MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.058s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
parse
✓ from docstring_parser import parse
✗ from docstring_parser_fork import parse
Despite the package name 'docstring-parser-fork', the import path remains 'docstring_parser' for compatibility with the upstream library.
DocstringStyle
✓ from docstring_parser import DocstringStyle
Used to specify or infer docstring styles during parsing.
This example demonstrates how to parse a function's docstring using the `parse` function and access its components like short description, long description, parameters, and raised exceptions. The `DocstringStyle.AUTO` option attempts to automatically detect the docstring format.
from docstring_parser import parse, DocstringStyle
def example_function(name: str, priority: int = 1) -> None:
"""
Short description.
Long description spanning multiple lines
- First line
- Second line
- Third line
:param name: description 1
:param int priority: description 2
:raises ValueError: if name is invalid
"""
pass
docstring = parse(example_function.__doc__, style=DocstringStyle.AUTO)
print(f"Short description: {docstring.short_description}")
print(f"Long description: {docstring.long_description}")
for param in docstring.params:
print(f"Param: {param.arg_name}, Type: {param.type_name}, Description: {param.description}")
for rais in docstring.raises:
print(f"Raises: {rais.type_name}, Description: {rais.description}")
Debug
Known issues
gotchaThis library is a fork of `docstring_parser` and shares the same import path (`from docstring_parser import ...`). If both the original `docstring_parser` and `docstring-parser-fork` are installed, unexpected behavior or conflicts may occur due to Python's import resolution order.fixEnsure only one of the two libraries (`docstring_parser` or `docstring-parser-fork`) is installed in your environment to avoid import collisions.
affects: All versions
breakingThe fork explicitly fixes bugs and offers additional functionalities compared to the upstream `docstring_parser`. While intended as improvements, users migrating from the original library should review the `CHANGELOG.md` file for entries marked '(Fork)' to understand specific behavioral changes that might affect existing code relying on previous `docstring_parser` quirks or omissions.fixConsult the `CHANGELOG.md` in the project repository for detailed differences and adjust code as necessary, especially for edge cases in docstring parsing that the fork may now handle differently or correctly.
affects: All versions when migrating from original `docstring_parser`
gotchaWhen parsing attribute docstrings, the `parse_from_object` function currently only supports attributes defined at class and module levels. Attribute docstrings defined within `__init__` methods are not supported. Additionally, when given a class, only attribute docstrings of that specific class are parsed, not inherited ones.fixFor attribute docstrings in `__init__`, consider moving them to class or module level, or using direct `__doc__` attributes where possible. For inherited attributes, separate calls to `parse_from_object` for parent classes are required if their attribute docstrings are needed.
affects: All versions
Errors
Common errors & fixes
ImportError: cannot import name 'DocstringAttr' from 'docstring_parser.common'
Both the original `docstring_parser` library and `docstring-parser-fork` are installed in the same environment, and Python's import resolution order leads to the original library being loaded, which lacks fork-specific features like 'DocstringAttr'.
fixEnsure only one of the two libraries (`docstring_parser` or `docstring-parser-fork`) is installed in your environment by uninstalling the unwanted version (e.g., `pip uninstall docstring_parser` or `pip uninstall docstring-parser-fork`).
ModuleNotFoundError: No module named 'docstring_parser_fork'
The user is attempting to import the library using its installation package name (`docstring_parser_fork`) rather than its actual internal module name (`docstring_parser`).
fixThe correct import statement is `from docstring_parser import parse` (or other components like `DocstringStyle`).
docstring parsing throws errors at runtime for misformatted docstrings
The docstring being parsed does not strictly adhere to one of the supported formats (reStructuredText, Google, Numpydoc, Epydoc), or attempts to parse unsupported constructs like attribute docstrings defined within `__init__` methods.
fixReview the docstring format to ensure it conforms to the supported styles. For attribute docstrings in `__init__` methods, consider moving them to class or module level, or using direct `__doc__` attributes.
Upgrade
Version history
0.0.16latest on PyPI · released Jul 3, 2026
Audit
Dependencies
No dependency data recorded yet.