Skip to content

Releases: lsst-sqre/safir

3.0.3

16 May 20:05
@rra rra
3.0.3
29339c0
Compare
Choose a tag to compare
  • Correctly handle the possibility that request.client is None.

3.0.2

25 Mar 20:47
@rra rra
3.0.2
fcef667
Compare
Choose a tag to compare
  • Fix handling of passwords containing special characters such as @ and / in safir.database.

3.0.1

24 Feb 21:53
7bbc252
Compare
Choose a tag to compare
  • safir.database retains the port in the database URL, if provided.

3.0.0

24 Feb 03:47
@rra rra
3.0.0
3e080de
Compare
Choose a tag to compare
  • XForwardedMiddleware no longer sets forwaded_proto in the request state and instead directly updates the request scope so that subsequent handlers and middleware believe the request scheme is that given by an X-Forwarded-Proto header. This fixes the scheme returned by other request methods and attributes such as url_for in cases where the service is behind an ingress that terminates TLS.
  • Add new FastAPI dependencies auth_dependency and auth_logger_dependency from the safir.dependencies.gafaelfawr module. auth_dependency returns the username of the user authenticated via Gafaelfawr (pulled from the X-Auth-Request-User header. auth_logger_dependency returns the same logger as logger_dependency but with the user parameter bound to the username from auth_dependency.
  • Add utility functions to initialize a database and create a sync or async session. The session creation functions optionally support a health check to ensure the database schema has been initialized.
  • Add new FastAPI dependency db_session_dependency that creates a task-local async SQLAlchemy session.
  • Add utility functions datetime_from_db and datetime_to_db to convert between timezone-naive UTC datetimes stored in a database and timezone-aware UTC datetimes used elsewhere in a program.
  • Add a run_with_async decorator that runs the decorated async function synchronously. This is primarily useful for decorating Click command functions (for a command-line interface) that need to make async calls.

2.4.0

13 Jan 19:47
@rra rra
2.4.0
3a1f054
Compare
Choose a tag to compare
  • Add an initialize_kubernetes helper function to load Kubernetes configuration. Add the safir.testing.kubernetes module, which can be used to mock the Kubernetes API for testing. To use the new Kubernetes support, depend on safir[kubernetes].

2.3.0

13 Dec 20:13
@rra rra
2.3.0
6776007
Compare
Choose a tag to compare
  • When logging in JSON format, use severity instead of level for the log level for compatibility with Google Log Explorer.
  • In the FastAPI logger_dependency, add log information about the incoming requst in a format compatible with Google Log Explorer.

2.2.0

13 Dec 20:13
@rra rra
2.2.0
2eaadec
Compare
Choose a tag to compare
  • Restore previous http_client_dependency behavior by enabling following redirects by default. This adjusts for the change of defaults in httpx 0.20.0.

2.1.1

29 Oct 22:56
@rra rra
2.1.1
92248ff
Compare
Choose a tag to compare
  • Require structlog 21.2.0 and adjust logger configuration of exception handling for the expectations of that version.

2.1.0

10 Aug 00:23
@rra rra
2.1.0
dae60f0
Compare
Choose a tag to compare
  • Add safir.models.ErrorModel, which is a model of the error message format preferred by FastAPI. Using the model is not necessary but it's helpful to reference it in API documentation to generate more complete information about the error messages.
  • Mark all FastAPI dependencies as async so that FastAPI doesn't run them in an external thread pool.

2.0.1

24 Jun 18:32
@rra rra
2.0.1
3a7dcf2
Compare
Choose a tag to compare
  • Defer creation of httpx.AsyncClient until the first time it is requested. Allow re-creation after aclose(), which makes it easier to write test suites.