Zuspec live-Python Backend
zuspec-be-py is the live-Python backend for Zuspec — the Python analogue of
zuspec-be-sv. It consumes a
zuspec.ir.core.Context and projects it into executable Python classes built on
the zuspec-dataclasses (zdc)
runtime, so a PSS model can be loaded and driven directly from Python.
On top of the class builder, the export-api projection runs a model as a live
Python object — mirroring the SystemVerilog oo_api projection: build a
registry, supply an import-API implementation, then await exported actions to
run their traversals (pre_solve → randomize → post_solve → activity/body).
This is an API-only capability (standalone scripts, pytest, cocotb). There is no CLI.
Quick start
From PSS source, the easiest entry point is pssc.load_pss, which returns a
zuspec-be-py registry:
import asyncio
from pssc import load_pss
registry = load_pss(open("model.pss").read()) # parse + elaborate once (reusable)
ep = registry.create(seed=1) # a runnable, per-run instance
asyncio.run(ep.Entry()) # run the exported action
Supplying imports (the model calling out to your code — sync or async):
class MyImports:
def getval(self, i): return i + 5 # import solve (pure)
async def doit(self, i): print(f"[imp] doit({i})") # import target (awaited)
ep = registry.create(MyImports())
await ep.Entry() # prints: [imp] doit(12)
Driving from a zuspec.ir.core.Context directly (any IR producer, not just PSS):
from zuspec.be.py import build_registry, ImportSpec
registry = build_registry(ctx, export_actions=["Top::Go"],
import_specs={"doit": ImportSpec(name="doit", is_target=True)})
ep = registry.create(MyImports(), seed=1)
await ep.Go()
Public API
| Name | Role |
|---|---|
build_registry(ctx, *, export_actions, import_specs, owner_map) |
build a registry configured for the export-api projection |
build_runtime(ctx, *, owner_map, import_names) |
build a plain ClassRegistry of live classes |
ClassRegistry.create(imports=None, *, seed=None, root=None) |
factory → per-run ExportApi |
ClassRegistry.emit_module(path) |
ship a model: emit a self-contained .py (embedded IR) that rebuilds on import, no re-parse |
ExportApi |
per-run handle; one async method per exported action; runner() / program() |
ActionResult |
the solved root-action instance (attribute access proxied) |
ActionRunner / ActionProgram |
command-pattern, ordered replay |
ImportSpec / ImportResolver / PssImportError |
import wiring (re-exported from the runtime) |
IrToRuntimeBuilder |
the IR → live-class builder |
The builder is PSS-agnostic: it consumes the canonical IR (Context.type_m)
plus an action→component owner_map (derived from Comp::Action keys when not
supplied), and never imports pssc.
Layout
src/zuspec/be/py/
builder.py IrToRuntimeBuilder / ClassRegistry (IR -> live zdc classes)
export_api.py ExportApi / ActionRunner / build_registry (the projection)
docs/ Sphinx documentation
tests/ unit tests
Documentation
Build the HTML docs:
cd docs && make html # -> docs/_build/html/index.html
Metadata
Release files for zuspec-be-py 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zuspec_be_py-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for zuspec_be_py-0.3.0-py3-none-any.whl |
Release files / zuspec_be_py-0.3.0-py3-none-any.whl
| Download URL | zuspec_be_py-0.3.0-py3-none-any.whl |
|---|---|
| Size | 387.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fae259c28e43c8d35c3d0ecc6e3201a7ad908242aa0692b926ec19779c29e30b
|
|
BLAKE2b-256 checksum How to use checksums |
2ee8b15db488ab96da3140d3c5601e5da74c6ecb26ba86f69d2045a1545f3149
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.18
|
Security for zuspec-be-py 0.3.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.