Python SDK for System Capability Protocol - programmatic manifest/graph access and integration framework
Project description
SCP SDK
Python SDK for the System Capability Protocol (SCP) - programmatic access to manifests and graphs, plus a framework for building integrations.
Features
- Core Models: Type-safe Pydantic models for SCP v0.1 manifests
- Graph Abstraction: Efficient querying and traversal of system dependencies
- Integration Framework: Reusable base classes and utilities for building integrations (60-80% code reduction)
- Fully Tested: Comprehensive test suite with pytest
Installation
# Using uv (recommended)
cd /path/to/scp-sdk
uv sync
# Or with pip
pip install -e .
Quick Start
Load and Query Manifests
from scp_sdk import Manifest
# Load from file
manifest = Manifest.from_file("scp.yaml")
# Or from YAML string
yaml_str = """
scp: "0.1.0"
system:
urn: "urn:scp:payment-service"
name: "Payment Service"
classification:
tier: 1
"""
manifest = Manifest.from_yaml(yaml_str)
# Query
print(manifest.urn) # urn:scp:payment-service
print(manifest.tier) # 1
print(manifest.team) # team name
# Get specific dependency
dep = manifest.get_dependency("urn:scp:user-service")
print(dep.criticality) # required
Build and Query Graphs
from scp_sdk import Graph
# Load from unified JSON (from scp-cli scan --export json)
graph = Graph.from_file("graph.json")
# Or build from manifests
graph = Graph.from_manifests([manifest1, manifest2])
# Query
for system in graph.systems():
print(system.name)
# Find system
payment_svc = graph.find_system("urn:scp:payment-service")
# Get dependencies
deps = graph.dependencies_of(payment_svc)
# Get blast radius (what depends on this system)
dependents = graph.dependents_of(payment_svc)
Build Custom Integrations
The SDK makes building integrations incredibly simple:
from scp_sdk.core.graph import SystemNode, DependencyEdge
from scp_sdk.integrations.base import IntegrationBase
from scp_sdk.integrations.registry import register_integration
@register_integration("pagerduty")
class PagerDutyIntegration(IntegrationBase):
"""Sync SCP systems to PagerDuty services."""
def sync_system(self, system: SystemNode) -> None:
"""Create/update PagerDuty service."""
service_data = {
"name": system.name,
"description": f"SCP System: {system.urn}",
"escalation_policy": self.get_policy(system.team),
}
# Call PagerDuty API...
def sync_dependency(self, edge: DependencyEdge) -> None:
"""Sync dependency (optional for PagerDuty)."""
pass
# Usage
from scp_sdk.integrations.config import IntegrationConfig
config = IntegrationConfig(name="pagerduty", auth={...})
integration = PagerDutyIntegration(config)
result = integration.sync(graph)
The SDK handles:
- Graph iteration
- Error handling & retries
- Logging
- Dry-run mode
- ID caching
- Field mapping utilities
Development
# Install dependencies
make setup
# Run tests
make test
# Run linter
make lint
# Format code
make format
# Type check
make typecheck
# Run all checks
make check
# Run examples
make examples
Examples
See the examples/ directory:
basic_usage.py- Loading and querying manifests/graphscustom_integration.py- Building a PagerDuty integration
Run them with:
uv run python examples/basic_usage.py
uv run python examples/custom_integration.py
Related Projects
- scp-definition - SCP specification and JSON schema
- scp-integrations - CLI tools for scanning and exporting
- scp-viewer - Web dashboard for visualizing architectures
- scp-demo - Demo project for example models
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scp_sdk-0.1.0.tar.gz.
File metadata
- Download URL: scp_sdk-0.1.0.tar.gz
- Upload date:
- Size: 59.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca2ea7de4f663b866224fc4b81a0067219c006c250ee122c8a6ef2f73a7fad75
|
|
| MD5 |
9f6cc4015a1941f5cb7df031eac9595d
|
|
| BLAKE2b-256 |
fc5efa05293344bdd9ddaf817eb782f0b31e07e3b89f2d4742bf12c7c641044f
|
Provenance
The following attestation bundles were made for scp_sdk-0.1.0.tar.gz:
Publisher:
ci.yml on krackenservices/scp-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scp_sdk-0.1.0.tar.gz -
Subject digest:
ca2ea7de4f663b866224fc4b81a0067219c006c250ee122c8a6ef2f73a7fad75 - Sigstore transparency entry: 829022085
- Sigstore integration time:
-
Permalink:
krackenservices/scp-sdk@ba2ad353c9929fbb62a3c0ed29e2f59b6984532b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/krackenservices
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@ba2ad353c9929fbb62a3c0ed29e2f59b6984532b -
Trigger Event:
push
-
Statement type:
File details
Details for the file scp_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: scp_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccf4190c86c45d69d25629f66154a62a4f291c3801222f91caa1574621189930
|
|
| MD5 |
eed857ea5f43519bdf1d5579979de7fc
|
|
| BLAKE2b-256 |
5314d5c3ef695cb22eeeb5a8f79976b75bbfebc0d0031d883580cf3491be13a7
|
Provenance
The following attestation bundles were made for scp_sdk-0.1.0-py3-none-any.whl:
Publisher:
ci.yml on krackenservices/scp-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scp_sdk-0.1.0-py3-none-any.whl -
Subject digest:
ccf4190c86c45d69d25629f66154a62a4f291c3801222f91caa1574621189930 - Sigstore transparency entry: 829022096
- Sigstore integration time:
-
Permalink:
krackenservices/scp-sdk@ba2ad353c9929fbb62a3c0ed29e2f59b6984532b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/krackenservices
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@ba2ad353c9929fbb62a3c0ed29e2f59b6984532b -
Trigger Event:
push
-
Statement type: