$npx skillfedfor your agent

xdoctest

A rewrite of the builtin doctest module

Worth itPyPI Python ModulesReleased Mar 20261.1M downloads / moApache 2Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — xdoctest-1.3.2-py3-none-any.whl
v1.3.2 · released 2026-03-27 · Python >=3.8

Yes. Xdoctest is a mature, actively maintained tool with zero dependencies and broad Python support. It solves a real problem—keeping documentation examples in sync with code—and integrates cleanly into both standalone and pytest workflows. The permissive Apache 2 license poses no restriction. Install it if you want to treat docstring examples as executable tests.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.8 or later; Python 2.7 and 3.4–3.7 are no longer supported as of version 1.1.0 and 1.2.0 respectively.
  • Installation is straightforward with no runtime dependencies.
  • The package is actively maintained, with a recent release and ongoing commits.

License · maintenance · safety

Apache 2 (permissive) — Apache 2 is a permissive license, allowing use in most commercial and open-source projects without significant restriction.

last release 2026-03-27 (140 days) · last repo commit 2026-07-14 · 223 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,091,491 downloads/mo, #4,379 on PyPI

Verify before relying

pip install xdoctest

# Run all doctests in a module
python -m xdoctest /path/to/module.py all

# Or with pytest
pytest --xdoctest /path/to/module.py
  • Performance characteristics when running doctests on large codebases or deeply nested modules
  • Specific AST parsing edge cases or limitations compared to the built-in doctest module
  • Compatibility with all pytest plugins or configurations
Same gist for agents: .md · .json

What it is and what it does

Xdoctest is a replacement for Python's built-in doctest module that discovers and executes example code written in docstrings. Instead of using regex-based parsing, it employs an abstract-syntax-tree parser for more reliable detection and execution of doctests. The package encourages writing tests and documentation together in the same file, reducing boilerplate and helping developers maintain minimal working examples alongside their code.

You can run xdoctest either as a standalone command-line tool or as a pytest plugin. The standalone interface lets you execute all doctests in a module, list them, dump them as unit tests, or run specific functions' doctests. The pytest integration allows you to run doctests alongside your regular unit tests using a single command, making it practical for CI pipelines. The package is actively maintained, supports Python 3.8 through 3.14, and has no external runtime dependencies.

Use it for

  • Validate example code in function and class docstrings during development or CI to catch documentation drift
  • Write minimal working examples in docstrings that serve as both documentation and regression tests
  • Run all doctests in a project with a single command to ensure examples remain executable
  • Integrate doctest execution into pytest workflows alongside unit tests for comprehensive test coverage
  • Debug functions by first writing example inputs and outputs in docstrings, then implementing the body

Worth the install?

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

Worth it

Yes.

Xdoctest is a mature, actively maintained tool with zero dependencies and broad Python support. It solves a real problem—keeping documentation examples in sync with code—and integrates cleanly into both standalone and pytest workflows. The permissive Apache 2 license poses no restriction. Install it if you want to treat docstring examples as executable tests.

Install

xdoctest on PyPI

Before you install

Installation is straightforward with no runtime dependencies. The package is actively maintained, with a recent release and ongoing commits. It supports modern Python versions (3.8+) across CPython and PyPy implementations.

Requires Python 3.8 or later; Python 2.7 and 3.4–3.7 are no longer supported as of version 1.1.0 and 1.2.0 respectively.

License in practice

Apache 2 is a permissive license, allowing use in most commercial and open-source projects without significant restriction.

Quickstart

pip install xdoctest

# Run all doctests in a module
python -m xdoctest /path/to/module.py all

# Or with pytest
pytest --xdoctest /path/to/module.py

Verify before relying

  • Performance characteristics when running doctests on large codebases or deeply nested modules
  • Specific AST parsing edge cases or limitations compared to the built-in doctest module
  • Compatibility with all pytest plugins or configurations

Package facts

LicenseApache 2 permissive
Python supportSupports the current Python release >=3.8
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 140 days since the last release
Last repo commit
First released
Downloads1,091,491 / month, #4,379 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 6 - MatureFramework :: PytestIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: TestingTopic :: Utilities

Evidence: xdoctest-1.3.2-py3-none-any.whl

Tags

Capabilities
doctest runnerexecute doctestsdocstring testspytest doctest plugindocumentation testingexample code validationinline code examples
Topics
doctestpytest-plugindocumentation-testing
PyPI keywords
xdoctestdoctesttestdocstrpytest

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 › “execute doctests”

  • xdoctestXdoctest finds and executes test code embedded in Python docstrings,…
  • pytest-cythonA pytest plugin that runs doctests embedded in Cython `.pyx`…
  • pytest-doctestplusA pytest plugin that runs doctests in Python docstrings and…

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 pytest-doctestplus · pytest-cython · lib-detect-testenv · sybil · pytest-extra-durations · zope.testing · pytest-durations · pytest-markdown-docs · nose · interrogate