Skip to content
Packages Examples Agents Blog Get started

Core types and protocols for the Oridecon Framework.


oridecon-contracts defines all Protocols, base types, Result types, domain models, and exception hierarchies used across the Oridecon ecosystem. It has zero runtime dependencies so it can be imported into any package — including thin integrations — without pulling in the full framework.

This package is the single source of truth for every interface in Oridecon. All other packages depend on contracts; no implementation package defines its own protocol that another package depends on.

Full documentation: oridecon.dev

Terminal window
uv add oridecon-contracts
from oridecon.result import Result, Ok, Err
async def find_user(user_id: str) -> Result[User, UserNotFound]:
user = await db.get(user_id)
if not user:
return Err(UserNotFound(user_id))
return Ok(user)
# Safe consumption
result = await find_user("u-123")
name = result.match(ok=lambda u: u.name, err=lambda e: "unknown")
from oridecon.domain.models import Entity, ValueObject
from oridecon.domain import AggregateRoot
from oridecon.contracts.domain.events import DomainEvent
class UserCreated(DomainEvent):
user_id: str
email: str
class User(AggregateRoot):
email: str
from oridecon.contracts.infra.cache import CacheBackendProtocol
from oridecon.contracts.data import DatabaseProviderProtocol
from oridecon.contracts.security.secrets import SecretStoreProtocol
ModuleWhat it contains
oridecon.resultResult[T, E], Ok, Err, as_result(), as_result_sync(), try_catch(), ResultPipeline
oridecon.domain.modelsDomainModel, Entity, ValueObject (concrete domain models, in core oridecon)
oridecon.domainAggregateRoot (re-exported from oridecon.domain.models.aggregate)
oridecon.contracts.domain.baseDomainModelProtocol, ID
oridecon.contracts.domain.eventsDomainEvent
oridecon.contracts.infra.cacheCacheBackendProtocol
oridecon.contracts.dataDatabaseProviderProtocol
oridecon.contracts.security.secretsSecretStoreProtocol
oridecon.contracts.core.diContainerRegistrarProtocol, ContainerResolverProtocol
oridecon.contracts.core.providerProviderProtocol, ProviderPriority
oridecon.contracts.core.registryRegistryProtocol, StrategyRegistryProtocol, BackendRegistryProtocol
oridecon.contracts.exceptionsOrideconError, full error hierarchy
FileWhat it contains
src/oridecon/contracts/__init__.pyLazy-loading re-exports of all public types
src/oridecon/result/Result type and Ok/Err helpers
src/oridecon/contracts/domain/DomainModelProtocol, DomainEvent
src/oridecon/contracts/core/Container, Provider, Registry protocols
src/oridecon/contracts/exceptions/OrideconError and domain error hierarchies
  • Zero dependencies — no third-party runtime imports
  • Protocol-only — defines interfaces, never implementations
  • Stable contract — all other Oridecon packages depend on this one; breaking changes are versioned