Kibo templates for Viper

The pack of templated features that turn a DSM model into a typed Python package and matching C++ surfaces — the template input of the code-generation pipeline: kibo(DSM, template) → feature.

2 Surfaces from One Model A typed Python package and matching C++ headers/implementations, from the same DSM input
6 Feature Categories Core types, persistence, serialization, function pools, Python bridge, testing
à la carte Feature Selection Each templated feature is independently selectable via the Kibo -t flag

Where it sits in the pipeline

The template pack is not a tool you run. It is what Kibo loads when targeting the Viper runtime. End users invoke it indirectly through kibo (or through dsm_util.py create_python_package, which wraps Kibo with this template under the hood).

1

DSM

model.dsm
2

Kibo

kibo generate
3

Template

cpp | python
4

Output

*.py + *.hpp/cpp

Static typed code, dynamic runtime

Viper is a dynamic, metadata-driven engine, strongly typed at runtime through its definitions catalog — values are walked through that runtime type tree. Without a typed bridge, every field access goes through string lookups : no autocomplete, no rename refactor, typos caught only at runtime. The template pack closes that gap by emitting a statically typed surface that mirrors your DSM, while the data underneath stays the same dynamically typed Viper value — no wrapper layer, no migration code.

Developer reality

What your editor sees: classes, fields, enums, methods, all named after your DSM model.

  • Autocomplete and go-to-definition in any IDE
  • Type checking before you run anything
  • Rename refactor across the whole codebase
  • Same ergonomics in Python and C++

Runtime reality

What actually executes: the dynamic Viper value tree with its metadata, mutation DAG, attachments, and dispatch.

  • Typed accessors call straight into Viper — no wrapper
  • RPC, persistence, and serialization for free
  • The bridge is generated, never hand-written
  • Schema changes regenerate the bridge — no migration code

Two surfaces, one source of truth

Pick a Python template, a C++ template, or both. Kibo emits the chosen surfaces ; when you take both, they stay in lock-step by construction (same DSM source) — no manual proxy code to maintain, no drift between languages.

Python package

Importable as import <namespace>, usable through the dsviper runtime.

  • data.py — classes for namespaces, concepts, clubs, enums, structures
  • definitions.py — type definitions for Viper
  • attachments.py — attachment API wrappers
  • database_attachments.py — database-backed attachments
  • path.py — field-path constants
  • function_pools.py — function-pool wrappers (local and remote)
  • pyproject.toml — ready to pip install as a wheel

C++ surfaces

Headers and implementations linking against the Viper C++ engine — for embedding inside a native application.

  • *_Data.hpp/cpp — type implementations
  • *_Definitions.hpp/cpp — definitions, paths, fields
  • *_Database*.hpp/cpp — SQLite persistence layer
  • *_Reader/Writer.hpp/cpp — binary and JSON codecs
  • *_ValueCodec/Hasher/Type.hpp/cpp — bridge to dynamic Viper C++ values
  • *_FunctionPools.hpp/cpp — function-pool surfaces (local and remote)
  • *_Python.hpp/cpp — module constants for the C++ → Python bridge

Pack contents

Six categories of templated features. Each row in the pack is a single -t argument to Kibo, opt-in independently.

Core Types

Data, Model, ValueType — typed classes, definitions, paths.

Persistence

Database, Attachments — SQLite persistence, attachment accessors.

Serialization

Stream, Json, ValueCodec, ValueHasher.

Function Pools

FunctionPool, AttachmentFunctionPool + remote RPC variants.

Python Bridge

Python — module constants for C++ apps embedding Python.

Testing

Test, TestApp — unit tests and runnable entry points, including a seedable fuzz harness.

Distribution and source

In the DevKit ZIP

Bundled alongside Kibo and the rest of the toolchain. No separate install — pulled from /downloads with the rest of DevKit.

On GitHub

digital-substrate/kibo-template-viper — public source repository. Open template format, so a third-party pack can target any other runtime (e.g. kibo-template-django, kibo-template-protobuf).

Generate Your First Package

Walk through a complete generation script, then package the typed Python output as an installable wheel.