Svcs

Latest version: v24.1.0

Safety actively analyzes 638437 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 4

23.10.0

Added

- Proper documentation at <https://svcs.hynek.me/>!
I guess it's getting serious.
[17](https://github.com/hynek/svcs/pull/17)

- Pyramid integration.

Please note that not all integrations will be shipped with *svcs* proper once it is stable.
Some will be moved to separate packages and Pyramid is a prime contender for that.

23.9.0

This is a **huge** release as far as breaking changes go and I hope the last one of such sorts.

There has always been the conundrum imposed by Python typing whether we a) support automatic type-deduction of the services or b) support abstract classes (ABCs, Protocols).

After lots of waffling, I've gone for a compromise: `Container.(a)get()` are now properly typed as `type[T] -> T` (for up to 10 services at once 😅). If you want T to be abstract (until Python typing changes its stance), you'll have to use `Container.(a)get_abstract()`. The nice thing is that this separation serves more people and will be fully backwards-compatible, if we ever don't need it anymore.

Please see https://github.com/hynek/svcs#typing-caveats for more details and a more verbose explanation of the problem if you don't understand what any of the above means.


Full Changelog

Changed

- `Container.get()` and `Container.aget()` now have type hints that only work with concrete classes but allow for type checking without repeating yourself.
If you want to use abstract classes like `typing.Protocol` or ABCs, you can use `Container.get_abstract()` and `Container.aget_abstract()` instead.


Added

- `Container.get_abstract()` and `Container.aget_abstract()`.
They behave like `Container.get()` and `Container.aget()` before.

- It is now possible to check if a service type is registered with a `Registry` by using `in`.

- It is now possible to check if a service type has a cached instance within a `Container` by using `in`.

- `Registry` and `Container` are now also an (async) context managers that call `close()` / `aclose()` on exit automatically.

23.8.0

Added

- It's now possible to request multiple services at once by passing multiple types to `Container.get()` and `Container.aget()`.
[15](https://github.com/hynek/svcs/pull/15)

23.7.0

Added

- Factories now may take a parameter called `svcs_container` or that is annotated to be `svcs.Container`.
In this case the factory will receive the current container as a first positional argument.
This allows for recursive factories without global state.
[10](https://github.com/hynek/svcs/pull/10)

23.6.0

> **Warning** Still in RFC mode!

Changed

- Renamed `Container.forget_service_type()` to `Container.forget_about()`.


Fixed

- `svcs.flask.init_app()`'s type hints now take into account custom `flask.Flask` subclasses.

23.5.0

Still, RFC-mode, added registry-level cleanups which allows to clean up pools automatically.

Page 3 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.