Skip to main content

ONEX Service Provider Interface - Protocol definitions

Project description

omnibase_spi

omnibase_spi is the Service Provider Interface package for ONEX (OmniNode eXecution). It defines protocol contracts, small wire-format contracts, and SPI exceptions that other repos implement or consume.

This package is intentionally not the implementation layer. Concrete runtime, transport, service, registry, and I/O behavior belongs in implementation repos such as omnibase_infra.

CI Python 3.12+ License: MIT Ruff Checked with mypy pre-commit

Current Role

  • Defines 248 protocol_*.py files across 37 protocol domains.
  • Provides runtime-checkable Python Protocol contracts for service boundaries.
  • Provides frozen, data-only contracts in src/omnibase_spi/contracts/ for selected cross-boundary wire formats.
  • Imports omnibase_core models and types where protocol signatures need shared platform data shapes.
  • Must not import implementation packages such as omnibase_infra.
  • Must not contain service implementations, business workflows, state machines, transport clients, or general domain Pydantic models.

Dependency Direction

The import direction is deliberate and non-obvious:

Application and product repos
        |
        v
omnibase_spi  ---- imports models/types ---->  omnibase_core
        ^                                      ^
        | implements protocols                 | uses models/types
        |
omnibase_infra and other implementation repos --+

Allowed:

  • omnibase_spi -> omnibase_core
  • omnibase_infra -> omnibase_spi
  • omnibase_infra -> omnibase_core
  • Product repos importing SPI protocols for type boundaries

Forbidden:

  • omnibase_core -> omnibase_spi
  • omnibase_spi -> omnibase_infra
  • Protocol files that perform I/O or instantiate concrete services
  • General domain BaseModel classes in SPI protocol modules

See Dependency Direction for the full rule, examples, and rationale.

Install

uv add omnibase_spi

For local workspace development, use the repository lockfile and the configured omnibase-core source:

uv sync --group dev

Minimal Protocol Example

from typing import Protocol, runtime_checkable


@runtime_checkable
class ProtocolExampleService(Protocol):
    """Service boundary implemented outside omnibase_spi."""

    async def run(self, payload: bytes) -> bytes:
        """Run the service operation."""
        ...

Add A Protocol

  1. Choose the domain under src/omnibase_spi/protocols/.
  2. Create a protocol_<domain>_<name>.py file.
  3. Name the public protocol Protocol<Name>.
  4. Add @runtime_checkable.
  5. Use ... method bodies only.
  6. Import shared models from omnibase_core only when the signature requires canonical platform models or types.
  7. Add or update tests under tests/.
  8. Export the protocol from the domain __init__.py if it is public.

Common Commands

uv sync --group dev
uv run pytest
uv run mypy src/ --strict
uv run ruff check src/ tests/
uv run ruff format src/ tests/
python scripts/validation/run_all_validations.py
pre-commit run --all-files
uv build

Documentation

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

omnibase_spi-0.22.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

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

omnibase_spi-0.22.0-py3-none-any.whl (744.7 kB view details)

Uploaded Python 3

File details

Details for the file omnibase_spi-0.22.0.tar.gz.

File metadata

  • Download URL: omnibase_spi-0.22.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for omnibase_spi-0.22.0.tar.gz
Algorithm Hash digest
SHA256 a527e1e4fcff790d11ba78a5345cb9c58f1e36158a38bf83cf1c27ad22f87c66
MD5 158f0a53edc9363dd31cb66a77d6bca4
BLAKE2b-256 437d219a855c2e556030be09255dee9d5320cf21360a5372e05f91be042d84bb

See more details on using hashes here.

File details

Details for the file omnibase_spi-0.22.0-py3-none-any.whl.

File metadata

  • Download URL: omnibase_spi-0.22.0-py3-none-any.whl
  • Upload date:
  • Size: 744.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for omnibase_spi-0.22.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54f7f49a4e33c6d3f4fe185926e440c822671962da5ab976214db30af110c0af
MD5 ede1e62d0661524eec9e76dd2785ecdb
BLAKE2b-256 ce33c8e98b6200f9a078b2d9205091467c6eddf2fd4a1cce9ca989b7ca256d1b

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