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.8.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.8.0
File Size Uploaded Provenance Actions
lightweb_adapter_sdk-0.8.0.tar.gz 104.6 kB Without provenance Details for lightweb_adapter_sdk-0.8.0.tar.gz

Built distribution (wheel)

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

Total release size: 195.0 kB

Release files / lightweb_adapter_sdk-0.8.0.tar.gz

Download URL lightweb_adapter_sdk-0.8.0.tar.gz
Size 104.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4c770d8acd18554f36ee0d960345706b947e6a28a0804652906711e2d6ec304f
BLAKE2b-256 checksum
How to use checksums
81ac63829e79691b9a949063834b92d8f6c963f7b6121cb37e541b0dc7fd5f1c
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.8.0-py3-none-any.whl

Download URL lightweb_adapter_sdk-0.8.0-py3-none-any.whl
Size 90.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1337a3dd55500467902564804f5fc37d69facb9898ae8e9a6116869a49e716fd
BLAKE2b-256 checksum
How to use checksums
f6e57ab5bcf5aba6de2f140764b99ef00d4a64de40c0310f49edc6ce6ffba14b
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.8.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