z3-pyodide
A pure-Python Z3 theorem prover package that works in the browser via Pyodide. Provides a z3-py compatible API using the SMT-LIB2 text protocol, communicating with Z3 compiled to WebAssembly.
Quick Example
from z3_pyodide import *
x, y = Ints('x y')
s = Solver()
s.add(x + y == 10)
s.add(x > 0, y > 0)
s.add(x > y)
if s.check() == sat:
m = s.model()
print(f"x = {m[x]}, y = {m[y]}") # x = 9, y = 1
Features
- z3-py compatible API —
Int,Real,Bool,BitVec,Array,Solver,Optimize,ForAll,Exists,Datatype, and more - Pure Python — zero dependencies, installable via
micropipin Pyodide - Dual backend — subprocess (CPython) and WebAssembly (Pyodide), auto-detected
- SMT-LIB2 protocol — generates SMT-LIB2 text, sends to Z3, parses results
Supported theories
| Theory | Types | Operations |
|---|---|---|
| Integers | Int, IntVal |
+, -, *, /, %, comparisons |
| Reals | Real, RealVal |
arithmetic, ToReal, ToInt |
| Booleans | Bool, BoolVal |
And, Or, Not, Implies, Xor |
| BitVectors | BitVec, BitVecVal |
bitwise ops, shifts, Extract, Concat, ZeroExt, SignExt |
| Arrays | Array |
Select, Store, K (constant arrays) |
| Datatypes | Datatype |
enums, records, recursive types, mutual recursion |
| Quantifiers | ForAll, Exists |
with uninterpreted Function |
| Optimization | Optimize |
minimize, maximize |
Installation
In Pyodide (browser)
import micropip
await micropip.install('z3_pyodide') # once published to PyPI
Local development (CPython)
pip install z3-solver # provides the Z3 binary
pip install -e . # install z3_pyodide
Running the example page locally
bash examples/setup.sh # downloads Z3 WASM (~17 MB, one time)
python3 examples/server.py # serves on http://localhost:8000
Running tests
pip install z3-solver pytest
pytest tests/ -v
Architecture
Python code → AST (ExprRef, BoolRef, ArithRef, ...)
↓
SMT-LIB2 text generation
↓
Backend (subprocess z3 or WASM z3)
↓
S-expression parser → Model extraction
The package builds a Python AST with operator overloading (x + y == 10), serializes it to SMT-LIB2 text, sends it to Z3 via either a local subprocess or a WASM Web Worker, and parses the results back into Python objects.
License
MIT
Metadata
Release files for z3-pyodide 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| z3_pyodide-0.1.0.tar.gz | 61.7 kB | With provenance | Details for z3_pyodide-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| z3_pyodide-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for z3_pyodide-0.1.0-py3-none-any.whl |
Total release size: 89.9 kB
Release files / z3_pyodide-0.1.0.tar.gz
| Download URL | z3_pyodide-0.1.0.tar.gz |
|---|---|
| Size | 61.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4b46f7d6dc97a606f56222f394f37a617636e6d54733f1e6692d4d8bb8e1b10
|
|
BLAKE2b-256 checksum How to use checksums |
d830eb1d014998f51ad0a38646b36754a2ca61fcd15b9d050780391e39810243
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.
Transparency logRelease files / z3_pyodide-0.1.0-py3-none-any.whl
| Download URL | z3_pyodide-0.1.0-py3-none-any.whl |
|---|---|
| Size | 28.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f0974ab3197c3b1efd9b366e94df7d455ab507fd712bcd6e825f6c8231bcb107
|
|
BLAKE2b-256 checksum How to use checksums |
7e3db72bd60bf64319beca03264a5d7e4d38e42ffefacfe34cf9e873a30c5d0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.
Transparency logSecurity for z3-pyodide 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for z3_pyodide-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.