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):
- Identity extraction —
TenancyMiddlewarevalidates bearer tokens and projects platform-tenant, service-tenant, and service-user identity intorequest.stateon secured requests. - RLS activation —
create_get_tenanted_dbfactory produces a FastAPI dependency that calls PostgreSQLset_configfor all three session variables (transaction-scoped) before yielding the DB session, activating Row-Level Security policies. - GDPR deletion contract —
PlatformTenantDataDeletionabstract 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-commonorsdk/python— contains FastAPI/Starlette dependencies incompatible with SDK clients. platform_tenant_idflows from validated request identity or Event Service injection — never as a per-call API parameter.
Metadata
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| soorma_service_common-0.9.1.tar.gz | 11.9 kB | Without provenance | Details for soorma_service_common-0.9.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| soorma_service_common-0.9.1-py3-none-any.whl | Python 3 | none | any | Details for soorma_service_common-0.9.1-py3-none-any.whl |
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
|
Security for soorma-service-common 0.9.1
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.