Skip to main content

Executable documentation smoke tests for Markdown snippets.

Project description

docsmoke

CI PyPI Release Python License: Apache 2.0 Checked with mypy Ruff

docsmoke validates executable Markdown snippets before they drift out of sync with the software they document.

It is built for maintainers who want docs to fail like code: run the fenced shell and Python examples in README.md and docs/, assert on expected output, and fail CI when installation guides or CLI examples stop working.

Highlights

  • Markdown-native snippet discovery with explicit docsmoke opt-in markers
  • Built-in shell and Python executors
  • Per-snippet directives for timeouts, expectations, environment variables, working directories, and skips
  • CLI, JSON, and Markdown reporting
  • GitHub Action for CI usage
  • Typed Python package with strict linting, mypy, pytest, pre-commit, Docker, and release automation

Quick start

python3.11 -m pip install docsmoke
docsmoke --help

Mark runnable snippets in Markdown:

```bash docsmoke
# docsmoke: name=quickstart; expect-contains=passed
docsmoke scan README.md --quiet
```

Run a scan:

# docsmoke: expect-contains=list-snippets
docsmoke --help

List what would run:

# docsmoke: expect-contains=example-snippet
docsmoke list-snippets examples --json

Directive syntax

Directives live in the first lines of a runnable fenced block:

```bash docsmoke
# docsmoke: name=install-check
# docsmoke: cwd=examples
# docsmoke: expect-contains=hello
printf 'hello\n'
```

Supported directives:

  • name=<value>: human-friendly snippet label
  • cwd=<path>: working directory relative to the project root
  • timeout=<seconds>: positive per-snippet timeout
  • expect-contains=<text>: required stdout or stderr substring
  • expect-regex=<pattern>: required regex match against stdout or stderr
  • env.NAME=<value>: environment variable override
  • shell=<binary>: shell override for shell snippets
  • skip[=true|false]: skip the snippet without removing it

GitHub Action

Use the moving @v1 tag to receive compatible 1.x fixes automatically, or pin an exact release such as @v1.0.0 for fully reproducible workflow inputs.

- uses: dev-ugurkontel/docsmoke@v1
  with:
    paths: README.md docs examples

Documentation

Development

make all

License

Apache 2.0 licensed. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docsmoke-1.0.0.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docsmoke-1.0.0-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file docsmoke-1.0.0.tar.gz.

File metadata

  • Download URL: docsmoke-1.0.0.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for docsmoke-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7b58431a8764d9afbcc04c217c9484d1774e47443b69b9fd9360991ef15bbe8d
MD5 a1dbf92df8fadfd82ba94600f47bf3c2
BLAKE2b-256 c0c6b0341be9b9ebb4a3792af0ca632516547a316ef80c666b2e12d52a0ed597

See more details on using hashes here.

Provenance

The following attestation bundles were made for docsmoke-1.0.0.tar.gz:

Publisher: release.yml on dev-ugurkontel/docsmoke

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file docsmoke-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: docsmoke-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for docsmoke-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d52ad90b0b7c7c3e08021a0ba949f57eaf96f8d2f4d7111b32911b8b678474d
MD5 527d372add864caffe094d326cbdc9ea
BLAKE2b-256 a0e26b0b91105e195ec9764a33246f17be68a126c2205abd2c90053b3f05443c

See more details on using hashes here.

Provenance

The following attestation bundles were made for docsmoke-1.0.0-py3-none-any.whl:

Publisher: release.yml on dev-ugurkontel/docsmoke

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page