tlakit
A Python and notebook client for the TLA+ toolchain.
TLA+ has good tools — TLC, SANY, the TLA+ Debugger, the animation modules. None of them are reachable from Python, and none of them compose with a notebook. tlakit is the missing client. It does not reimplement any of them.
import tlakit
spec = tlakit.load("Microwave.tla")
result = spec.check(invariants=["Safety"])
if not result.ok:
print(result.outcome) # Outcome.INVARIANT_VIOLATION
print(result.trace.delta(3)) # frozenset({'radiation'})
result.trace.to_dataframe(flatten=True) # nested records as columns
Sweep a constant and get the smallest configuration that breaks:
sweep = spec.sweep({"Servers": [3, 4, 5]}, invariants=["Inv"],
workers=3, heap="2G")
sweep.first_failure().constants # {'Servers': 4}
sweep.to_dataframe() # one row per configuration
As a Jupyter kernel
pip install "tlakit[kernel]"
python -m tlakit.kernel.install
Then pick TLA⁺ (tlakit) from Jupyter's kernel list and write TLA+ directly — no magics, no Python wrapper:
---- MODULE Microwave ----
EXTENDS Naturals
VARIABLES door, radiation
...
====
SPECIFICATION Spec
INVARIANT Safety
Python still works in the same notebook, which is the point of building on IPython rather than replacing it:
result.trace.to_dataframe()
Or as magics in an ordinary Python kernel
%load_ext tlakit
%%tla Microwave
---- MODULE Microwave ----
...
====
%%tlc Microwave
SPECIFICATION Spec
INVARIANT Safety
Status
M1 is complete: CliRunner, normalized results, %%tla / %%tlc magics,
and static HTML rendering of counterexamples and diagnostics. See
docs/superpowers/specs/ for the design and docs/superpowers/plans/ for the
implementation plan.
Requirements
- Python 3.10+
- Java
- TLA+ tools v1.8.0 or newer — tlakit runs TLC with
-dumpTrace json; v1.7.4 (TLC 2.19) does not have that option
Fetch the pinned, checksummed tools:
python -m tlakit.install
Or point tlakit at jars you already have with
TLAKIT_TLA2TOOLS=/path/to/tla2tools.jar.
TLAKIT_COMMUNITY_MODULES optionally locates CommunityModules-deps.jar, which
SVG.tla and Json.tla need.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tlakit-0.0.1.tar.gz.
File metadata
- Download URL: tlakit-0.0.1.tar.gz
- Upload date:
- Size: 121.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49864b0c62934ee52848ff8ecc89bc495685c79d261a01eeb4bd547e442808fc
|
|
| MD5 |
663eb7edf4a66f7f552b476d1ea5e693
|
|
| BLAKE2b-256 |
8a38d241a2daf8f776178d35c40b5bc41014f639350e5209fad763f61c0f307d
|
Provenance
The following attestation bundles were made for tlakit-0.0.1.tar.gz:
Publisher:
release.yml on LUC-AI4FM/tlakit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tlakit-0.0.1.tar.gz -
Subject digest:
49864b0c62934ee52848ff8ecc89bc495685c79d261a01eeb4bd547e442808fc - Sigstore transparency entry: 2378732105
- Sigstore integration time:
-
Permalink:
LUC-AI4FM/tlakit@0301b93a817d40a9f970c9a46edb96270ca55551 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/LUC-AI4FM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0301b93a817d40a9f970c9a46edb96270ca55551 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tlakit-0.0.1-py3-none-any.whl.
File metadata
- Download URL: tlakit-0.0.1-py3-none-any.whl
- Upload date:
- Size: 64.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f1cdf85090005e3986fa8ccd9d51a2cba3c92b799ea34bd497310f57f1dd459
|
|
| MD5 |
d90293366bc87c464813d93c7cb19fcc
|
|
| BLAKE2b-256 |
b01e2d2a24a733e8ca397b331dc0db03fe818bf41e49d556c475db1e64af2a4d
|
Provenance
The following attestation bundles were made for tlakit-0.0.1-py3-none-any.whl:
Publisher:
release.yml on LUC-AI4FM/tlakit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tlakit-0.0.1-py3-none-any.whl -
Subject digest:
3f1cdf85090005e3986fa8ccd9d51a2cba3c92b799ea34bd497310f57f1dd459 - Sigstore transparency entry: 2378732251
- Sigstore integration time:
-
Permalink:
LUC-AI4FM/tlakit@0301b93a817d40a9f970c9a46edb96270ca55551 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/LUC-AI4FM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0301b93a817d40a9f970c9a46edb96270ca55551 -
Trigger Event:
push
-
Statement type: