We follow Semantic Versions.
- Now you can use picodi dependencies in FastAPI views without need to
decorate view with
@inject
.
- Support for Python 3.13
- Change order of running pytest fixtures
- Rename pytest fixture name for consistency
- Removed dead code
- Added
init_dependencies
marker for pytest - Added tests for detecting race conditions
- Added Python 3.13-free-threading to CI
- Breaking changes:
- Argument
ignore_manual_init
of@dependency
decorator renamed touse_init_hook
and its default value set toFalse
- Argument
- Rewrite
helpers.enter
as class-based context manager (now it behaves more predictably) - Added
registry.touched
property andregistry.clear_touched
method for tracking dependencies usage (useful for testing) - Added pytest integration for simpler testing
- Patch dependency tree when resolving dependencies with overrides
- Breaking changes:
- If you try to override a dependency that is already is use in another override, you will get an error
- revert tags
- Now you can mark you dependencies with tags for more granular control over their lifecycle
- Breaking changes:
- Removed
ignore_manual_init
argument fromdependency
decorator lifespan
now has new signature
- Removed
enter
now respects overrideslifespan
is a factory decorator now
- Make
Dependency.__call__
async because FastAPI always runs Picodi deps in threadpool even if they are async - Rename
Dependency
toDepends
[internal change] - Run mypy in tests directory
- Make sure that
inject
doesn't change type of wrapped function (e.g. coroutinefunction, generatorfunction, etc.) - Added Starlette integration
- Added FastAPI integration
- Breaking changes:
- Return value of
Provide
no longer has__call__
method
- Return value of
- Fixed bug with contextvars when
init_dependencies
run in different context - Breaking changes:
- Changed default scope class of
init_dependencies
andshutdown_dependencies
to `SingletonScope
- Changed default scope class of
ignore_manual_init
argument ofdependency
decorator now can be callable type
- Added
helpers.enter
context manager for resolving dependencies in pytest fixtures
- Fixed typehints
- Fixed rare error when
shutdown_dependencies
raises "RuntimeError: There is no current event loop"
- Updated docstrings
- Added
ignore_manual_init
option todependency
decorator
- Added ability to pass custom
scope_class
toinit_dependencies
andshutdown_dependencies
- Added
ContextVarScope
for storing dependencies incontextvars
- Renamed
_internal
module tosupport
- Breaking changes:
- Removed
ParentCallScope
- Renamed
enter_decorator
andexit_decorator
toenter_inject
andexit_inject
- Renamed
LocalScope
andGlobalScope
toAutoScope
andManualScope
Scope
now can't be imported, instead useAutoScope
orManualScope
- Replaced
Scope.close_local
andScope.close_global
with[AutoScope | ManualScope].enter
and[AutoScope | ManualScope].shutdown
- Removed
- Added
helpers.lifespan
function for simple resource management
- Fix async singleton through sync resolving
@inject
now can be placed on bottom with@contxtlib.asyncontextmanager
- Fix scopes closing when injecting in generator functions
- Fix scopes closing in dependencies
- Removed dead code branches
- Refactor injection logic
- Fix problems with generators
- Register dependencies in
inject
, not inProvide
- Get rid of
in_use
parameter inProvider
- Backward incompatible changes
- Renamed
init_resources
andshutdown_resources
toinit_dependencies
andshutdown_dependencies
- Removed
resource
decorator (usedependency
decorator withSingletonScope
instead)
- Renamed
- Expose scopes to public API
- Experimental release (all changes are under the hood, there is no public API yet)
- Add
dependency
decorator, now you can specify scope_class, even user-defined - Add
ParentCallScope
- dependency result cached for lifetime of parent function call
- Add
- Clear store for singleton scope on
shutdown_resource
- Fix "coroutine was never awaited" warning when closing context manager for sync function in async context
- Added
registry
object for managing dependencies - Now you can override dependencies. Useful for testing and "ABC" dependencies
- Removed
make_dependency
experimental function - Some code cleanups
- Fixed tests inconsistency (cleanup picodi resources after each test)
- Add
helpers
module - Fix potential
RuntimeWarning
- Switch from storing only resource deps to storing all deps
- Don't initialize unused resources
- Refactor scope resource management
- Removed dead code (detecting fastapi dependency)
- Fix resource placement bug
- Change typings for
init_resources
andshutdown_resources
. Now they always returnAwaitable
. - Add tests for FastAPI integration
- Fix injected generator dependencies resolving
- Fix FastAPI support
- Added
make_dependency
function (experimental)
- Internal refactoring
- Updated README.md
- Removed
use_cache
parameter - Added tests
- Fix context manager error
- Initial release