Skip to content

Safir is the SQuaRE Framework for building FastAPI services

License

Notifications You must be signed in to change notification settings

lsst-sqre/safir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

875ffb7 · Mar 27, 2025
Mar 27, 2025
Feb 24, 2025
Feb 19, 2025
Mar 27, 2025
Mar 27, 2025
Mar 27, 2025
May 16, 2023
Mar 17, 2025
Feb 24, 2025
Mar 27, 2025
Sep 23, 2024
Dec 12, 2024
Dec 16, 2024
Jan 13, 2025

Repository files navigation

Safir

Safir is Rubin Observatory's library for building FastAPI services for the Rubin Science Platform (Phalanx) and Roundtable Kubernetes clusters. Safir is developed, maintained, and field tested by the SQuaRE team.

Safir is available from PyPI:

pip install safir

The best way to create a new FastAPI/Safir service is with the fastapi_safir_app template.

Read more about Safir at https://safir.lsst.io.

Features

  • Set up an httpx.AsyncClient as part of the application start-up and shutdown lifecycle.
  • Set up structlog-based logging.
  • Middleware for attaching request context to the logger to include a request UUID, method, and route in all log messages.
  • Process X-Forwarded-* headers to determine the source IP and related information of the request.
  • Gather and structure standard metadata about your application.
  • Operate a distributed Redis job queue with arq using convenient clients, testing mocks, and a FastAPI dependency.

Developing Safir

See https://safir.lsst.io/dev/development.html.