Fastapi-injectable

Latest version: v0.7.0

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

Scan your dependencies

Page 1 of 2

0.7.0

This release introduces a comprehensive event loop management system, providing flexible strategies for handling asynchronous code in different contexts.

Major Features

Loop Management Strategies

Three different strategies are now available:

* **`current`** (default): Uses the current thread's event loop
* **`isolated`**: Creates a separate isolated loop
* **`background_thread`**: Runs a dedicated background thread with its own event loop

API Enhancements

* Added `loop_manager` central object for controlling loop strategy and execution
* Enhanced `run_coroutine_sync` function to work with the loop manager
* Updated `AsyncExitStackManager` to work with the loop manager for proper resource cleanup

Benefits

* **Flexibility**: Run async code from any context (sync functions, background threads, etc.)
* **Reliability**: Ensure resources are properly cleaned up regardless of execution context
* **Compatibility**: Work with libraries like `aiohttp` that require specific loop handling

Code Changes

* bump: from 0.6.0 to 0.7.0 (85) JasperSui
* feat: add event loop management system (84) JasperSui

**Full Changelog**: https://github.com/JasperSui/fastapi-injectable/compare/v0.6.0...v0.7.0

0.6.0

This release significantly simplifies the event loop management approach, with breaking changes to how asynchronous code is handled.

BREAKING CHANGES

* **Removed `LoopManager` class and daemon thread approach**
* **Simplified `run_coroutine_sync` function** - now relies on the application's main event loop
* **Removed `RunCoroutineSyncMaxRetriesError` exception class**
* **Removed timeout and retry parameters** from `run_coroutine_sync` function

These changes simplify the concurrency model but require updates to code that relies on custom event loop management.

Major Changes

Event Loop Management Improvements

* Refactored to use the application's main event loop instead of managing a separate loop
* Simplified `AsyncExitStackManager` to directly await coroutines without loop management
* Converted async tests to sync tests using the simplified `run_coroutine_sync`
* Removed daemon thread approach for running a separate event loop

Compatibility Improvements

* Resolved compatibility issues with libraries like aiohttp where injected objects were attached to the wrong event loop
* Simplified stack cleanup by removing multi-loop considerations
* Made the library more predictable by using a single event loop model
* Reduced complexity and potential threading issues

Code Changes

* bump: from 0.5.0 to 0.6.0 (82) JasperSui
* refactor: simplify event loop management to use application's main loop (81) JasperSui

**Full Changelog**: https://github.com/JasperSui/fastapi-injectable/compare/v0.5.0...v0.6.0

0.5.0

This release includes significant changes to error handling and dependency resolution, with breaking changes to the API.

BREAKING CHANGES

* **Removed `DependencyResolveError` exception class**
* **Removed `raise_exception` parameter** from:
* `injectable` decorator
* `resolve_dependencies` function
* `get_injected_obj` function

These changes simplify the error handling model but require updates to code that relies on these features.

Major Changes

Dependency Resolution Improvements

* Refactored to ignore FastAPI route-specific errors during dependency resolution
* Enhanced stability when working with FastAPI's dependency injection system
* Simplified error handling approach throughout the library

Package Structure Fixes

* Correctly placed `py.typed` marker file under the `fastapi_injectable` folder
* Improved MyPy integration and type checking capabilities

Code Changes

* fix: correctly place py.typed file under fastapi_injectable folder (76) JasperSui
* refactor(dependencies): ignore FastAPI route-specific errors during dependency resolution (77) JasperSui
* docs: remove FAQ redundant toc (58) JasperSui
* bump: from 0.4.1 to 0.5.0 (78) JasperSui

:package: Dependencies

Core Dependencies

Development Dependencies
* build(deps): bump myst-parser from 4.0.0 to 4.0.1 (68) dependabot
* build(deps-dev): bump watchfiles from 1.0.3 to 1.0.4 (69) dependabot
* build(deps-dev): bump babel from 2.16.0 to 2.17.0 (67) dependabot
* build(deps-dev): bump ruff from 0.8.4 to 0.8.6 (66) dependabot
* build(deps-dev): bump executing from 2.1.0 to 2.2.0 (65) dependabot

GitHub Actions
* build(deps): bump actions/upload-artifact from 4.6.0 to 4.6.1 (73) dependabot
* build(deps): bump codecov/codecov-action from 5.3.1 to 5.4.0 (72) dependabot
* build(deps): bump crazy-max/ghaction-github-labeler from 5.0.0 to 5.2.0 (71) dependabot
* build(deps): bump actions/download-artifact from 4.1.8 to 4.1.9 (70) dependabot


**Full Changelog**: https://github.com/JasperSui/fastapi-injectable/compare/v0.4.1...v0.5.0

0.4.1

Changes

* bump: from 0.4.0 to 0.4.1 (52) JasperSui
* chore: make register_app public (51) JasperSui

0.4.0

Major update introducing concurrency improvements and enhanced request context handling.

Major Changes

Concurrency Refactor
* Implemented dedicated event loop manager for coroutine execution
* Improved async task handling reliability
* Reduced potential race conditions in concurrent operations

Request Context Enhancements
* Added ability to register and retrieve real app instance during request resolution (thanks to lokhman's [issue](https://github.com/JasperSui/fastapi-injectable/issues/47))
* Enabled deeper integration with FastAPI's request lifecycle

Code Changes
* bump: from 0.3.0 to 0.4.0 (50) JasperSui
* refactor(concurrency): implement dedicated event loop manager for coroutine execution (49) JasperSui
* feat: allow registration to get real app from request when resolving depedencies (48) JasperSui

0.3.0

Major update adding args/kwargs support to dependency injection and improving type hints throughout the codebase.

Major Changes

Enhanced Dependency Injection

* Added support for passing positional and keyword arguments to `get_injected_obj`
* Improved flexibility in dependency instantiation
* Enhanced type safety for argument passing

Type System Improvements

* Added `py.typed` marker file for better MyPy integration
* Added comprehensive `overload` type hints for `injectable` decorator and `get_injected_obj`
* Improved type hints throughout the codebase
* Removed unnecessary type ignores in tests

Testing Enhancements

* Added extensive test coverage for new args/kwargs functionality:
* Basic args/kwargs usage
* Args/kwargs with sync functions
* Args/kwargs with async functions
* Args/kwargs with sync/async generators
* Combined args and kwargs usage
* Maintained 100% code coverage

Code Changes

* bump: from 0.2.0 to 0.3.0 (46) JasperSui
* feat: add args/kwargs support to get_injected_obj and improve type hints (45) JasperSui
* docs: correct readme faq toc (38) JasperSui
* chore(dev): update pre commit config and fix md by it (37) JasperSui
* docs: add FAQ (36) JasperSui
* chore(README): update logo url (35) JasperSui

:package: Dependencies

* build(deps-dev): bump jinja2 from 3.1.4 to 3.1.5 (40) dependabot
* build(deps-dev): bump coverage from 7.6.9 to 7.6.10 (41) dependabot
* build(deps-dev): bump charset-normalizer from 3.4.0 to 3.4.1 (42) dependabot
* build(deps-dev): bump urllib3 from 2.2.3 to 2.3.0 (43) dependabot
* build(deps-dev): bump click from 8.1.7 to 8.1.8 (39) dependabot

Page 1 of 2

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.