{"categories":[{"label":"Python Modules","url":"https://skillfed.io/packages/category/software-development-libraries-python-modules/11"}],"enrichment":{"capability":"A pytest plugin that finds, lints, runs, and validates Python code examples embedded in docstrings and markdown files, using ruff and black for formatting and checking print statement correctness.","skillfed_tags":["documentation-testing","code-validation"],"use_cases":["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"],"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.\n\nTypical 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.","worth_installing":"Yes. The plugin fills a real gap\u2014keeping documentation examples in sync with code\u2014and 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."},"id":"pytest-examples","links":{"html":"https://skillfed.io/packages/pytest-examples","md":"https://skillfed.io/packages/pytest-examples.md","pypi":"https://pypi.org/project/pytest-examples/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2025-05-06","license_spdx":"MIT","license_treatment":"permissive","name":"pytest-examples","python_support":"supports_current","summary":"Pytest plugin for testing examples in docstrings and markdown files."},"popularity":{"monthly_downloads":594886,"position":5843,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"0.0.18"}
