Skip to main content

Core utilities for SRX services: logging, settings, FastAPI app factory

Project description

srx-lib-core

Core utilities for SRX Python services. Small, generic helpers you can reuse across FastAPI-based microservices.

What it includes:

  • Logging setup with loguru (get_logger, setup_logger)
  • Base settings class with Pydantic Settings
  • FastAPI app factory with sensible defaults (CORS, exception handling, health route)

Install

PyPI (public):

  • pip install srx-lib-core

Using uv (pyproject):

[project]
dependencies = ["srx-lib-core>=0.1.0"]

Usage

Logging:

from srx_lib_core import get_logger
logger = get_logger(__name__)
logger.info("hello")

Settings:

from srx_lib_core import BaseServiceSettings

class Settings(BaseServiceSettings):
    OPENAI_API_KEY: str | None = None

settings = Settings()  # loads from .env by default

FastAPI app factory:

from fastapi import APIRouter
from srx_lib_core import create_app

router = APIRouter()

@router.get("/health")
def health():
    return {"status": "ok"}

app = create_app(title="my-service", routers=[router])

Environment Variables

  • LOG_LEVEL (default: INFO)
  • LOG_FILE (optional path)
  • ENVIRONMENT (default: development)
  • CORS_ORIGIN (comma-separated origins; default empty)

Release

This repo ships a GitHub Actions workflow that publishes to GitHub Packages on tags v*.

  • Create a tag: git tag v0.1.0 && git push --tags
  • The workflow uses GITHUB_TOKEN with packages:write.

License

Proprietary © SRX

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

srx_lib_core-0.1.2.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

srx_lib_core-0.1.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file srx_lib_core-0.1.2.tar.gz.

File metadata

  • Download URL: srx_lib_core-0.1.2.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for srx_lib_core-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d1370083076e823263585240f61780390b597212a13c37e9ee1d37d9cf9d776b
MD5 2e58d5b6387cd895ebd5484d3f783aa5
BLAKE2b-256 261eaf95fa515a2e02b41f31cf5ef2ccb425539aab82a30fbc5b81dd7385d672

See more details on using hashes here.

File details

Details for the file srx_lib_core-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: srx_lib_core-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for srx_lib_core-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c92534f73285ef41ccad327bdac8aa9b8cb15d15fb18f01265e817fccd419d3c
MD5 09390a68e14235fce4223d0aa195de39
BLAKE2b-256 4190804a3446e14ca9af7f677b711cc0f669c3a7b1676ab5b0647d640588e50f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page