8.0.0
Backwards-incompatible changes
- Add serializers to
HumanTimedelta
andSecondsTimedelta
that serialize those Pydantic fields to a float number of seconds instead of ISO 8601 durations. This means those data types now can be round-tripped (serialized and then deserialized to the original value), whereas before they could not be. parse_isodatetime
andnormalize_isodatetime
now accept exactly the date formats accepted by the IVOA DALI standard. This means seconds are now required, the trailingZ
is now optional (times are always interpreted as UTC regardless), and the time is optional and interpreted as 00:00:00 if missing.
New features
- Add new
safir.pydantic.UtcDatetime
type that is equivalent todatetime
but coerces all incoming times to timezone-aware UTC. This type should be used instead of usingnormalize_datetime
as a validator. - Add new
safir.pydantic.IvoaIsoDatetime
type that accepts any ISO 8601 date and time that matches the IVOA DALI standard for timestamps. This follows the same rules asparse_isodatetime
now follows. This type should be used instead of usingnormalize_isodatetime
as a validator. - Add new
safir.database.PaginatedLinkData
model that parses the contents of an HTTPLink
header and extracts pagination information. - Add
safir.database.drop_database
utility function to drop all database tables mentioned in a SQLAlchemy ORM schema and delete the Alembic version information if it is present. This is primarily useful for tests. - Publishing a metrics event no longer waits on confirmation of message delivery to Kafka. This makes publishing much more performant. All events will still be delivered as long as an app awaits
EventManager.aclose
in its lifecycle. safir.kafka.PydanticSchemaManager
takes an optional structlogBoundLogger
. If not provided, the default logger is aBoundLogger
, rather than alogging.Logger
.- Pass the
logger
parameter tosafir.metrics.KafkaMetricsConfiguration.make_manager
to thePydanticSchemaManager
instance that it creates. - Add
CaseInsensitiveFormMiddleware
to lower-case the keys of formPOST
parameters. This can be used to support the case-insensitive keys requirement of IVOA standards.
Bug fixes
- Correctly validate stringified floating-point numbers of seconds as inputs to the
SecondsTimedelta
type instead of truncating it to an integer. - Allow
timedelta
as a member of a union field in asafir.metrics.EventPayload
. - Add missing dependency on alembic to the
safir[uws]
extra.
Other changes
- Document how to test an application's database schema against its Alembic migrations to ensure that the schema hasn't been modified without adding a corresponding migration.
What's Changed
- Fix two small typos by @rra in #323
- DM-47262: Fix Alembic documentation by @rra in #322
- DM-47262: Minor documentation fixes by @rra in #324
- DM-47262: Add serializers for *Timedelta types by @rra in #325
- DM-47262: Document testing Alembic config against schema by @rra in #327
- DM-47262: Fix IVOA DALI timestamp parsing, add data types by @rra in #326
timedelta
can now be used a member of a union field in an EventPayload by @fajpunk in #329- DM-47581: Add generic paginated query support by @rra in #330
- DM-47721: Improved schema manager logging by @fajpunk in #331
- DM-47771: metrics: don't wait for kafka messages to be delivered by @fajpunk in #333
- DM-47769: Remove obsolete SQLAlchemy future flags by @rra in #335
- DM-47769: Do not do COUNT queries for pagination by default by @rra in #332
- DM-47769: Add LinkData model for parsing HTTP Link headers by @rra in #334
- DM-47789: Update pre-commit dependencies by @rra in #336
- DM-47796: Add alembic dependency to uws extra by @rra in #337
- DM-47789: Reword change log for 7.0.0 by @rra in #338
- DM-47789: Fix various issues with pagination support by @rra in #339
- DM-47459: Added middleware for converting form post params to lowercase by @stvoutsin in #340
- DM-47789: Make pagination docs friendlier to subclasses by @rra in #341
- DM-47789: Qualify more types in pagination docstrings by @rra in #342
- DM-47789: Prepare 8.0.0 release by @rra in #343
Full Changelog: 7.0.0...8.0.0