dsviper¶
The dsviper Python runtime is the strongly typed Python API over the
Viper C++ engine. It carries the type system, value system, mutation DAG,
database tier, serialization, and RPC, and exposes them as Python classes
and functions. Most user code in the ecosystem imports dsviper and is
built on top of it.
dsviper is the runtime layer of the ecosystem. It consumes typed Python packages produced by Kibo (the static API), or loads DSM models directly at runtime (the dynamic API). See Value Chains for the broader picture.
Place in the ecosystem¶
Depends on — Viper C++.
Consumed by — dsviper-components, dsviper-tools, Commit Applications
Source repository — the
dsviperPyPI package is built from the Viper C++ source. There is no separatedsviperrepository on GitHub.Distribution — dsviper on PyPI (
pip install dsviper). Not bundled in the DevKit ZIP — the ZIP carries the toolchain (Kibo, kibo-template-viper, dsviper-tools), butdsviperitself must be installed separately from PyPI.
Quickstart¶
Install:
pip install dsviper
Open a commit database, write a typed value, commit:
from dsviper import CommitDatabase, CommitStateBuilder, CommitMutableState
import model.attachments as ma
db = CommitDatabase.open("model.cdb")
key = ma.Tuto_UserKey.create()
login = ma.Tuto_Login()
login.nickname = "alice"
state = CommitMutableState(CommitStateBuilder.initial_state(db))
ma.tuto_user_login_set(state.attachment_mutating(), key, login)
db.commit_mutations("Add user", state)
The model.attachments module above is a generated package — the
static API produced by Kibo from a DSM
model. For the dynamic API (no code generation, definitions loaded at
runtime), see DSM Processing.
The Metadata Everywhere Principle¶
Viper carries its type information as runtime metadata, and every subsystem
draws on the same source: types, values, functions, serialization, database
persistence, and RPC. You describe your data once — either through the
static API generated from a DSM model, or directly through the dynamic
API — and the runtime handles conversion, validation, and cross-language
interoperability for you. This is why Python natives (list, dict,
tuple) can be passed directly to typed dsviper functions: the
metadata drives the bridge, so there is nothing to register and nothing to
glue by hand.
A complete wrapper¶
dsviper is a complete wrapper over Viper C++ — the full C++ surface
(types, values, runtime, database tier, Commit Database, serialization, RPC)
is reachable from Python. The Commit Database in particular is documented in
the peer Commit section.
Further examples¶
For a broader corpus of runnable usage examples, see the public test suite at digital-substrate/dsviper-tests.
Topics¶
API reference¶
The complete class reference is in dsviper API, organised by domain: types, values, attachments, database, commit, blobs, serialization, DSM introspection, web rendering, and core utilities.
Status¶
Part of DevKit 1.2.x (LTS, feature-locked).