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.0.0.tar.gz (16.8 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.0.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wxyc_fastapi-1.0.0.tar.gz
  • Upload date:
  • Size: 16.8 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.0.0.tar.gz
Algorithm Hash digest
SHA256 628f70fa908717caa2a3122c446ed28e427f09814383056955b65c757f403ecd
MD5 a6aed43492a5dac08da7c75d792075fb
BLAKE2b-256 615483a5e827e9bcc88f532f1a530dea94a794ebf8577dd9d2e9ac5c9f165162

See more details on using hashes here.

Provenance

The following attestation bundles were made for wxyc_fastapi-1.0.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.0.0-py3-none-any.whl.

File metadata

  • Download URL: wxyc_fastapi-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 19.2 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47d7ea841a365400619afaec20e07d5d2051fff12761c88fab29cadbd532c239
MD5 b8e3aa69e6f00d1855f61a93fca04655
BLAKE2b-256 69b1bcf58cc0ff027e0de5465d83b3ef3e5e520733e8d078c902e12a62a78323

See more details on using hashes here.

Provenance

The following attestation bundles were made for wxyc_fastapi-1.0.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