diff --git a/README.md b/README.md index 586bbf8..46dbf48 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,10 @@ Easy dependency injection for all, works with Python 3.8-3.12. Main features and * **multiple containers**; * **overriding** dependencies for tests without wiring; * **100%** code coverage and very simple code; -* good [documentation](https://injection.readthedocs.io/latest/). +* good [documentation](https://injection.readthedocs.io/latest/); +* intuitive and almost identical api with [dependency-injector](https://github.com/ets-labs/python-dependency-injector), +which will allow you to easily migrate to injection +(see [migration from dependency injector](https://injection.readthedocs.io/latest/introduction/migration-from-dependency-injector.html)); --- diff --git a/docs/dev/migration-from-dependency-injector.md b/docs/dev/migration-from-dependency-injector.md new file mode 100644 index 0000000..d2310f6 --- /dev/null +++ b/docs/dev/migration-from-dependency-injector.md @@ -0,0 +1,30 @@ +# Migration from Dependency Injector + +If you have already used a wonderful package +[dependency-injector](https://github.com/ets-labs/python-dependency-injector), +then you probably know that there have been no new versions for a long time. +It also lacks integration with FastAPI, for example to determine dependencies with **Annotated** +(see [issues](https://github.com/ets-labs/python-dependency-injector/issues?q=is%3Aissue+is%3Aopen+annotated)). +[Injection](https://github.com/nightblure/injection) package has an almost identical API to the [dependency-injector](https://github.com/ets-labs/python-dependency-injector) +and eliminates its shortcomings, which will make migrating very easy. + +--- + +⚠️ **IMPORTANT** ❗ + +[Injection](https://github.com/nightblure/injection) **does not implement** **some** [providers](https://python-dependency-injector.ets-labs.org/providers/index.html) +(Resource, List, Dict, Aggregate and etc.) because the developer considered them to be **rarely used** in practice. +In this case, you don't need to do the migration, but if you really want to use my package, +I'd love to see your [issues](https://github.com/nightblure/injection/issues) and/or [MR](https://github.com/nightblure/injection/pulls)! + +--- + +To **migrate**, follow these **steps**: +1. **Replace imports**: +* `from dependency_injector import providers` -> `from injection import providers`; + +* `from dependency_injector.wiring import Provide, inject` -> `from injection import Provide, inject` + +* `from dependency_injector.containers import DeclarativeContainer` -> `from injection import DeclarativeContainer` + +2. **Replace method call**: `some_container.override_providers(**overrides)` -> ``some_container.override_providers(overrides)`` diff --git a/docs/index.md b/docs/index.md index 3dc6d75..09b5994 100644 --- a/docs/index.md +++ b/docs/index.md @@ -19,9 +19,9 @@ .. toctree:: :maxdepth: 1 - :caption: For developers + :caption: DEV section + dev/migration-from-dependency-injector dev/contributing - ``` diff --git a/docs/introduction/key_features.md b/docs/introduction/concepts-and-key_features.md similarity index 79% rename from docs/introduction/key_features.md rename to docs/introduction/concepts-and-key_features.md index 7bd315f..f651feb 100644 --- a/docs/introduction/key_features.md +++ b/docs/introduction/concepts-and-key_features.md @@ -10,10 +10,10 @@ The public API of this framework is almost completely identical to because the author found it successful and understandable. In addition, this will provide an easy migration to the current framework with [Dependency Injector](https://python-dependency-injector.ets-labs.org/index.html#) -(see section migration from Dependency Injector). +(see [migration from Dependency Injector](https://injection.readthedocs.io/latest/introduction/migration-from-dependency-injector.html)). ## Features * providers - delegate object creation and lifecycle management to providers; * support Python 3.8-3.12; -* works with FastAPI, Flask, Django, Litestar; +* works with FastAPI, Flask, Django REST Framework, Litestar; diff --git a/docs/introduction/installation.md b/docs/introduction/installation.md index 094b960..965e59d 100644 --- a/docs/introduction/installation.md +++ b/docs/introduction/installation.md @@ -3,7 +3,7 @@ `Injection` works with Python versions 3.8-3.12 and is available on PyPI. To install the latest version you can use pip: ```bash -pip install injection +pip install deps-injection ``` `Injection` versioned according to [Semantic Versioning](https://semver.org/).