osp-provider-sdk
Write an OSP provider in plain Python. A provider connects OSP to your service: it lists your resources and plans and applies the changes users request. The SDK handles the wire protocol, input validation, approvals, ownership checks and progress reporting, so your code only talks to your backend.
Install
Requires Python 3.13 or newer.
uv pip install osp-provider-sdk
A minimal provider
from contextlib import contextmanager
from datetime import UTC, datetime
from pydantic import BaseModel, ConfigDict, Field
from osp_provider_sdk import App, Done, Page, Resource, ResourceOwnership
@contextmanager
def lifespan():
yield {} # your backend client; available as app.state while running
app = App("notes", description="Sticky notes", lifespan=lifespan)
class Create(BaseModel):
model_config = ConfigDict(frozen=True)
name: str = Field(title="Name")
text: str = Field("", title="Text")
class Row(BaseModel):
text: str = Field(title="Text")
@app.resource("note", fields=Row)
def notes(q, access) -> Page:
rows = [
Resource(target_ref=ref, display=ref, ownership=owner, fields={"text": text})
for ref, (text, owner) in app.state.items()
]
return Page(tuple(rows), observed_at=datetime.now(UTC).isoformat())
@app.action("create", inputs=Create)
def create(req, ctx) -> Done:
owner = ResourceOwnership(contacts=frozenset(ctx.contacts))
app.state[req.name] = (req.inputs.text, owner)
ctx.created(req.name)
return Done(f"Created note {req.name}")
if __name__ == "__main__":
app.run()
The input model becomes the form users fill in, the resource becomes an
inventory list, and the runtime checks ownership and policy before your
handler runs. app.state is whatever lifespan yields, typed from it.
Try it without OSP
Save the code as notes.py. These commands need no orchestrator or RabbitMQ:
python -m osp_provider_sdk manifest notes:app # what OSP will see
python -m osp_provider_sdk doctor notes:app --offline # declarations and policy
python -m osp_provider_sdk plan notes:app create '{"text": "buy milk"}' --name milk
python notes.py serves the provider over RabbitMQ; it reads RABBITMQ_URL
and PROVIDER_INSTANCE.
Next steps
- Build a real provider: start from the provider template and follow the tutorial.
- Understand how it works: concepts covers lifetime, ownership, planning and approval, progress and results.
- Declare inputs and resources: manifest.
- Approvals and policy: policy.
- Test locally: testing.
- API contracts: API reference.
- Worked examples: bucket and sandwich shop providers.
- Deploy to OSP dev and prod: provider onboarding.
- Contribute: CONTRIBUTING.md and the changelog.
Metadata
Release files for osp-provider-sdk 0.10.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| osp_provider_sdk-0.10.5.tar.gz | 61.1 kB | Without provenance | Details for osp_provider_sdk-0.10.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| osp_provider_sdk-0.10.5-py3-none-any.whl | Python 3 | none | any | Details for osp_provider_sdk-0.10.5-py3-none-any.whl |
Total release size: 89.5 kB
Release files / osp_provider_sdk-0.10.5.tar.gz
| Download URL | osp_provider_sdk-0.10.5.tar.gz |
|---|---|
| Size | 61.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
575e778fd6ad2dac20f8c1298b52fe90bbf0006cadeb941c6c8ee6c2c676fa63
|
|
BLAKE2b-256 checksum How to use checksums |
f2a7185b3a8a5798b72bc815f20fcaaa4c264ad0fb39775586b12edf8781e98f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.15
|
Release files / osp_provider_sdk-0.10.5-py3-none-any.whl
| Download URL | osp_provider_sdk-0.10.5-py3-none-any.whl |
|---|---|
| Size | 28.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa5b83f241ea5138c471acbad02deb0bf514f3d59a2546fb52d44b8fdb34c1fc
|
|
BLAKE2b-256 checksum How to use checksums |
51d0b4a58efff5a76a8f0a872b0d6780d10c8cfaebfcd5b05d74abcb0c4b594e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.15
|
Security for osp-provider-sdk 0.10.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.