$npx skillfedfor your agent

pytest-examples

Pytest plugin for testing examples in docstrings and markdown files.

Worth itPyPI Python ModulesReleased May 2025594.9K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pytest_examples-0.0.18-py3-none-any.whl
v0.0.18 · released 2025-05-06 · Python >=3.8 · 3 runtime deps: black, pytest, ruff

Yes. The plugin fills a real gap—keeping documentation examples in sync with code—and is actively maintained with no known vulnerabilities. Low install friction and permissive MIT license make it a straightforward addition to any pytest-based test suite. Install if you maintain libraries with documented examples and want them to stay correct.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low friction install with three runtime dependencies (black, pytest, ruff).
  • Active maintenance with recent commits; last release 465 days ago but repository remains actively developed.

License · maintenance · safety

MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions—suitable for most commercial and open-source projects.

last release 2025-05-06 (465 days) · last repo commit 2026-07-13 · 170 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 594,886 downloads/mo, #5,843 on PyPI

Verify before relying

pip install pytest-examples

import pytest
from pytest_examples import find_examples, CodeExample, EvalExample

@pytest.mark.parametrize('example', find_examples('docs'), ids=str)
def test_examples(example: CodeExample, eval_example: EvalExample):
    eval_example.lint(example)
    eval_example.run(example)
  • Whether the plugin works with pytest versions beyond those implicitly tested in CI
  • Performance characteristics when scanning large codebases with many examples
Same gist for agents: .md · .json

What it is and what it does

pytest-examples is a pytest plugin that discovers and validates Python code examples embedded in docstrings and markdown files. It integrates black and ruff to lint examples for style compliance, runs them to verify they execute without error, and can verify that print statements in the code match their expected output (marked with `#>` comments). The plugin can also update examples in place to auto-format code and insert or refresh print statement annotations.

Typical use involves writing a pytest test that parametrizes over examples found in a directory or file, then calling methods like `lint()`, `run()`, `run_print_check()`, or `run_print_update()` on each example. This ensures documentation code stays correct and executable as the underlying library evolves.

Use it for

  • Verify that code examples in API documentation actually run without errors
  • Enforce consistent code style in docstrings and README examples using ruff and black
  • Validate that printed output in documented examples matches what the code actually produces
  • Automatically update and reformat all code examples across a project in one pass
  • Catch broken examples early in CI when documentation is changed alongside code

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

The plugin fills a real gap—keeping documentation examples in sync with code—and is actively maintained with no known vulnerabilities. Low install friction and permissive MIT license make it a straightforward addition to any pytest-based test suite. Install if you maintain libraries with documented examples and want them to stay correct.

Install

pytest-examples on PyPI

Before you install

Low friction install with three runtime dependencies (black, pytest, ruff). Active maintenance with recent commits; last release 465 days ago but repository remains actively developed.

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions—suitable for most commercial and open-source projects.

Quickstart

pip install pytest-examples

import pytest
from pytest_examples import find_examples, CodeExample, EvalExample

@pytest.mark.parametrize('example', find_examples('docs'), ids=str)
def test_examples(example: CodeExample, eval_example: EvalExample):
    eval_example.lint(example)
    eval_example.run(example)

Verify before relying

  • Whether the plugin works with pytest versions beyond those implicitly tested in CI
  • Performance characteristics when scanning large codebases with many examples

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.8
Install frictionLow. Pure-Python wheel
Runtime dependencies
3 packages
blackpytestruff
MaintenanceActively maintained 465 days since the last release
Last repo commit
First released
Downloads594,886 / month, #5,843 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Environment :: ConsoleEnvironment :: MacOS XFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: POSIX :: LinuxOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Evidence: pytest_examples-0.0.18-py3-none-any.whl

Tags

Capabilities
pytest plugin docstring examplestest code examples in docstringsvalidate markdown code blockslint and run embedded python examplescheck print statements in examplesdocstring code testing
Topics
documentation-testingcode-validation

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “pytest plugin docstring examples”

  • pytest-examplesA pytest plugin that finds, lints, runs, and validates Python code…
  • pytest-markdown-docsA pytest plugin that executes Python code snippets embedded in…
  • pytest-cythonA pytest plugin that runs doctests embedded in Cython `.pyx`…

Give your agent the search over MCP, or paste the wish link into any chat.

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also flake8-pytest-style · pytest-doctestplus · pytest-codeblocks · pytest-md · pytest-markdown-docs · doccmd · pytest-ruff · docstring-to-markdown · parametrize · flake8-quotes