Skip to main content

Layered operations tree — observe, diff, orchestrate infrastructure as data

Project description

op3 — Layered Operations Tree

AI Cost Tracking

PyPI Version Python License AI Cost Human Time Model

  • 🤖 LLM usage: $0.9000 (6 commits)
  • 👤 Human dev: ~$215 (2.2h @ $100/h, 30min dedup)

Generated on 2026-04-21 using openrouter/qwen/qwen3-coder-next


Layered infrastructure observation: observe, diff, orchestrate infrastructure as data.

Overview

op3 provides a unified framework for observing hierarchical infrastructure state across multiple layers:

  • Physical Layer: Hardware, displays, network, compute
  • OS Layer: Kernel, configuration
  • Runtime Layer: Containers, compositor
  • Service Layer: Containers, systemd services
  • Endpoint Layer: HTTP endpoints, TCP ports
  • Business Layer: Application health, business logic

Built on fraq's fractal data primitives, op3 enables:

  • Deterministic layer scanning with probe system
  • Format adapters (LESS, migration.yaml, snapshot.yaml)
  • Drift detection between intended and actual state
  • Immutable snapshots with diff capabilities

Installation

pip install op3

Quick Start

from opstree import LayerTree, LinearScanner, scan_device
from opstree.layers.builtin import PhysicalLayer, OsLayer, RuntimeLayer

# Register layers
tree = LayerTree()
tree.register(PhysicalLayer.display)
tree.register(OsLayer.kernel)
tree.register(RuntimeLayer.container)

# Scan a device
def execute(cmd: str):
    # Your SSH/local execution logic
    stdout, stderr, rc = ...
    return stdout, stderr, rc

snapshot = scan_device("pi@192.168.188.109", execute, tree)
print(snapshot.to_yaml())

Format Adapters

from opstree.formats.less import LessAdapter

adapter = LessAdapter()

# Parse LESS to PartialSnapshot
partial = adapter.parse(open("app.doql.less").read())

# Render Snapshot to LESS
less_output = adapter.render(snapshot)

Project Status

Sprint 4 Complete (2026-04-21)

  • ✅ Fixed datetime deprecation warnings (datetime.utcnow() → datetime.now(timezone.utc))
  • ✅ All 26 tests passing with zero warnings

Sprint 5 Complete (2026-04-21)

  • ✅ Added business.health builtin probe
  • ✅ Added CLI layer filtering option (--layers flag)

Sprint 6 Complete (2026-04-21)

  • ✅ Tested op3 with real-world examples from fraq, redeploy, doql
  • ✅ Created examples/ folder with app.doql.less files from all three projects
  • ✅ Enhanced CLI convert command to handle migration.yaml format
  • ✅ All 26 tests passing

Sprint 3 Complete (2026-04-21)

  • ✅ CLI with scan, drift, and convert commands
  • ✅ Builtin probes (service.containers, endpoint.http)
  • ✅ Format conversion between LESS, migration.yaml, snapshot.yaml
  • ✅ CLI integration tested

Sprint 2 Complete (2026-04-21)

  • ✅ Probe contexts (SSH, Local, Mock)
  • ✅ Builtin probes (RPi display, Linux OS, container runtime)
  • ✅ Format adapters (migration.yaml, snapshot.yaml)
  • ✅ Integration tests with mock context (2 passing)
  • ✅ ExecuteResult handling for compatibility

Sprint 1 Complete (2026-04-21)

  • ✅ Layer tree with topological ordering
  • ✅ Builtin layer definitions
  • ✅ Snapshot model with Pydantic
  • ✅ Probe protocol and registry
  • ✅ Linear scanner
  • ✅ Format registry (wraps fraq)
  • ✅ LESS format adapter
  • ✅ Unit tests (16 passing)

Dependencies

  • fraq >= 0.2.15 (core primitives: FraqNode, FormatRegistry, adapters)
  • pydantic >= 2.0
  • pyyaml >= 6.0
  • click >= 8.0
  • jmespath >= 1.0
  • rich >= 13.0

License

Licensed under Apache-2.0.

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

op3-0.1.7.tar.gz (116.6 kB view details)

Uploaded Source

Built Distribution

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

op3-0.1.7-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

Details for the file op3-0.1.7.tar.gz.

File metadata

  • Download URL: op3-0.1.7.tar.gz
  • Upload date:
  • Size: 116.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for op3-0.1.7.tar.gz
Algorithm Hash digest
SHA256 b4d7ba43a9245dacae3b9122013e867f73b2f7fa989200a9a8d9e26c5592bdbf
MD5 f752e54d674c3e81cdcee3e3a3a5400b
BLAKE2b-256 a29fb0f9f1eb48affd5c4fafa3eda2144401130c5b7a230c4c446c61acb60b51

See more details on using hashes here.

File details

Details for the file op3-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: op3-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for op3-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 81c4c52fc9fc93a8304bc6aea4dd8b3eeb3b9a41c37311ae364dc471d34bbb82
MD5 20afc467b9ecd875576c46b2c071ff2e
BLAKE2b-256 cb3d45eb648fe987233959d92c7b3abd9047c46cb82e226a37b821de21e371a9

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