Thanks for looking. Bug reports with a minimal byte-stream reproduction, and notes on where the documentation misled you, are the most useful things right now.
How this project writes prose — README.md, CHANGES, release notes,
commit messages, docstrings, and source comments — is set out separately
in WRITING.md. Read that before changing any of it. The
constraints every change is held to, and the map of what is where, are
in AGENTS.md.
$ git clone https://github.com/libvt/libvt-python.git$ cd libvt-python$ uv sync --all-groupsThis project uses Python 3.12+, uv for dependency management, ruff for linting and formatting, ty for static type checking, and pytest for testing (with pytest-watcher for continuous runs).
Format:
$ uv run ruff format .Lint:
$ uv run ruff check . --fix --show-fixesType-check:
$ uv run ty checkCheck the Python 3.12 Windows target separately.
$ uv run ty check --python-version 3.12 --python-platform win32Test:
$ uv run pytestDocumentation is a gate, not a courtesy. Doctests in docstrings,
documentation pages, and README.md — together with plain python fences,
runnable console fences, and {literalinclude} directives in README.md
and docs/ — are collected and executed by pytest (run
uv run pytest -m documentation to target only Markdown code-block checks).
The rules for executable blocks and explicit classification of non-runnable
commands are in WRITING.md.
Use the test bite gate to prove a regression
fails for the reason it claims to catch. For bug fixes and behavioral
changes, verify new or updated pytest regressions fail inside the real
owner call when modified production files are restored to <base> and
newly added production files are removed temporarily:
$ : "${BITE_TEST:?set BITE_TEST to the regression test}" && \
wt=$(mktemp -d) && \
git worktree add --quiet --detach "$wt" HEAD && \
( cd "$wt" && \
base=${BITE_BASE:-origin/master} && \
git diff --name-only --no-renames "$base" HEAD | \
grep -E '\.py$' | \
grep -Ev '(^|/)tests?/|(^|/)conftest\.py$|(^|/)test_[^/]*\.py$|_test\.py$' \
> bite.files && \
git restore --source="$base" --worktree \
--pathspec-from-file=bite.files && \
{ uv run pytest -rf "$BITE_TEST" 2>&1 | tee bite.log; \
grep -E '^FAILED ' bite.log | \
grep -F -- "$BITE_TEST" | \
grep -Ev 'ImportError|ModuleNotFoundError'; } ); \
bite=$?; \
git worktree remove --force "$wt"; \
test "$bite" -eq 0This runs in a disposable git worktree at HEAD, so the checkout and any
uncommitted edit stay untouched; commit the change first. Set BITE_TEST to a
pytest node id such as tests/test_x.py::test_name. BITE_BASE defaults to
origin/master; set it to the pre-fix commit when the defect was introduced
earlier in the same pull request. The command succeeds only when the runner
reports that test as failed, and it prints the failure line. A missing runner,
a build error or an import error prints no such line, so it is not a bite.
Check that the printed failure is the assertion that describes the defect.
Apply the clean-room review gate before consulting external source or fixtures.
Standard library imports are namespace imports —
import pathlib, not from pathlib import Path — except
dataclasses, which may use from dataclasses import dataclass, field
for the decorator syntax. Third-party packages may use from X import Y
freely. For typing, import typing as t and access members via the
namespace (t.NamedTuple, t.TypeAlias, …). Every file starts with
from __future__ import annotations; ruff's isort required-imports
enforces it.
Docstring conventions, including the NumPy style all public functions and methods use, are in WRITING.md.
The core test suite runs in pure Python with no external binaries
required. libvt's own pytest plugin (src/libvt/pytest_plugin.py)
exposes vt_-prefixed fixtures (vt_terminal, vt_factory,
vt_parser) with lazy imports inside fixture bodies so test collection
stays free of startup overhead.
Write tests as standalone functions, not class TestFoo: groupings —
descriptive function names and file organization carry the structure
instead. Prefer real Terminal and Parser instances over
monkeypatch and MagicMock; elsewhere, prefer tmp_path
(pathlib.Path) over tempfile.
Run the suite continuously during development:
$ uv run ptw .Build once:
$ just build-docsServe with live reload while editing (default: http://localhost:8024):
$ just start-docsjust build-docs is also how a broken cross-reference or MyST role
surfaces — the doctests do not catch it. Nothing under docs/_build/
is hand-edited; it is the build's own output and is not tracked. The
prose voice, cross-reference conventions, and doctest rules for pages
under docs/ are in WRITING.md.
Never create tags. Never push tags. The owner handles tagging and tag pushes, because a tag triggers the publish workflow. See Release commits.
libvt is pre-1.0 (currently in 0.0.x pre-alpha): 0.0.x updates and 0.x
minor version bumps may include breaking API changes, so downstream projects
should pin libvt>=0.0.1a7,<0.1 (and >=0.x,<0.y from 0.1.0 onward).
- Add the release's entries to
CHANGES, following The changelog. - Bump the version in both
pyproject.tomlandsrc/libvt/__about__.py— neither is derived from the other. - Commit as
Tag v<version>(see Release commits). - The owner tags (
git tag v<version>) and pushes the tag. CI then builds and publishes to PyPI via OIDC trusted publishing — there is no manual upload step.
REVIEW.md opens with this repository's posture. It tells a reviewer
how to treat a compatibility shim, meaning code kept only so an older
caller keeps working:
experimental: the public interface can still change between releases. Repair a wrong boundary at its owner and update callers in the same change. A shim is residue unless a named consumer needs it and its removal condition is recorded.stable: users depend on the released interface. A breaking change ships with a shim or a deprecation path, a changelog entry and migration notes. A shim stays until its removal condition is met.private: the repository has no outside consumers. Change every caller in the same pull request and keep no shim.
Use REVIEW.md for design and pull request review.
One subject per pull request. Unrelated cleanup found along the way belongs in its own commit, and usually in its own pull request.
Discuss a substantial change via an issue or ADR before making it.
Update the docs when a change touches the public interface.
Commit format is in WRITING.md.
- Participants will be tolerant of opposing views.
- Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
- When interpreting the words and actions of others, participants should always assume good intentions.
- Behaviour which can be reasonably considered harassment will not be tolerated.
Based on Ruby's Community Conduct Guideline.
Please do not open a public issue for a vulnerability. Report it privately via GitHub Security Advisories.