dokime-python
Responsibility: typed Python authoring APIs and a PyO3 bridge into the Rust product/runtime contracts.
Public Surface
Section titled “Public Surface”The dokime Python package exposes core identifiers and definitions,
templates, parameters, criteria, steps, records, telemetry schemas, plot and
document declarations, retry helpers, suite generation, and the
dokime.runtime.Runtime facade. ExecutionContext is supplied to executing
Python work.
The package tree includes authoring, core, records, host, installed artifact,
runtime, and telemetry. It ships type information (py.typed and stub
files) alongside the compiled _native extension.
Boundary
Section titled “Boundary”Python-facing contracts are validated by Rust before they enter the product model. The binding is an authoring/runtime adapter, not a separate persistence implementation.
Runtime and optional native gRPC access
Section titled “Runtime and optional native gRPC access”Python calls the Rust runtime directly. An optional native gRPC listener exposes the same state to external clients; it does not create a second runtime.
import asynciofrom dokime.runtime import Runtime, ServerConfig
async def main() -> None: async with Runtime(storage_root=".run/python") as runtime: async with await runtime.start_server(ServerConfig.local()) as server: print(server.status().endpoint) # Generated native gRPC clients can use this endpoint. print(runtime.runtime_overview()) # The listener is closed; native runtime operations remain available.
asyncio.run(main())Use await server.shutdown() to close one listener, or await runtime.shutdown()
to drain all attached listeners and flush the native runtime. The async context
managers perform those steps automatically. Always finish runtime shutdown
before exiting a script or reopening its output directory. The lifecycle waits
release the Python GIL; existing native query methods remain synchronous.
To control an already running desktop or headless instance, use its native gRPC
endpoint and generated protobuf client. Creating a Python Runtime creates
another instance, not a connection to the existing process. See the
gRPC reference for requests.