Releases: lsst-sqre/safir
3.5.0
This release adds safir.pydantic.CamelCaseModel
to further automate support for camel-case attributes in Pydantic models. It also adds the helper class safir.gcs.SignedURLService
to generate signed URLs for Google Cloud Storage objects, and the module safir.testing.gcs
to provide a mock of the Google Cloud Storage API for testing.
What's Changed
- DM-37192: Enable more mypy checks by @rra in #125
- [neophile] Update dependencies by @sqrbot in #126
- Generate API docs for safir.asyncio by @jonathansick in #127
- DM-37291: Add CamelCaseModel helper class by @rra in #128
- [neophile] Update dependencies by @sqrbot in #129
- [neophile] Update dependencies by @sqrbot in #130
- DM-37516: Add Google Cloud Storage utilities and testing support by @rra in #131
Full Changelog: 3.4.0...3.5.0
3.4.0
The 3.4.0 release adds new functions safir.pydantic.normalize_datetime
, safir.pydantic.to_camel_case
, and safir.pydantic.validate_exactly_one_of
, which are helpful for some common Pydantic validation and configuration use cases. It also adds new enums for Profile
and LogLevel
that can be passed to safir.logging.configure_logging
and safir.logging.configure_uvicorn_logging
, allowing better validation of Safir-related application configuration. Finally, it fixes a bug in the Kubernetes mock API, where an intended spec constraint was not applied due to an ordering problem.
What's Changed
- Install graphviz for periodic doc build by @jonathansick in #119
- [neophile] Update dependencies by @sqrbot in #120
- DM-37046: Add Profile and LogLevel enums by @rra in #121
- DM-37051: Drop now-unnecessary types from docs by @rra in #122
- [neophile] Update dependencies by @sqrbot in #123
- DM-37051: Add some Pydantic helper functions from Gafaelfawr by @rra in #124
Full Changelog: 3.3.0...3.4.0
3.3.0
The 3.3.0 release adds a new function, safir.logging.configure_uvicorn_logging
, that routes Uvicorn logs through structlog and adds the context expected by Google's Cloud Logging. The safir.metadata.get_metadata
function now also supports packages that use only pyproject.toml
.
What's Changed
- [neophile] Update dependencies by @sqrbot in #107
- DM-30063: Update logging documentation by @rra in #108
- Avoid Sphinx 5.1.0 by @rra in #109
- [neophile] Update dependencies by @sqrbot in #110
- [neophile] Update dependencies by @sqrbot in #111
- DM-28121: Handle the new pyproject.toml package metadata by @rra in #112
- Bump arq from 0.23a1 to 0.23 by @dependabot in #113
- [neophile] Update dependencies by @sqrbot in #114
- DM-36156: Drop use of sqlalchemy _IsolationLevel type by @jonathansick in #116
- DM-36156: Refresh Safir packaging and adopt new Rubin user guide theme by @jonathansick in #117
- DM-35879: Support sending Uvicorn logs through structlog by @rra in #118
Full Changelog: 3.2.0...3.3.0
3.2.0
The 3.2.0 release adds new support for arq, the Redis-based asyncio distributed queue package. The safir.arq
module provides an arq client and metadata/result data classes with a mock implementation for testing. The FastAPI dependency, safir.dependencies.arq.arq_dependency
, provides a convenient way to use the arq client from HTTP handlers.
What's Changed
- Bump pre-commit/action from 2.0.3 to 3.0.0 by @dependabot in #103
- [neophile] Update dependencies by @sqrbot in #105
- Bump actions/setup-python from 3 to 4 by @dependabot in #106
- DM-34473: Add arq FastAPI dependency by @jonathansick in #98
Full Changelog: 3.1.0...3.2.0
3.1.0
3.0.3
3.0.2
3.0.1
safir.database
retains the port in the database URL, if provided.
3.0.0
XForwardedMiddleware
no longer setsforwaded_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 anX-Forwarded-Proto
header. This fixes the scheme returned by other request methods and attributes such asurl_for
in cases where the service is behind an ingress that terminates TLS.- Add new FastAPI dependencies
auth_dependency
andauth_logger_dependency
from thesafir.dependencies.gafaelfawr
module.auth_dependency
returns the username of the user authenticated via Gafaelfawr (pulled from theX-Auth-Request-User
header.auth_logger_dependency
returns the same logger aslogger_dependency
but with theuser
parameter bound to the username fromauth_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
anddatetime_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.