Skip to main content

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 inputs and outputs for 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:

  1. Whitelists Access: Can only read what is in inputs and write to outputs.
  2. Proxies Writes: All writes go to a generic Transaction layer.
  3. 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

pop_sdk-0.1.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pop_sdk-0.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file pop_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: pop_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pop_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 803186e2e06928018308d287325475fb42487c8230b0649c1f498f07bff0a073
MD5 f90d28377f9a496940b7c285a85b58d4
BLAKE2b-256 9473fac28fffd2de0b3b574ef122e12d4a98c0d67a048bab43738e4d94d07c26

See more details on using hashes here.

File details

Details for the file pop_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pop_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pop_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f48819f13a3d532bb4ac7a723e45412127c86af9b359653fb9cc042e0fdc9d5
MD5 76e342017713d9aa26841c62a694bf1b
BLAKE2b-256 bb88a5fb9689ac55699b18e6604cb055f7df5b3e76acf7a50e902b3452662d75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page