Python Shellbound SDK
This repository has been archived on 2026-04-16. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
Tyler King 89a054d656 initial: substrate-sdk-python v0.1.0
Python SDK for shellbound Django applications.
Provides ShellApp, ShardContext, ShellboundMiddleware.
Emits Chronicle events to stdout in dev mode.

Includes fix for IndexError in apps.py when
DJANGO_SETTINGS_MODULE has no dots (e.g.
instance_settings). Shard name now falls back
safely without eager default argument parsing.

Implements SHELLBOUND-APP-0001 §4 (dev mode).
Wired into entropyopposition as of 2026-03-18.
2026-03-18 13:53:58 -04:00
substrate_sdk initial: substrate-sdk-python v0.1.0 2026-03-18 13:53:58 -04:00
tests initial: substrate-sdk-python v0.1.0 2026-03-18 13:53:58 -04:00
.gitignore initial: substrate-sdk-python v0.1.0 2026-03-18 13:53:58 -04:00
pyproject.toml initial: substrate-sdk-python v0.1.0 2026-03-18 13:53:58 -04:00
README.md initial: substrate-sdk-python v0.1.0 2026-03-18 13:53:58 -04:00

substrate-sdk-python

Build shellbound applications. Any Python framework. Any deployment. Trust rooted in hardware.

Install

pip install substrate-sdk[django]

Django (2 lines)

# settings.py
INSTALLED_APPS = [
    ...
    'substrate_sdk.django',
]
MIDDLEWARE = [
    ...
    'substrate_sdk.django.ShellboundMiddleware',
]

Every request is Chronicle-attributed. Every model save is Chronicle-recorded. If a bascule shell is present: fully governed. If not: development mode, works normally.

Direct usage

from substrate_sdk import ShellApp

app = ShellApp(shard_name="my-app", capabilities={"network": True})
context = app.register()
print(context.is_governed)  # True if shell present
print(context.shard_did)     # DID assigned by shell

What this does

When running inside a Substrate FFC:

  • Your process gets a DID + SPIFFE SVID
  • Your process gets a governed accord
  • Every request is Chronicle-attributed
  • Every operation is audit-verifiable
  • You participate in the governance fabric

When running locally (no shell):

  • Development mode — everything works normally
  • Chronicle events go to stdout
  • No governance enforcement
  • Zero impact on application behavior

Phase B: HFL Direct Binding (planned)

When the HFL kernel module is present, substrate_sdk will route Chronicle events through substrate-hfl-python (PyO3) instead of stdout. This upgrades a Tier 4 deployment to Tier 1/2 with zero application code changes.

Phase A (current):  SDK → stdout → bascule-filter → Chronicle
Phase B (planned):  SDK → substrate-hfl-python (PyO3) → HFL → Chronicle

substrate-hfl-python is a new crate in the substrate workspace:

  • Depends on hfl-types
  • Exposes: chronicle_write(), accord_check(), session_get()
  • substrate_sdk/chronicle.py detects HFL availability and routes automatically