docutils-stubs provides PEP 561 type stubs for the docutils library, enabling static type checking tools like MyPy to verify code that uses docutils. It helps catch type-related errors before runtime. The current version is 0.0.22, with releases typically following updates to the underlying docutils library or bug fixes.
pip install docutils-stubsVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to use `docutils.core.publish_string` to convert reStructuredText to HTML. When `docutils-stubs` is installed alongside `docutils`, type checkers like MyPy will be able to provide accurate type analysis for calls to `publish_string` and other docutils functions, even though the import statement targets `docutils` directly.
Ensure both `docutils` and `docutils-stubs` are in your environment: `pip install docutils docutils-stubs`.
Always import symbols from the original `docutils` package (e.g., `from docutils.core import publish_string`). The type checker will automatically pick up the stubs.
Check the `docutils-stubs` GitHub repository for updates or open an issue if you encounter missing types for stable `docutils` features.
Run `pip install docutils` in addition to `pip install docutils-stubs`.
Change your import statement to `from docutils.core import publish_string`. Stub packages are not meant for runtime imports.
Ensure both `docutils` and `docutils-stubs` are up-to-date (`pip install --upgrade docutils docutils-stubs`). If the issue persists for a standard feature, consider reporting it on the `docutils-stubs` GitHub page.