Skip to main content

Module python

Module python 

Source
Expand description

Python stack SDK generation.

Mirror of crate::rust emitting a Python package next to the TS/Rust outputs (see docs/internal/sdk-python-alignment.md §4). The generated package instantiates the arete runtime’s binding model (arete.stack.StackDef / ProgramDef, arete.views.ViewDef) as pure data + pure functions:

  • __init__.py<STACK_NAME>_STACK: StackDef binding + re-exports.
  • models.py — entity dataclasses + *_from_wire / *_patch_from_wire converters (snake_case pass-through, u64 decimal strings → int, nested structs).
  • views.py — typed view namespace classes + the VIEWS map consumed by StackDef.
  • programs.py — per-program <Ix>Params TypedDicts, raw builders, raw *_handler() escape hatches, PDA factories, typed account read definitions, release identity consts + *_read_descriptor(), error metadata tables, and the PROGRAMS / PROGRAM_READS maps.

Structs§

PythonAliasedStackOutput
PythonCompositionConfig
PythonCompositionOutput
PythonOutput
PythonProgramReadConfig
PythonStackConfig

Functions§

compile_composed_public_artifacts_v2
Generate one namespaced Python stack package per live alias plus a root __init__.py that preserves alias boundaries instead of flattening views/adapters.
compile_public_artifacts
Compile Python output from an explicit StackManifest and its public dependencies.
compile_public_artifacts_v2
Compile typed V2 public artifacts through the current single-live generator.
compile_stack_spec
Compile a full SerializableStackSpec (multi-entity) into a Python package.
compile_stack_spec_with_exact_views
Compile a stack model whose views have already been projected by a StackManifest selected-view allowlist.
python_module_name
Derive a valid Python module name from an arbitrary alias or file stem (lowercased, non-alphanumerics collapsed to _, keywords and leading digits escaped). Shared with the CLI so staged devex extension files wire up under the same stems the composition generator would use. Mirror of crate::rust::rust_module_name.
write_python_composition_module
write_python_composition_package
write_python_module
Write a plain source package directory (dropped into a user’s project): __init__.py, models.py, views.py, and programs.py when generated.
write_python_package
Write a pip-installable layout: pyproject.toml plus the import package directory (mirror of write_rust_crate’s packaging wrapper).