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.2.0.tar.gz (13.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-0.2.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wxyc_fastapi-0.2.0.tar.gz
  • Upload date:
  • Size: 13.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-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0d80297a02471095ed049edf58f3377da335a212096ca466572f67b07ae341e6
MD5 77267d498f2b8acf8e5cd9bbca3e4c03
BLAKE2b-256 441d00c3fbb6855735e4330ac5c922d9aee04cb8d17ba2cf0b4b82ae88caf45d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: wxyc_fastapi-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.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-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6dc471303fc37a34de9951e8c31fb2755b16ef0f5a141a1faabacc99dad64736
MD5 a7827f88597e92b9e44a2d17bb373ad0
BLAKE2b-256 bbac3bed86b2092d8a169a363a851a1b89a8481dfc55dc2822b82e13aa749569

See more details on using hashes here.

Provenance

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