4.4.0
New features
- Add a
safir.click.display_help
helper function that implements ahelp
command for Click-based command-line interfaces, with support for nested subcommands. - Add a new
safir.asyncio.AsyncMultiQueue
data structure, which is an asyncio multi-reader queue that delivers all messages to each reader independently. - Add
read_
methods for the Kubernetes object types for which the mock providedcreate_
methods (NetworkPolicy
andPersistentVolumeClaim
).
Bug fixes
- Fix typing of the
safir.asyncio.run_with_asyncio
decorator so that it doesn't mask the type of the underlying function. - Kubernetes objects included in events are now serialized properly using the Kubernetes camel-case field names instead of the Python snake-case names. In addition to matching Kubernetes behavior more closely, this allows a watch configured with the Kubernetes model type to deserialize the object in the
object
key of the event dictionary. The type must be passed explicitly to theWatch
constructor, since kubernetes_asyncio's type autodetection does not work with Safir's mock. safir.testing.kubernetes.patch_kubernetes
no longer mocks the entireApiClient
class since it is required for deserialization of objects in Kubernetes events. It instead mocks therequest
method of that class for safety, to prevent any network requests to Kubernetes clusters when Kubernetes is mocked.
Other changes
- Safir now uses the Ruff linter instead of flake8 and isort.
What's Changed
- DM-40495: Fix broken and redirected links by @rra in #192
- Update redis requirement from <5,>4.5.2 to >4.5.2,<6 by @dependabot in #188
- Update kubernetes-asyncio requirement from <25 to <26 by @dependabot in #189
- DM-40495: Improve error reporting from docs-linkcheck by @rra in #191
- Bump actions/checkout from 3 to 4 by @dependabot in #193
- DM-40567: Add a helper function for Click command help by @rra in #190
- DM-40628: Switch to Ruff for linting by @rra in #194
- DM-40638: Add AsyncMultiQueue data structure by @rra in #195
- DM-40638: Improve typing of run_with_asyncio by @rra in #196
- DM-40638: Fix serialization of objects in watch events by @rra in #197
- DM-40638: Add mock Kubernetes read methods for more kinds by @rra in #198
- DM-40676: Prepare 4.4.0 release by @rra in #199
Full Changelog: 4.3.1...4.4.0