uv workspace for the Python port of var (ADR 0001, issue #2). A native,
pure-Python port of var that passes the same shared cross-language conformance
suite as every other port — no port is the reference; the golden corpus is.
uv sync # create .venv, install workspace members + dev deps
uv run pytest # run the test suite (core + runner + plugin + conformance)
uv run ruff check| Package (dist / import) | Layer |
|---|---|
varar-core / varar_core |
pure functional core: parse → plan → execute, matcher, diffs, conformance |
varar / var |
author facade: steps (+ internal, registry glue) |
varar-config / varar_config |
reads varar.config.json — the shared config file for all var tools |
varar-runner / varar_runner |
shared imperative shell: discovery, step loading, run orchestration, failure rendering |
pytest-varar / varar_pytest |
pytest plugin: .md oaths as first-class tests |
varar-unittest / varar_unittest |
unittest adapter: generate_tests(globals()) in one test module |
The pytest-varar plugin turns a .md file into pytest tests (one item per
example). varar.config.json points it at a collision-free
subset of the shared conformance/bundles/ (the bundles reuse some
expressions across bundles — e.g. I echo…, I have {int} cukes,
I greet {string} — and the plugin builds one global step registry, so it can't
load them all at once):
cd python
uv run pytest --rootdir=. ../conformance/bundles
# → 5 passed, 2 failed
# 07-row-check-mismatch and 09-expected-message-mismatch FAIL by design,
# so you see var failing immediately, anchored to the .md:
#
# Cell mismatch in .../07-row-check-mismatch/example.md:
# line 9 | column 'score' — expected: '10', actual: '99'Want to edit an oath/step and watch it flip? Do NOT edit files under
conformance/bundles/ — they are the shared golden corpus, and changing them
breaks the conformance suite (Python and TypeScript). Instead, copy a bundle to
a scratch location you own, point varar.config.json at it, and edit freely:
cp -r ../conformance/bundles/01-roman-numerals /tmp/myoath
# add "/tmp/myoath/*.md" to varar.config.json's docs.include and
# "/tmp/myoath/*.steps.py" to steps
uv run pytest --rootdir=. /tmp/myoath # green
# now change a number in /tmp/myoath/example.md or break a handler → red(The default uv run pytest runs only the package test suite — testpaths = ["packages"] — so the dogfood bundles are opt-in via the explicit path above.)