Skip to main content

Backend SDK

Русский

Category Technologies
Coverage coverage-backend
Runtime python async type-safe
Auth integration litestar paseto
Testing pytest
Quality ruff mypy bandit pip-audit
Tools uv
CI/CD github-actions dependabot

Shared backend library for alittlemore.dev: integrations, domain objects, middleware, helpers, utilities, and factories.

Package: alittlemore-backend-sdk · Import: backend_sdk · License: MIT

Python: latest stable minor + its predecessor, all patch releases; currently 3.14.x and 3.13.x.

Tooling: uv, Hatchling, Ruff, mypy, pytest, Bandit, pip-audit, Twine.

Development

Requires uv and GNU Make.

make install   # Install dependencies
make quality   # Run all checks
make build     # Build wheel and sdist
make help      # List commands

Releases · Changelog

Auth API integration

Install the Litestar integration:

uv add 'alittlemore-backend-sdk[litestar]'
from backend_sdk.auth import Principal, RoleEnum
from backend_sdk.auth.http import AuthApiClientConfig
from backend_sdk.integrations.litestar import AuthContext, AuthPlugin, RequireRole
from litestar import Litestar, Request, get
from litestar.datastructures import State


@get("/health", opt={"auth_public": True})
async def health() -> dict[str, str]:
    return {"status": "ok"}


@get("/activity", opt={"auth_optional": True})
async def activity(
    request: Request[Principal, AuthContext | None, State],
) -> dict[str, str]:
    return {"username": request.user.username}


app = Litestar(
    route_handlers=[health, activity],
    plugins=[
        AuthPlugin(
            config=AuthApiClientConfig(
                verify_url="https://auth.example.com/api/auth/verify/v2",
                timeout_seconds=2,
                cache_ttl_seconds=15,
                max_cache_entries=10_000,
            ),
        ),
    ],
)

Routes require a bearer token by default. Mark anonymous routes with opt={"auth_public": True}. Use opt={"auth_optional": True} when a route accepts anonymous requests but should authenticate a bearer token when one is present; this also overrides an inherited auth_public option. Malformed or invalid supplied credentials still return 401, and an unavailable verifier returns 503. Protect privileged routes with RequireRole(RoleEnum.ADMIN). Successful checks are cached in each process for at most 15 seconds; set cache_ttl_seconds=0 to disable this. Services must still enforce resource ownership in their own domain logic.

The cache is intentionally process-local: it is a short availability and latency optimization, adds no infrastructure dependency, and never becomes an authorization source of truth. Each process can perform one auth-api request per token and TTL.

See examples/litestar_auth.py for public, authenticated, and administrator routes in one application.

Metadata

Release files for alittlemore-backend-sdk 0.3.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 alittlemore-backend-sdk 0.3.0
File Size Uploaded Provenance Actions
alittlemore_backend_sdk-0.3.0.tar.gz 15.5 kB With provenance Details for alittlemore_backend_sdk-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for alittlemore-backend-sdk 0.3.0
File Interpreter ABI Platform Actions
alittlemore_backend_sdk-0.3.0-py3-none-any.whl Python 3 none any Details for alittlemore_backend_sdk-0.3.0-py3-none-any.whl

Total release size: 26.6 kB

Release files / alittlemore_backend_sdk-0.3.0.tar.gz

Download URL alittlemore_backend_sdk-0.3.0.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5aa8d1309d20ce5b63004682c6b06944454f02beea5ce77f49ce28c51f91eeef
BLAKE2b-256 checksum
How to use checksums
2beb2f4c3577889140b97689e213194a8110df13f522cfb1d9deb6b0aa7e698e
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 Oct 4, 2026.

Transparency log

Release files / alittlemore_backend_sdk-0.3.0-py3-none-any.whl

Download URL alittlemore_backend_sdk-0.3.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38a9dbcf39906652f1dac99b4360887623ee6a2333ea8d3e6269ad2ee151f1b7
BLAKE2b-256 checksum
How to use checksums
b5964313d4b2db58c9c3a3350c6a9d00e1e1dfc71dc7ba6b789b26526c4d2d76
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 Oct 4, 2026.

Transparency log

Security for alittlemore-backend-sdk 0.3.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for alittlemore_backend_sdk-0.3.0.tar.gz

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 Oct 4, 2026.

Transparency log

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