Installation
Temporal Typing requires Python 3.10 or later and has zero runtime dependencies.
1. Install temporal-typing#
Add the declaration library to your project:
pip install temporal-typing
# or with uv:
uv add temporal-typingThis gives you all annotations (@spec, State, Action, Model, …) and the shared static front-end validator CLI:
python -m temporal_typing path/to/spec.py2. Install a Model Checker (tanny)#
Just as typing declares types and leaves checking to mypy, Temporal Typing declares behaviour and leaves model checking to a checker. Tanny is the reference static model checker, written in Rust with Manyan embedded in-process (no JVM required):
# Install globally with uv (recommended):
uv tool install tanny
# Or run without installing:
uvx tanny check path/to/spec.py
# Or install into a virtual environment:
pip install tannypython -m temporal_typing runs Stage 1 only (static well-formedness, levels, bindings, domains). tanny check runs the full pipeline (Read → Translate to TLA⁺ → Model Check with Manyan → Report verdicts and Python counterexample traces).
3. Static Type Checkers#
Temporal Typing ships a py.typed marker (PEP 561). Both mypy --strict and Pyright understand specified classes out of the box with no plugins required.
In Pyright's strict mode, prefer named module-level predicate functions over inline lambda expressions when Pyright cannot infer lambda parameter types.
4. CI Integration#
Add a check step to GitHub Actions (both tools return standard exit codes: 0 pass, 1 check failure, 2 error):
- name: Validate and model-check temporal specs
run: |
uv run python -m temporal_typing src/
uvx tanny check src/