Skip to main content

HTTP regression & diff testing across environments — TUI, headless CLI, and CI.

Project description

comparo

HTTP regression & diff testing across environments — TUI, headless CLI, and CI.

comparo replays the same HTTP requests against two environments (say staging and prod), then diffs the responses to catch regressions before they ship. It understands that responses are not always byte-identical — so alongside a git-style content diff it does a structural diff you configure: ignore volatile fields, tolerate array-length differences, validate against a schema, or require exact equality, per JSON path.

It is not tied to any particular API — the bundled example targets httpbin, but the engine knows nothing about your domain. What to compare, ignore, or tolerate is all declarative config.

One engine (comparo.core) powers three front-ends that never leak back into it:

  • a TUI to explore a project, run requests with live results, diff environments, and triage;
  • a headless CLI for the same, scriptable;
  • a GitHub Action that fails the build on untriaged drift.

Status

Pre-1.0, under active development — a first beta. A runnable, self-contained example lives in examples/sample-project.

[!WARNING] AI Disclaimer

comparo was created as a personal initiative to learn and play with terminal user interface frameworks and coding agents for real-life use cases. This tool has been really handy for both my personal and corporate projects. Due to its AI co-authoring, and despite the fact I tried to require good development practices from an LLM agent, I cannot advise you to rely on this tool for production purposes in its current state. This warning will stay here until I have fully audited the code and can confidently release a prod-ready version.

To be clear:

AI CODED THIS PROJECT BECAUSE I DIDN'T HAVE TIME TO SPEND ON IT. DO NOT BLINDLY TRUST THIS PROJECT, NOR ANY VIBE-CODED PROJECT YOU HAVE NOT FULLY UNDERSTOOD OR AUDITED.

Install

pipx install comparo

Quickstart

Scaffold a project (a comparo.yaml manifest plus a .comparo/ starter), then explore it — from a directory with a comparo.yaml, commands need no path and a bare comparo opens the TUI:

# create a new project and open the terminal UI
comparo init
comparo

# validate and run  the ./comparo.yaml is picked up automatically
comparo validate
comparo run --env local

comparo init scaffolds a single local environment; add a second environment and a diffPairs entry to the manifest, then diff them:

comparo diff --baseline local --candidate staging --report junit --report markdown

Or work on a project elsewhere by pointing --config at its manifest — for example the runnable, self-contained examples/sample-project:

comparo validate --config examples/sample-project/comparo.yaml
comparo tui      --config examples/sample-project/comparo.yaml
comparo diff     --config examples/sample-project/comparo.yaml --pair local-vs-prod

The Terminal UI guide walks through each screen; the CLI reference documents every command and the GitHub Action.

Highlights

  • Structural diff, not just bytes. A DiffProfile decides, per JSON path, whether a field must be exact, match a shape, keep its type, stay within a tolerance, or be ignored.
  • Assert and diff, in one run. An ExecutionProfile evaluates assertions on both environments and diffs the pair, behind a single gate — the Execution tab replays it live.
  • Grouped drift. A field that drifts across three matrix cells reads as one bug, not three.
  • Reviewable triage. Silencing a drift writes an ignore rule into a committed profile — it shows up in git diff, not just in memory.
  • Secrets never leak. Values are masked in the TUI, redacted from saved runs and reports (even when a server echoes them back), and kept out of version control.
  • The gate is the gate. The TUI's Report screen, the CLI, and the Action share one reporter engine, so exit codes and verdicts match everywhere.

Concepts

Projects are described by version-controlled YAML objects, each with a Kubernetes-style envelope (apiVersion / kind / metadata / spec):

kind Purpose
Environment a target: base URL, timeout, credentials, variables, auth, cookies, health checks
Request an HTTP request (matrix-expanded, streaming, auth, cookies, body encodings) with a response schema and diff/assertion profiles
Schema a JSON Schema used for structural validation
Instance a reusable value injected by reference to avoid duplication
Matrix a set of parameter cases a request is run against (values can inject into the path)
DiffProfile how two responses are compared, per JSON path
AssertionProfile composable assertions run against a single response (status, body, latency, schema, …)
ExecutionProfile one declarative run that asserts both environments and diffs the pair, with a gate
Project run-wide defaults: environments, concurrency, retry, selection, reporting

The full format — every field, the ${...} interpolation grammar, the $ref/$val/$secret sigils, matrices, and diff modes — is in the configuration reference.

Documentation

Architecture

A single engine (comparo.core) powers the three front-ends — none of which the core depends on. The core imports no HTTP library; that lives behind an adapter. Both boundaries are enforced in CI by import-linter. See Architecture.

Contributing

See CONTRIBUTING.md. The gates — ruff, mypy --strict, import-linter, pytest — run on every commit via pre-commit.

License

MIT © Walid Benbihi

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

comparo-0.1.0.tar.gz (413.0 kB view details)

Uploaded Source

Built Distribution

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

comparo-0.1.0-py3-none-any.whl (187.5 kB view details)

Uploaded Python 3

File details

Details for the file comparo-0.1.0.tar.gz.

File metadata

  • Download URL: comparo-0.1.0.tar.gz
  • Upload date:
  • Size: 413.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for comparo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dd4a8c2819b2ef9afa624c2c36286ea5fe76df7be29381636100aa87b10cfc8f
MD5 f0c2c1557abf27cb8b9b688aabbe55c0
BLAKE2b-256 732cd0f054e07b5730aa5ed16af61dbaf8e7bd6b5f6490f9d551fc6db0167768

See more details on using hashes here.

Provenance

The following attestation bundles were made for comparo-0.1.0.tar.gz:

Publisher: release.yml on wbenbihi/comparo

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

File details

Details for the file comparo-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: comparo-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 187.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for comparo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0499aea8cca1cf679648ea7aee65309064964f7636953bd88be6be9ec9e5ea7
MD5 edaffafa553a74a47797160bee28c393
BLAKE2b-256 25577a738e37a58b029d8e7047038ecd234428a0c48e8874b13df8f1fd2563fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for comparo-0.1.0-py3-none-any.whl:

Publisher: release.yml on wbenbihi/comparo

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