Registry / type-stubs / types-docutils

types-docutils

JSON →
library0.23.0.20260827pypypi✓ verified 27d ago

types-docutils provides high-quality type hints and stub files for the docutils library, enabling static type checkers like MyPy to validate code that uses docutils. It's part of the typeshed project, which maintains external type stubs for various popular Python packages. The current version is 0.22.3.20260408, with releases tied to updates in typeshed.

pip install types-docutils
INSTALL
IMPORT
SIG · TYPES-DOCUTILS
T
types-docutils
type-stubspythonv0.23.0.20260827
Install
1.6s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.23.0.20260827 · 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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

publish_string
from docutils_stubs.core import publish_string
from docutils-stubs.core import publish_string

This quickstart demonstrates a basic usage of the docutils library. When types-docutils is installed, a static type checker like MyPy can analyze this code for type consistency and errors, ensuring that docutils functions are called with correct arguments and their return values are handled appropriately.

import os from docutils.core import publish_string # Example RST document rst_document: str = """ .. role:: red :red:`This is red text.` .. admonition:: Note This is an admonition block. """ # publish_string is a core docutils function to process RST # With types-docutils installed, type checkers can validate the arguments and return type. html_output: str = publish_string( source=rst_document, writer_name="html", settings_overrides={'initial_header_level': 2} ) print("Generated HTML snippet (first 200 chars):\n", html_output[:200]) # To see type checking in action, save this to 'app.py' # and run 'mypy app.py' after 'pip install types-docutils docutils mypy'. # Introduce a deliberate error, e.g., 'writer_name=123', and mypy will flag it.
Debug
Known issues
gotchatypes-docutils only provides type stubs, not the docutils library itself. You must install the actual 'docutils' package separately for your code to run.
fix
Ensure you have 'pip install docutils' in your environment alongside 'pip install types-docutils'.
affects: All
gotchatypes-docutils is meant for static analysis (e.g., with MyPy) and does not need to be imported directly in your runtime code. Its presence in your environment is sufficient for type checkers.
fix
Do not add 'import types_docutils' statements to your Python files. Your imports should only target the 'docutils' library itself.
affects: All
gotchaThe versioning scheme for typeshed stubs includes both the library version and a date component (e.g., 0.22.3.20260408). This can sometimes lead to confusion regarding direct compatibility with specific docutils release versions.
fix
Refer to the typeshed repository for 'docutils' stubs for detailed compatibility notes with specific 'docutils' runtime versions if you encounter type checking issues.
affects: All
gotchaThis package requires Python 3.10 or higher. Using it with older Python versions might lead to installation failures or incorrect type checking behavior.
fix
Ensure your project's Python interpreter is version 3.10 or newer. You can check with `python --version`.
affects: <3.10
Upgrade
Version history
0.23.0.20260827latest on PyPI · released Aug 27, 2026
Audit
Dependencies
docutilsoptionalThis package provides type stubs for the 'docutils' library. For the stubs to be useful for runtime execution and full type checking, 'docutils' itself must be installed.
Agent activity
25 hits · last 30 days
node
22
OpenAI (training)
1
Resources
types-docutils — pip install types-docutils · libregistry