Sybil Extras
sybil-extras is a Python library that provides additional parsers and functionalities to Sybil, the documentation testing tool. It extends Sybil's capabilities to handle more complex documentation formats and integrations, such as MyPy documentation and advanced reStructuredText features. The library is actively maintained with frequent releases, currently at version 2026.3.1.6.
Common errors
-
ImportError: cannot import name 'DOCUTILS_RST' from 'sybil_extras.parsers.rst'
cause The `sybil-extras` library or its specific parsers were not correctly installed, or the import path is incorrect. It may also mean the optional dependency `docutils` is missing.fixEnsure `sybil-extras` is installed (`pip install sybil-extras`) and that `docutils` is also installed (`pip install docutils`). Verify the import statement matches the library's structure (e.g., `from sybil_extras.parsers.rst import DOCUTILS_RST`). -
sybil.exceptions.SybilError: Error running example: Command failed (exit code ...)
cause An example within your documentation failed to execute correctly, possibly due to a parsing issue introduced by `sybil-extras` (especially in older versions) or an error in the example code itself.fixFirst, check the example code for correctness. If `DOCUTILS_RST` or `mypy_docs` are involved, consider updating `sybil-extras` to the latest version (>=2026.03.01.3 for RST issues, >=2026.03.01.1 for MyPy issues) and ensure all required dependencies are met. Inspect the full traceback for more specific details on the command that failed.
Warnings
- gotcha Older versions of `sybil-extras` (prior to 2026.03.01.1) might have incorrectly applied `--example-workers 0` to all MyPy documentation examples, potentially causing unexpected behavior or errors if MyPy examples were not designed for single-worker execution.
- breaking In versions prior to 2026.03.01.3, the `DOCUTILS_RST` parser could crash when encountering reStructuredText `include` directives or did not support Sphinx Jinja2 syntax within RST files.
- gotcha Ensure all necessary underlying parsers (like `docutils` for `DOCUTILS_RST` or `mypy` for `mypy_docs`) are installed as optional dependencies. Missing these will lead to import errors or runtime failures when their respective parsers are used.
Install
-
pip install sybil-extras
Imports
- DOCUTILS_RST
from sybil_extras.parsers.rst import DOCUTILS_RST
- mypy_docs
from sybil_extras.parsers.myst import mypy_docs
Quickstart
import pytest
from sybil import Sybil
from sybil_extras.parsers.rst import DOCUTILS_RST
README = Sybil(
parsers=[DOCUTILS_RST], # Example using a sybil-extras parser
patterns=["*.rst"],
fixtures=["tmp_path"],
)
@pytest.mark.parametrize("sybil", [README], ids=str)
def test_documentation(sybil):
sybil.run()