opentide

Python SDK

Embed OpenTide in Python applications — registry lifecycle, validation, documentation, and platform plugins.

The opentide PyPI package exposes a typed programmatic API centred on the OpenTide registry singleton.

from opentide import OpenTide, __version__

OpenTide.initialise()
print(__version__, len(OpenTide.Rules))

Public entry points

SymbolModulePurpose
OpenTideopentide.core.registryRegistry singleton
__version__opentide._versionPackage version string

Additional APIs are importable from subpackages (opentide.validation, opentide.documentation, opentide.models) but the registry is the primary integration surface.

Documentation map

PageTopic
InstallationExtras and typing support
RegistryLifecycle, accessors, lookup
Validationrun_validation, scopes, reports
Documentation APIRender and write markdown pages
ModelsPydantic object types
PlatformsDeployers, validators, plugins

Worked example: validate then deploy

A complete pipeline — initialise, validate the whole repo, and dry-run deploy the rules that pass:

from opentide import OpenTide
from opentide.validation.session import run_validation
from opentide.validation.scope import ValidationScope
from opentide.core.errors import Errors

OpenTide.initialise()

# 1. Validate the entire workspace
report = run_validation(scope=ValidationScope.full())
if not report.ok:
    for issue in report.errors:
        print("ERROR:", issue.to_legacy_string())
    raise SystemExit(1)

# 2. Deploy production rules to Sentinel (dry-run first)
platform = "sentinel"
if not OpenTide.Platforms[platform].can_deploy:
    raise SystemExit(f"{platform} has no deployer configured")

for uuid, rule in OpenTide.Rules.items():
    if rule.status != "PRODUCTION":
        continue
    try:
        result = rule.deploy(platform, dry_run=True)
        print(uuid, result.dry_run, result.message)
    except Errors.TideDeploymentErrors as exc:
        print("DEPLOY FAILED", uuid, exc)

Set dry_run=False and provide credentials for a real deploy. See Validation and Models → delegation.

Choosing between SDK, CLI, and MCP

Use the SDK to embed the engine in Python; use the CLI for humans and pipelines; use MCP for agents. See Choosing an interface.

CLI and MCP

The CLI and MCP server are thin wrappers around the same engine modules documented here.

SurfaceEntry
CLIopentide.cli
MCPopentide.mcp_server

Type hints

The package ships py.typed (PEP 561). Use ty or mypy in consuming projects.

Source layout

src/opentide/
├── __init__.py          # OpenTide, __version__
├── core/registry.py     # OpenTideRegistry
├── models/              # Pydantic models
├── validation/          # Pipeline and reports
├── documentation/       # Markdown rendering
├── platforms/           # Platform adapters
└── loading/             # YAML loaders

On this page