Asyncinject

Latest version: v0.6

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

Scan your dependencies

Page 1 of 2

0.6

- Non-async functions can now be registered in addition to async functions. [15](https://github.com/simonw/asyncinject/issues/15)
- `.register(fn, name=)` method for registering a function with a custom name. [14](https://github.com/simonw/asyncinject/issues/14)
- `Registry.from_dict({"name1": fn1, "name2": fn2})` constructor method for registering multiple functions with custom names. [17](https://github.com/simonw/asyncinject/issues/17)

0.5

- `registry.resolve()` can now be used to resolve functions that have not been registered. [13](https://github.com/simonw/asyncinject/issues/13)

python
async def one():
return 1

async def two():
return 2

registry = Registry(one, two)

async def three(one, two):
return one + two

result = await registry.resolve(three)
result is now 3

0.4

- [Adrian Garcia Badaracco](https://github.com/adriangb) addressed an issue where concurrent functions were not executing optimally. The code now starts a function running as soon as all of its dependent functions have completed. [#10](https://github.com/simonw/asyncinject/issues/10)
- Dropped support for Python 3.6.

0.3

Extensive, backwards-compatibility breaking redesign.

- This library no longer uses subclasses. Instead, a `Registry()` object is created and `async def` functions are registered with that registry. The `registry.resolve(fn)` method is then used to execute functions with their dependencies. [8](https://github.com/simonw/asyncinject/issues/8)
- `Registry(timer=callable)` can now be used to register a function to record the times taken to execute each function. This callable will be passed three arguments - the function name, the start time and the end time. [7](https://github.com/simonw/asyncinject/issues/7)
- The `parallel=True` argument to the `Registry()` constructor can be switched to `False` to disable parallel execution - useful for running benchmarks to understand the performance benefit of running functions in parallel. [6](https://github.com/simonw/asyncinject/issues/6)

0.2

- New `_log` mechanism for debug logging. [5](https://github.com/simonw/asyncinject/issues/5)

0.2a1

- Now uses `__init_subclass__` in place of a metaclass. [2](https://github.com/simonw/asyncinject/issues/2)

Page 1 of 2

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.