Skip to main content

Shared FastAPI service primitives for WXYC: Sentry init, request telemetry, cache-stats recorder, PostHog wrapper

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-0.1.0.tar.gz (11.6 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-0.1.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for wxyc_fastapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4ad42f19cf7394ddf3263810d7e81783b690d936e190a84bda0e991bf20b56d1
MD5 ae49fb0c10f05e6aa04900e09ba7ee95
BLAKE2b-256 9c3900aadb686fa1e2eb3c7bb0311952cbe2bb7124dbef751dac281b35c3ea64

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: wxyc_fastapi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 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-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b694ab3c040c6228937562f81f04620ee06552dff34e90928b375a157b43fd0
MD5 4f781cf023c4007faa49322236c85f0a
BLAKE2b-256 a61a98f98b0e81f622a664c5e759d7a999d1e82d9ff5de344498537ffaafba2a

See more details on using hashes here.

Provenance

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