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

Author & Attribution

  • Author: Yuva DevLab (yuva.devlab@gmail.com)
  • License: MIT

Metadata

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

Built distribution (wheel)

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

Total release size: 73.4 kB

Release files / devlab_auth-0.3.0.tar.gz

Download URL devlab_auth-0.3.0.tar.gz
Size 64.7 kB
Tags Source
SHA-256 checksum
How to use checksums
082cf184e7c03065a509461dccdf5887f33cceb54d0dd9b0462a8e6ed6252d99
BLAKE2b-256 checksum
How to use checksums
3a98f27d6cc899783b08c035a1a21a604dde67d69a8da7abc60858a4d1ec238f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","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.3.0-py3-none-any.whl

Download URL devlab_auth-0.3.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbb0b0e1b7fe0e4c20d4da5a7f0caf9842e7903b655731cd969f172305d8fd68
BLAKE2b-256 checksum
How to use checksums
cf995f149014ce9b02cd16d3a6d71b2bc649141bbb384e048048d1c10bf70c50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","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.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.

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