Skip to main content

Shared FastAPI service primitives for WXYC: Sentry init, request telemetry, cache-stats recorder, PostHog wrapper, healthcheck routers, async-singleton, lazy PG

Project description

wxyc-fastapi

Shared FastAPI service template for WXYC's Python services. Consolidates the duplicated service scaffolding currently forked across library-metadata-lookup (LML), request-o-matic (rom), and semantic-index into a single package, eliminates measurable drift between the three forks, and gives the next FastAPI service a template to inherit instead of fork.

Status: scaffolding. The implementation plan is at WXYC/wiki/plans/wxyc-fastapi. The rollout is tracked in the org-level project board wxyc-fastapi rollout and traces back to P1 of the 2026-05-10 cross-repo contract audit (WXYC/wiki#51).

Package surface (planned)

wxyc_fastapi/
├── observability/
│   ├── sentry.py        # init_sentry(), add_breadcrumb(), capture_exception()
│   ├── telemetry.py     # RequestTelemetry, StepResult, track_step
│   ├── cache_stats.py   # ContextVar, init_cache_stats, record_*, get_cache_stats
│   └── posthog.py       # get_posthog_client(event_prefix), flush_posthog(), shutdown_posthog()
├── http/
│   └── singleton.py     # async_singleton(factory) - getter+closer pair w/ asyncio.Lock
├── healthcheck/
│   ├── liveness.py      # 200 OK with {"status":"healthy"} body, no probes
│   └── readiness.py     # readiness_router(checks: list[Check]) -> APIRouter
└── db/
    └── lazy_pg.py       # LazyPgConnection

Cross-language consolidation (codegen and healthcheck response shape) lives in wxyc-shared instead. See the plan's §2.4 for what lives where and why.

Phasing

Phase Module Version
A observability/* (sentry, telemetry, cache_stats, posthog) v0.1.0
B healthcheck/* (Python implementation) v0.2.0
C Healthcheck response schemas in wxyc-shared/api.yaml (parallel with B) (no wxyc-fastapi version bump)
D http/singleton v0.3.0
E db/lazy_pg v1.0.0

Contributing

Implementation and migration tasks are filed as sub-issues of the rollout epic in this repo. See the issues tab and the project board for what's open.

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

wxyc_fastapi-1.1.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

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

wxyc_fastapi-1.1.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file wxyc_fastapi-1.1.0.tar.gz.

File metadata

  • Download URL: wxyc_fastapi-1.1.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wxyc_fastapi-1.1.0.tar.gz
Algorithm Hash digest
SHA256 4636465b3d124da5adf685bc8e23f8f0920d917811cfc12312721d2d8ff77421
MD5 21f25f5b00911f0f49773efe06156d4b
BLAKE2b-256 52a9fd42ba59ca2bcf0bdf4afd80e84bf91f133455bc7071e8e45fc8c09365df

See more details on using hashes here.

Provenance

The following attestation bundles were made for wxyc_fastapi-1.1.0.tar.gz:

Publisher: publish.yml on WXYC/wxyc-fastapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wxyc_fastapi-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: wxyc_fastapi-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wxyc_fastapi-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8019fb2bc9d7c9497a499c9c85b4dd3ecad28847ef72e723bd3da394e31b74ef
MD5 40a5ef4f48b2e0d66f8d511b75933f6c
BLAKE2b-256 b46d567d0ea1c5bb1678f26f6bbff5cdcc91fa3ec0733b5fc8d2d86361b50056

See more details on using hashes here.

Provenance

The following attestation bundles were made for wxyc_fastapi-1.1.0-py3-none-any.whl:

Publisher: publish.yml on WXYC/wxyc-fastapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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