Skip to content

4.0.0a1

Pre-release
Pre-release

Choose a tag to compare

@Lancetnik Lancetnik released this 15 Nov 13:32
58a5ea2

Second alpha release of FastDepends 4.0.

Msgspec hooks

  • Add keyword-only enc_hook and schema_hook options to MsgSpecSerializer, alongside the existing dec_hook.
  • Reuse the configured JSON encoder across serializers created by the same factory. Factory-level and bound encoding preserve custom encode() overrides and raw root-byte passthrough.
  • Apply schema_hook to input and response JSON schemas, including dependency inputs, filtered fields and custom-field source groups. Native Struct metadata remains supported.

Async custom fields

  • Avoid opening an AnyIO task group when no custom field uses field=True.
  • This removes an implicit scheduling checkpoint for sequential custom fields. The order in which other async tasks run, and when cancellation is observed, can therefore change. Code that needs an explicit checkpoint should provide one.
  • Synchronous use() hooks continue to run in the worker thread pool; concurrent field=True resolution and exception unwrapping are preserved.

@inject continues to return validated Python values. JSON encoding remains an explicit operation.

Install this alpha explicitly:

pip install 'fast-depends[msgspec]==4.0.0a1'

Implemented in #322 and #313.

Full changelog: 4.0.0a0...4.0.0a1