Skip to main content

readme-ci

Test the code examples in your documentation — automatically, in CI.

The examples in a project's README are the first thing humans and AI assistants copy, and almost nobody tests them after writing them. The software changes, the examples don't, and they quietly break. readme-ci finds the code snippets in your Markdown documentation and (soon) executes them in a sealed sandbox, so "our examples always run" can be a CI-enforced promise instead of a hope.

Status

v0.0.1 in progress — early and honest about it.

Stage Status
Extract fenced code snippets from Markdown ✅ works
Classify snippets (runnable / placeholder / unsafe / needs-network) ✅ heuristic v0
Execute snippets in a network-isolated Docker sandbox ✅ implemented
Pass/fail report + CI gate ✅ readme-ci run

readme-ci scan only reads your docs (no execution). readme-ci run executes the snippets classified as runnable — but only inside a locked-down Docker sandbox. When no sandbox is available, runnable snippets are reported as skipped: readme-ci never falls back to running untrusted code on the host.

Quick start

python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
readme-ci scan README.md

scan lists every fenced code block it finds, with language, line numbers, and a conservative classification:

README.md:22-26  [bash]  3 line(s)  needs-network

To actually execute the runnable examples (in a sandbox) and get a pass/fail report suitable for CI:

readme-ci run README.md
readme-ci run docs/ --timeout 20 --json

run exits non-zero if any snippet fails, so it works as a CI gate. Add --json to either command for machine-readable output.

Skipping a snippet

An example that shouldn't be executed — it needs a real service, is purely illustrative, or is intentionally broken — can be marked so readme-ci run leaves it alone, without adding noise to the code readers copy. Either:

  • put readme-ci:skip in the fence info string, right after the language (e.g. an opening fence of ```python readme-ci:skip), or
  • put <!-- readme-ci:skip --> on the line immediately above the fence.

The marker never appears in the copyable code, and the snippet is reported as directive-skip instead of being run.

Safety design (the rule that governs this project)

Documentation snippets are untrusted input. When execution lands, it will be:

  • Sandboxed — containers with networking disabled and strict timeouts
  • Conservative — snippets containing destructive patterns (rm, sudo, pipe-to-shell, credential placeholders like YOUR_API_KEY) are classified as non-runnable and skipped
  • Opt-in — nothing runs outside the sandbox, ever, and nothing runs at all unless you ask

Why this exists

readme-ci is the first tool from machine-operable, a research program measuring — and fixing — how reliably open source repositories work for the humans and AI agents that depend on them. Broken documentation examples don't just mislead newcomers anymore; they get learned and repeated by AI assistants at scale.

License

Apache-2.0

Metadata

Release files for readme-ci 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for readme-ci 0.0.1
File Size Uploaded
readme_ci-0.0.1.tar.gz 19.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for readme-ci 0.0.1
File Interpreter ABI Platform
readme_ci-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 35.3 kB

Release files / readme_ci-0.0.1.tar.gz

Download URL readme_ci-0.0.1.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
85ade65a7f7177f197b7f7325eb1afef12dde7bf308b74262efaec9e7e11fcc9
BLAKE2b-256 checksum
How to use checksums
4bf6a84217639b0250bc0d579cd12351b573209c728a7fb2539f6d00bd685ed8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release files / readme_ci-0.0.1-py3-none-any.whl

Download URL readme_ci-0.0.1-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7881b5d3ef133a270506e9e044e22ba4b13b4fc7026687b39d5407ffe43a5fcc
BLAKE2b-256 checksum
How to use checksums
5355bfffa4befce0d640c65c21f7d0f52d4c23ba32e5e0b181d72bef1e5fc254
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page