Skip to main content

Soma Python provider helper

Soma embeds this dependency-free module into the Python provider bridge. A drop-in provider can import the decorator without installing a package. The same module is packaged as the soma-provider distribution for IDEs, tests, and Python projects that want an explicit dependency:

uv pip install ./packages/python

Provider files use the same import in both modes:

from soma_provider import Context, provider, tool

PROVIDER = provider(name="example", kind="python")

@tool(
    name="greet",
    title="Greet",
    input_schema={
        "type": "object",
        "additionalProperties": False,
        "properties": {"name": {"type": "string"}},
        "required": ["name"],
    },
)
def greet(name: str, ctx: Context) -> dict:
    """Return a greeting with runner request identity."""
    return {
        "message": f"Hello, {name}!",
        "surface": ctx.request.surface,
    }

The decorator returns the original function unchanged and records only JSON-compatible metadata. Omitted fields keep the adapter's existing defaults: function name and docstring discovery, annotation-based input-schema inference, and generated CLI exposure. Dependency-free inference covers Annotated descriptions and constraints, TypedDict required and optional keys, dataclasses, literals, unions/nullability, fixed and variadic tuples, and typed mapping values. Parameters annotated as Context are excluded from the public input schema and injected by the runner. The one-shot compatibility runner supplies request identity and explicit unavailable capability handles. Persistent brokered workers provide live HTTP, secrets, namespaced state, logging, metrics, progress, and cancellation handles under the provider declaration, deployment policy, actor scopes, and host availability intersection.

Broker capability calls are async so they do not block the provider event loop:

response = await ctx.http.request("GET", "https://api.example.com/data")
secret = await ctx.secrets.get("example-key")
current = await ctx.state.get("counter")
await ctx.state.set("counter", (current or 0) + 1)
await ctx.log.emit("info", "updated", counter=current)
await ctx.metrics.increment("updates")
await ctx.progress.update(1, total=1, message="done")

HTTP request and response bodies are lossless bytes (body_bytes) with base64-encoded transport. Broker policy denials remain typed CapabilityUnavailableError failures instead of being reported as worker crashes.

The experimental componentize preflight statically inspects source and explicit wheel evidence without importing or executing provider code:

from soma_provider import scan_componentize_compatibility

report = scan_componentize_compatibility(
    source,
    filename="provider.py",
    wheel_files=["dependency-1.0.0-py3-none-any.whl"],
)

It fails closed on native extensions, non-pure wheels, dynamic imports, process, thread, socket, native-FFI, and other ambient-authority assumptions. A compatible report means only that the provider is eligible for later isolated build and Wasmtime validation. It does not transpile Python or claim runtime compatibility.

Rust's provider-core manifest and adapter validation remain authoritative. The tests/soma_runner_protocol.py module is also internal: it implements the bounded length-prefixed JSON codec, version negotiation, and feature intersection used by persistent-runner contract fixtures. One-shot remains the default runtime. SOMA_PYTHON_RUNNER_MODE=persistent activates supervised installed-wheel workers for catalog and invocation. Set SOMA_PYTHON_EXECUTION_PROFILE=brokered with explicit broker policy to activate the fail-closed capability and containment boundary.

pyproject.toml defines the soma-provider 0.2.x maturin mixed package for Python 3.11 and newer. The pure-Python facade remains usable without a native extension; built wheels include the private soma_provider._soma_native abi3 module for provider-core manifest validation and an SDK/native version check. uv.lock pins development/build resolution, and the package smoke test builds and installs the wheel in isolation. The repository now enforces an independent soma-provider-v* tag and version parity across Python and Cargo metadata; trusted PyPI publication, signing, provenance, and release execution remain separate milestones. Replacing a Python implementation with WASM should preserve the provider contract rather than attempt to transpile arbitrary Python code. The canonical delivery status and remaining milestones live in docs/specs/python-provider-platform.md.

Metadata

Release files for soma-provider 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for soma-provider 0.2.0
File
soma_provider-0.2.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
soma_provider-0.2.0-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details
soma_provider-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details
soma_provider-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 10.7 MB

Release files / soma_provider-0.2.0-cp311-abi3-win_amd64.whl

Download URL soma_provider-0.2.0-cp311-abi3-win_amd64.whl
Size 2.4 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
059f37d43e8f798c1f9a27a417bb5077d147c3ecd29bb527869e4eee567e9a5e
BLAKE2b-256 checksum
How to use checksums
0b07f5252bc7a6cda5abd9af49c584793c775c6e80835912c7fcafa9aaacfed6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / soma_provider-0.2.0-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL soma_provider-0.2.0-cp311-abi3-musllinux_1_2_x86_64.whl
Size 2.9 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
230b94b69637e49eda8b0e3dacc64b8d4facdf23b43cfdd8332c4bc007cb3387
BLAKE2b-256 checksum
How to use checksums
4779ae3df9218cd87fa465b504af40ffa6a3c3beceb510fb344d90b29dffb76a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / soma_provider-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL soma_provider-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl
Size 2.8 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
0da79e3d58e4bfad0e7a01e7c7989275b355d210331f0f53bb2b1d13b18fd32e
BLAKE2b-256 checksum
How to use checksums
2781961d098f8ef90135baed0f1d81bc36321a6348492995fd08ad73c3582047
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release files / soma_provider-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL soma_provider-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 2.5 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
b0608bb0d09f22a70b4a502285185f713a6acb1928b2726d7f88c00c807e311e
BLAKE2b-256 checksum
How to use checksums
061f1063ade6190540d89d59c3d57faaeab9094cfde8309493b85f73f36e9b13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page