23.21.0
Highlights
The main feature of this release are container-local registries that allow you to define factories that are only valid for a container. For example, based on request metadata! Check out the docs for details.
There's one minor backward-incompatible change regarding the handling of values and context managers – please refer to #50 for the reasons.
Finally there's a bunch of fixes around typing.
Special Thanks
This release would not be possible without my generous sponsors! Thank you to all of you making sustainable maintenance possible! If you would like to join them, go to https://github.com/sponsors/hynek and check out the sweet perks!
Above and Beyond
Variomedia AG (@variomedia), Tidelift (@tidelift), FilePreviews (@filepreviews), Daniel Fortunov (@asqui), and Kevin P. Fleming (@kpfleming).
Maintenance Sustainers
Adam Hill (@adamghill), Dan Groshev (@si14), Magnus Watn (@magnuswatn), David Cramer (@dcramer), Moving Content AG (@moving-content), ProteinQure (@ProteinQure), Jesse Snyder (@jessesnyder), Rivo Laks (@rivol), Ionel Cristian Mărieș (@ionelmc), The Westervelt Company (@westerveltco), Philippe Galvan (@PhilippeGalvan), Birk Jernström (@birkjernstrom), Tim Schilling (@tim-schilling), Chris Withers (@cjw296), Christopher Dignam (@chdsbd), Stefan Hagen (@sthagen), Sławomir Ehlert (@slafs), and Mostafa Khalil (@khadrawy).
Not to forget 5 more amazing humans who chose to be generous but anonymous!
Full Changelog
Changed
-
Backwards-Incompatible: Since multiple people have been bit by the
enter=True
default forRegistry.register_value()
, and it's very early in svcs life, we're changing the default toenter=False
for all versions ofregister_value()
.This means that you have to explicitly opt-in to context manager behavior which makes a lot more sense for singletons like connection pools which are the most common candidates for registered values.
(The irony of shipping a backwards-incompatible change in the release directly following the adoption of a backwards-compatibility policy not lost on me.) #50 #51
Added
-
Container-local registries! Sometimes it's useful to bind a value or factory only to a container. For example, request metadata or authentication information.
You can now achieve that with
svcs.Container.register_local_factory()
andsvcs.Container.register_local_value()
. Once something local is registered, a registry is transparently created and it takes precedence over the global one when a service is requested. The local registry is closed together with the container. #56 -
Flask:
svcs.flask.registry
which is awerkzeug.local.LocalProxy
for the currently active registry onflask.current_app
.