Process-Oriented Programming (POP) SDK for Python
Project description
POP SDK (Process-Oriented Programming)
A Transactional, Context-Driven Framework for AI Agents & Complex Systems.
POP (Process-Oriented Programming) is a paradigm shift from OOP. Instead of encapsulating state and behavior together, POP decouples them completely:
- Context: Dumb Data structures (State).
- Process: Pure Functions (Behavior) that transform Context.
- Guard: Strict Permissions & Transactional Integrity.
🌟 Key Features
- Transactional State: ACID-like memory transactions. Changes are isolated until commit. Rollbacks on error.
- Deep Isolation: Nested lists/dictionaries are automatically shadowed. Modification of deep state never leaks to the main context until approved.
- Strict Contracts: Define
inputsandoutputsfor every process. Runtime enforcement prevents "State Spaghetti". - Zero-Dependency Core: Pure Python. Compatible with PyTorch/TensorFlow/NumPy environments.
🚀 Quick Start
1. Define Context
from dataclasses import dataclass
from pop import BaseGlobalContext, BaseDomainContext, BaseSystemContext
@dataclass
class MyGlobal(BaseGlobalContext):
counter: int = 0
@dataclass
class MyDomain(BaseDomainContext):
data: list = None
@dataclass
class MySystem(BaseSystemContext):
global_ctx: MyGlobal
domain_ctx: MyDomain
2. Define Processes
from pop import process
@process(
inputs=['global.counter'],
outputs=['global.counter']
)
def increment(ctx):
ctx.global_ctx.counter += 1
return "Incremented"
3. Run Engine
from pop import POPEngine
# Init System
system = MySystem(MyGlobal(), MyDomain(data=[]))
engine = POPEngine(system)
# Register & Run
engine.register_process("p_inc", increment)
result = engine.run_process("p_inc")
print(f"Counter: {system.global_ctx.counter}") # Output: 1
🛡️ Architecture
The Context Guard
Every process runs inside a ContextGuard. This guard:
- Whitelists Access: Can only read what is in
inputsand write tooutputs. - Proxies Writes: All writes go to a generic
Transactionlayer. - Prevent Leaks: Proxies are "Auto-Unwrapped" to preventing Zombie references.
Delta Engine
State changes are stored as a list of DeltaEntry operations.
- Commit: Applies entries to the real object.
- Rollback: Helper function reverses changes (Time Travel).
📦 Installation
pip install pop-sdk
📄 License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pop_sdk-0.1.1.tar.gz.
File metadata
- Download URL: pop_sdk-0.1.1.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bf446f5bdde35d1f5577108812eadc14dc946acdc9c9edb6e096711d3c1a2c8
|
|
| MD5 |
02c65421d7f326d40962c11abbcb19d8
|
|
| BLAKE2b-256 |
da4fcd3507b2046c2baa0cede73142eaaeb52a036c44013632eeabc442e22149
|
File details
Details for the file pop_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pop_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d142d551ed7a920fa7b53f3cd0c58990b418364d45071877d74ed2ab2ed01f80
|
|
| MD5 |
d86e81da67e18989f593524adf772715
|
|
| BLAKE2b-256 |
b894943cc86bd305435c23edc3c5dc35f3f1fbe2bc2fbefa384b00b823f5234b
|