Skip to main content

Lightweb adapter SDK

The published Python SDK for the Lightweb adapter contract.

Status: pre-1.0, under active development. Released on PyPI. Per CONVENTIONS.md §1.3, breaking changes may land in minor (0.X → 0.(X+1)) releases while in 0.x — pin against a specific minor version. See CHANGELOG.md for release history.

What this is

Lightweb is a community-owned, deployable platform template for hosting self-hosted alternatives to common web services — files, chat, code, meetings. The platform separates what a member is entitled to (the entitlements service, source of truth) from how those entitlements are provisioned into specific apps (one adapter per app: NextCloud, Matrix, Gitea, Jitsi, and others).

This SDK publishes the contract those adapters implement. It's six methods, a handful of shared types, an event envelope, and a conformance suite that every adapter is expected to pass.

If you want to build an adapter for a new app, this is the library you depend on. If you want to understand how the platform's adapter layer works without writing one, docs/contract.md is the canonical specification.

The contract, briefly

Every adapter implements six methods:

  • capabilities() — declares which feature keys this adapter handles and what enforcement it offers.
  • apply(member, entitlements) — idempotent; makes the target app's state match the desired entitlements.
  • disable(member) — soft-disable; blocks access while preserving data.
  • reconcile(member, entitlements) — read-only; returns a drift report comparing app state to desired state.
  • health() — the adapter and its target app are reachable.
  • list_accounts(cursor) — optional; pages through every account in the app for whole-system reconciliation.

There is no delete. Deletion is destructive, asymmetric, and out of the contract by design; it's handled separately as a gated, human-approved workflow in the platform's reconciler.

The full specification is in docs/contract.md.

Quick start

Install:

pip install lightweb-adapter-sdk

A minimal adapter:

from lightweb_adapter_sdk.adapter import Adapter
from lightweb_adapter_sdk.types import (
    Member, Entitlement, AppAccount, DriftReport,
    Capabilities, HealthStatus, AccountListPage,
)


class MyAdapter:
    """Adapter for MyApp."""

    def capabilities(self) -> Capabilities:
        ...

    def apply(self, member: Member, entitlements: list[Entitlement]) -> AppAccount:
        ...

    def disable(self, member: Member) -> None:
        ...

    def reconcile(self, member: Member) -> DriftReport:
        ...

    def health(self) -> HealthStatus:
        ...

    def list_accounts(self, cursor: str | None = None) -> AccountListPage:
        ...


# Verify the adapter satisfies the contract structurally:
adapter: Adapter = MyAdapter()

The Adapter is a typing.Protocol; your class doesn't have to inherit from it. If it has the right method signatures, it satisfies the contract.

The conformance suite verifies your adapter meets the contract's behavioral requirements (not just its structural ones). See docs/conformance.md for how to run it against your adapter.

Documentation

For the broader architectural context — why the adapter contract exists in this shape — see the Lightweb HLD in the platform monorepo at lightweb/platform's docs/hld.md, especially §4.

Status

Pre-1.0 and released on PyPI — see the note at the top of this file and CHANGELOG.md for release history. 1.0 follows once the contract has been validated by at least one production adapter running against it in a real deployment.

Relationship to the Lightweb platform

The platform monorepo (lightweb/platform) is AGPLv3 and contains the bespoke spine services and first-party adapters that ship with Lightweb. The platform's first-party adapters consume this SDK the same way third-party adapters do — as a pinned PyPI dependency, not as a source-level inclusion.

This SDK is Apache 2.0. The license boundary is structural: the SDK is the contract third parties implement against, and a permissive license is appropriate for a contract definition.

The SDK has no code-level dependency on the platform monorepo. It does mirror some platform-side artifacts (event envelope schemas, the entitlements service's API shape), but those are vendored as generated bindings, not pulled dynamically.

License

Apache License 2.0. See LICENSE for the full text.

Code of conduct

Project participants are expected to follow the Contributor Covenant.

Metadata

Release files for lightweb-adapter-sdk 0.9.0

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

Source distribution (sdist)

Source distribution for lightweb-adapter-sdk 0.9.0
File Size Uploaded Provenance Actions
lightweb_adapter_sdk-0.9.0.tar.gz 115.0 kB Without provenance Details for lightweb_adapter_sdk-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lightweb-adapter-sdk 0.9.0
File Interpreter ABI Platform Actions
lightweb_adapter_sdk-0.9.0-py3-none-any.whl Python 3 none any Details for lightweb_adapter_sdk-0.9.0-py3-none-any.whl

Total release size: 215.5 kB

Release files / lightweb_adapter_sdk-0.9.0.tar.gz

Download URL lightweb_adapter_sdk-0.9.0.tar.gz
Size 115.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b1c31c4ad6962877fc8b085528aeab00ff6ba4fc65d087a31907aa1e71f5fca5
BLAKE2b-256 checksum
How to use checksums
5e540fca9c3ea1d2a2bd4a91c66c4d25cb9f8a60abb82162719d65233766089f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / lightweb_adapter_sdk-0.9.0-py3-none-any.whl

Download URL lightweb_adapter_sdk-0.9.0-py3-none-any.whl
Size 100.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad0e42f1923cd1bb35e05cd37ab892f13383275ff2dd9ee77fe608f4b57c2b1f
BLAKE2b-256 checksum
How to use checksums
60b3910f33fb62a19ceb86aac839706ea1451f56954906a46c331941ad77b014
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for lightweb-adapter-sdk 0.9.0

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.

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