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.1.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.1.0
File Size Uploaded Provenance Actions
devlab_auth-0.1.0.tar.gz 63.5 kB Without provenance Details for devlab_auth-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 71.8 kB

Release files / devlab_auth-0.1.0.tar.gz

Download URL devlab_auth-0.1.0.tar.gz
Size 63.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8b8e945cf0ec42c1f433f0c5fcd5b1bc81f0c0f841069d8f1b9bddf31dd4d028
BLAKE2b-256 checksum
How to use checksums
f902e9c25a4d875c48cef7dde986c5173c3a0d2a3dbbffe154050f338340a741
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","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 / devlab_auth-0.1.0-py3-none-any.whl

Download URL devlab_auth-0.1.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a31d1e99362068ed60773b503113af92b79842cf9d42005e5ecf7b9d5b9132fc
BLAKE2b-256 checksum
How to use checksums
b818099d3388b6d3f85fd408591078e90a142274860b8373d0bef07740e3e5e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","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 devlab-auth 0.1.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