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:skipin 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 likeYOUR_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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file readme_ci-0.0.1.tar.gz.
File metadata
- Download URL: readme_ci-0.0.1.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85ade65a7f7177f197b7f7325eb1afef12dde7bf308b74262efaec9e7e11fcc9
|
|
| MD5 |
14afac8a5e92e981785b5c6a4f8212bd
|
|
| BLAKE2b-256 |
4bf6a84217639b0250bc0d579cd12351b573209c728a7fb2539f6d00bd685ed8
|
Provenance
The following attestation bundles were made for readme_ci-0.0.1.tar.gz:
Publisher:
release.yml on machine-operable/readme-ci
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
readme_ci-0.0.1.tar.gz -
Subject digest:
85ade65a7f7177f197b7f7325eb1afef12dde7bf308b74262efaec9e7e11fcc9 - Sigstore transparency entry: 2212457878
- Sigstore integration time:
-
Permalink:
machine-operable/readme-ci@554186e1794190808380bc6b9c125cec7cf22ec9 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/machine-operable
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@554186e1794190808380bc6b9c125cec7cf22ec9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file readme_ci-0.0.1-py3-none-any.whl.
File metadata
- Download URL: readme_ci-0.0.1-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7881b5d3ef133a270506e9e044e22ba4b13b4fc7026687b39d5407ffe43a5fcc
|
|
| MD5 |
a5353375826bc33299d69468220dda91
|
|
| BLAKE2b-256 |
5355bfffa4befce0d640c65c21f7d0f52d4c23ba32e5e0b181d72bef1e5fc254
|
Provenance
The following attestation bundles were made for readme_ci-0.0.1-py3-none-any.whl:
Publisher:
release.yml on machine-operable/readme-ci
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
readme_ci-0.0.1-py3-none-any.whl -
Subject digest:
7881b5d3ef133a270506e9e044e22ba4b13b4fc7026687b39d5407ffe43a5fcc - Sigstore transparency entry: 2212457889
- Sigstore integration time:
-
Permalink:
machine-operable/readme-ci@554186e1794190808380bc6b9c125cec7cf22ec9 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/machine-operable
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@554186e1794190808380bc6b9c125cec7cf22ec9 -
Trigger Event:
push
-
Statement type: