functualize-state
Status: Published — Independently installable from PyPI.
State Domain SDK for functualize providing well-defined protocols for key-value state persistence and execution tracking. Enables custom storage backend implementations (SQLite, Redis, DynamoDB, etc.) without coupling your application to any specific database.
Installation
pip install functualize-state
Quick Start
from functualize_state import InMemoryState, StateNamespace
# Create a backend (use InMemoryState for testing, or implement StateBackend)
backend = InMemoryState()
# Use namespaces to isolate keys by concern
ns = StateNamespace(backend, prefix="deploy:")
ns.set("version", "1.2.0")
ns.set("status", "pending")
print(ns.get("version")) # "1.2.0"
print(ns.keys()) # ["version", "status"]
Features
- Backend-agnostic protocols —
StateBackendandExecutionStoredefine the interface; bring your own storage implementation - Namespace isolation —
StateNamespaceprovides prefix-scoped views over any backend, preventing key collisions between components - Execution tracking — Record job executions, phases, and session metadata with structured
ExecutionRecordandPhaseRecordtypes - Event-driven observability — Built-in event constants (
STATE_EXECUTION_STARTED,STATE_EXECUTION_COMPLETED,STATE_PHASE_CHANGED) for lifecycle hooks - Test-friendly — Ships
InMemoryState, a dict-backed backend for fast, deterministic unit tests - Fully typed — PEP 561 compliant with
py.typedmarker; all protocols are@runtime_checkable
API Reference
Protocols
StateBackend— Key-value state operations protocol (get,set,delete,keys)ExecutionStore— Execution record persistence protocol (insert_execution,update_execution,get_session_executions,insert_phase,get_execution_phases)
Classes
StateNamespace— Prefix-scoped view over aStateBackendfor isolated key accessInMemoryState— Dict-backedStateBackendimplementation for testingDomainMetadata— Self-describing metadata dataclass for the state domain SDK
Data Types
ExecutionRecord— Frozen dataclass representing a single job execution (id, job name, session, status, timing, result)PhaseRecord— Frozen dataclass representing a phase within an executionSessionRecord— Frozen dataclass representing a session with metadata
Errors
StateNotAvailable— Raised when a state backend is not availableKeyNotFoundError— Raised when a requested key is not found
Event Constants
STATE_EXECUTION_STARTED— Fired when an execution beginsSTATE_EXECUTION_COMPLETED— Fired when an execution finishesSTATE_PHASE_CHANGED— Fired when a phase transition occurs
Module-Level
domain_metadata— Pre-configuredDomainMetadatainstance for the state domain
Development
Run plugin tests:
uv run pytest plugins/functualize-state/tests/ -v
Release files for functualize-state 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| functualize_state-0.1.0.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| functualize_state-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.9 kB
Release files / functualize_state-0.1.0.tar.gz
| Download URL | functualize_state-0.1.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1fdb45aaa3cc56f47c0bfde2e0f81906acc461cf8c228ed6aa131ee5b58f677a
|
|
BLAKE2b-256 checksum How to use checksums |
ca4b8156d57b27392052c79351ef4a22c0d4c60ff61467ea84e50180a3127214
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / functualize_state-0.1.0-py3-none-any.whl
| Download URL | functualize_state-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aca976b81ae5f7a8011d1d4c9958c819ecfc1bf34215f95243c3a5ff6834a4d5
|
|
BLAKE2b-256 checksum How to use checksums |
99929067fc3937902197f1762641ab1edff0e83161098302fa63840e99748a8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|