Skip to main content

soorma-service-common

Shared FastAPI/Starlette infrastructure library for Soorma backend services.

Provides three cross-cutting concerns for all services (Memory, Tracker, Registry, Event Service):

  1. Identity extractionTenancyMiddleware validates bearer tokens and projects platform-tenant, service-tenant, and service-user identity into request.state on secured requests.
  2. RLS activationcreate_get_tenanted_db factory produces a FastAPI dependency that calls PostgreSQL set_config for all three session variables (transaction-scoped) before yielding the DB session, activating Row-Level Security policies.
  3. GDPR deletion contractPlatformTenantDataDeletion abstract base class defines the erasure interface; concrete implementations live in each service.

Usage

# In your service's core/dependencies.py
from soorma_service_common import (
    create_get_tenanted_db,
    create_get_tenant_context,
)
from my_service.core.database import get_db

get_tenanted_db = create_get_tenanted_db(get_db)
get_tenant_context = create_get_tenant_context(get_tenanted_db)
# In your service's main.py
from soorma_service_common import TenancyMiddleware

app.add_middleware(TenancyMiddleware)
# In your route handlers
from my_service.core.dependencies import get_tenant_context
from soorma_service_common import TenantContext

@router.post("/items")
async def create_item(payload: ItemCreate, ctx: TenantContext = Depends(get_tenant_context)):
    return await service.create(ctx.db, ctx.platform_tenant_id, ctx.service_tenant_id, ctx.service_user_id, payload)

Constraints

  • MUST NOT be imported by soorma-common or sdk/python — contains FastAPI/Starlette dependencies incompatible with SDK clients.
  • platform_tenant_id flows from validated request identity or Event Service injection — never as a per-call API parameter.

Release files for soorma-service-common 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for soorma-service-common 0.9.1
File Size Uploaded
soorma_service_common-0.9.1.tar.gz 11.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for soorma-service-common 0.9.1
File Interpreter ABI Platform
soorma_service_common-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.2 kB

Release files / soorma_service_common-0.9.1.tar.gz

Download URL soorma_service_common-0.9.1.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4354298d79741985edaa8f75ce1e28e0809edd1d1ab4bc26eca652c9efba2d45
BLAKE2b-256 checksum
How to use checksums
71ad473ebbb635a29f4c24c8739b60bd5dd634580f011a4f6d6e30779a859f00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / soorma_service_common-0.9.1-py3-none-any.whl

Download URL soorma_service_common-0.9.1-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c59bddcd07ba7574fac54cbdafbbda61593d9c6f669ceeb939208ef8f7f6aa4
BLAKE2b-256 checksum
How to use checksums
3a2e25a046fc3d37aafec2400f91c58b87693fbf5eeb275f6ed91d14a5b70bb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9.0

2 release files

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