skillfed

sybil

Automated testing for the examples in your code and documentation.

sybil v10.1.0 572.3K downloads/30d#5,946 on PyPI91
Permissive license MIT Active released

What it is and what it does

Sybil is a testing library that extracts code examples from your documentation and source files, then runs them as part of your test suite. Instead of manually keeping examples in sync with your code, Sybil parses them directly from their source (reStructuredText, Markdown, or other formats) and validates that they execute correctly. This catches documentation rot early—when an API changes, the tests fail immediately if examples become outdated.

The library integrates with standard Python test runners, so examples run alongside your unit tests with no special setup. It has no external runtime dependencies, making it lightweight to add to any project. It's designed for developers who want their documentation to be a reliable, executable specification rather than prose that drifts out of sync with the code.

Use it for:

  • Validate code snippets in API documentation to ensure they remain correct as the codebase evolves
  • Test example scripts embedded in README or tutorial files as part of CI/CD
  • Verify that code samples in docstrings and reStructuredText files actually run without errors
  • Catch breaking changes early by running documented examples in your test suite
  • Maintain a single source of truth for examples instead of duplicating them in tests and docs

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Sybil parses and executes code examples embedded in your source code and documentation as part of your normal test suite, validating that documented examples actually work.

Yes. Sybil fills a real gap: keeping documentation examples in sync with code. It has no dependencies, low install friction, active maintenance, a permissive license, and solves a concrete problem that affects most projects with substantial documentation. The only reason not to install is if you have no documented examples to validate.

Install

sybil on PyPI

pip

pip install sybil

uv

uv add sybil

poetry

poetry add sybil

Installing sybil

Before you install

Low friction: pure Python wheel with no runtime dependencies. Actively maintained as of 62 days ago with recent commits. Requires Python 3.11 or later.

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.

Quickstart

pip install sybil

from sybil import Sybil
from sybil.parsers.rest import CodeBlockParser

examples = Sybil([CodeBlockParser()], pattern='*.rst')

Requires Python 3.11 or later.

Verify before relying

  • Whether Sybil supports all major test runners (pytest, unittest, nose) or only a subset
  • Whether it can extract examples from formats beyond reStructuredText and Markdown
  • Performance characteristics when running large numbers of examples

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 62 days since the last release
Last repo commit
First released
Downloads 572,260/month — #5,946 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sybil-10.1.0-py3-none-any.whl

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3

Tags

documentation example testingcode snippet validationdoctest alternativeexample verification in docsautomated example testingparse and run code examplesdocumentation correctness
documentation-testingexample-validation

More Testing packages