Skip to main content

CLI output assertion tool for documentation testing

Project description

mustmatch

mustmatch provides two tightly coupled capabilities for executable documentation workflows. It asserts CLI output in shell pipelines, and it executes Markdown bash/python fences as pytest tests. The Rust core handles parsing, normalization, and comparison while Python keeps runtime orchestration.

Install

Use a normal Python virtual environment and install with pip. This snippet is documentation-only and intentionally skipped during executable doc runs.

pip install mustmatch

CLI Assertions

Pipe command output into mustmatch and compare against one expected value.

echo "hello" | mustmatch "hello"
echo "hello world" | mustmatch like "world"
echo "v1.2.3" | mustmatch "/^v[0-9]+[.][0-9]+[.][0-9]+$/"
echo '{"status":"ok","count":42}' | mustmatch like '{"status":"ok"}'

Executable Markdown

Markdown documents become test files under pytest collection. Tables can drive per-row Python checks with each_row.

# Math Behavior

## Double Values

| input | output |
|-------|--------|
| 2     | 4      |

```python each_row
doubled = row.input * 2
result = {"input": row.input, "output": doubled}
row_label = f"row-{row_index}"
```

Run docs as tests:

pytest docs/ -v

Documentation Map

The executable specification is in docs/:

  1. docs/01-overview.md
  2. docs/02-cli-assertions.md
  3. docs/03-executable-documents.md
  4. docs/04-fixtures-and-tables.md
  5. docs/05-directives.md
  6. docs/06-comparison-modes.md
  7. docs/07-normalization.md
  8. docs/08-configuration.md
  9. docs/09-examples.md

CLI Bench Plan

Benchmark commands are tracked in bench/clibench-commands.txt so Python and Rust paths can be compared with the same tag set.

# Python baseline
CLIBENCH_PROJECT=mustmatch-cli uv run --script /home/ian/workspace/.codex/skills/clibench/clibench.py batch bench/clibench-commands.txt

# Compare prefixes
CLIBENCH_PROJECT=mustmatch-cli uv run --script /home/ian/workspace/.codex/skills/clibench/clibench.py compare python rust

License

MIT

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

mustmatch-0.0.3.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

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

mustmatch-0.0.3-cp310-abi3-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file mustmatch-0.0.3.tar.gz.

File metadata

  • Download URL: mustmatch-0.0.3.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for mustmatch-0.0.3.tar.gz
Algorithm Hash digest
SHA256 fef4bb85b6d3a5a575c1979a4f851b3eb3ea9d4475606e78b2fa0c6a281fa444
MD5 81c85ffdb5080f2f876b37e7b7890f6d
BLAKE2b-256 97913080ee9869d13f2d6cb4319c54ece46f5b59f377118fc9c2d688cb5ac98a

See more details on using hashes here.

File details

Details for the file mustmatch-0.0.3-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mustmatch-0.0.3-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 639ad3de34a031b12c118f844cf4e36fff0327cec1addf2dd0bda591544ba8e1
MD5 bbec5840e5ebc540826c083a575420a5
BLAKE2b-256 1533e1013300f02d4ab391be37d2bec76cbcda8664d0958d4771f343006e7999

See more details on using hashes here.

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