Skip to main content

DevLab Auth — Python SDK

Enterprise-grade authentication SDK and FastAPI security guards for the Yuva DevLab platform ecosystem.

Features

  • Strict Typing: 100% type-annotated with py.typed marker (PEP 561) and strict mypy compliance.
  • RS256 JWKS Verification: Validates DevLab Portal SSO tokens without network overhead using local in-memory public key caching.
  • M2M API Key Validation: Authenticates machine-to-machine callers (dlk_...) via DevLab Portal API with local TTL caching.
  • FastAPI Dependency Injection: Drop-in Depends(get_current_principal), require_role, and require_scope guards.
  • ASGI Middleware: Global route protection via DevLabAuthMiddleware.

Installation

# Using uv
uv add devlab-auth

# Using pip
pip install devlab-auth

Quickstart (FastAPI)

from fastapi import FastAPI, Depends
from devlab_auth import AuthPrincipal, get_current_principal, require_role

app = FastAPI()


@app.get("/api/v1/forecast")
async def get_forecast(principal: AuthPrincipal = Depends(get_current_principal)):
    return {
        "caller_id": principal.id,
        "is_service": principal.is_m2m,
        "role": principal.role,
    }


@app.post("/api/v1/admin/purge", dependencies=[Depends(require_role("admin", "super_admin"))])
async def admin_purge():
    return {"status": "purged"}

Development & Verification

# Run test suite
uv run pytest

# Strict lint check & format
uv run ruff check .
uv run ruff format --check .

# Strict typechecking (zero any, strict mode)
uv run mypy src

Metadata

Release files for devlab-auth 0.2.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 devlab-auth 0.2.0
File Size Uploaded Provenance Actions
devlab_auth-0.2.0.tar.gz 64.2 kB Without provenance Details for devlab_auth-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for devlab-auth 0.2.0
File Interpreter ABI Platform Actions
devlab_auth-0.2.0-py3-none-any.whl Python 3 none any Details for devlab_auth-0.2.0-py3-none-any.whl

Total release size: 72.5 kB

Release files / devlab_auth-0.2.0.tar.gz

Download URL devlab_auth-0.2.0.tar.gz
Size 64.2 kB
Tags Source
SHA-256 checksum
How to use checksums
174eb7e33101bbaf9f7a5936e93afea99d30241a6f3619e38ace5c865ce71d42
BLAKE2b-256 checksum
How to use checksums
94dd5b0a1e8b786fe68184668f27b837727363507053adf6ac8724b25bce1542
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / devlab_auth-0.2.0-py3-none-any.whl

Download URL devlab_auth-0.2.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82a561099b8dbb26776dd24f6fe08a6a4c2572bddbb6385b7d9c3df9d690a783
BLAKE2b-256 checksum
How to use checksums
f773a2803481f25a564b213ac7948cde07418100cb94217b82898172b03d64dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for devlab-auth 0.2.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