From dd7c113169cdc2669c1e606a013f1e65834a5a7e Mon Sep 17 00:00:00 2001 From: Rodrigo Martins Higuti de Oliveira Date: Thu, 4 Jul 2024 19:12:30 -0300 Subject: [PATCH] Deprecate Python 3.6 and 3.7 --- .bumpversion.cfg | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- AUTHORS.rst | 3 +- CHANGELOG.rst | 5 + Makefile | 10 +- docs/.buildinfo | 2 +- docs/_modules/index.html | 8 +- .../autowiring/autowired_decorator.html | 43 ++- .../injectable/autowiring/autowired_type.html | 20 +- .../injectable/container/injectable.html | 22 +- .../container/injection_container.html | 9 +- .../container/load_injection_container.html | 11 +- .../injectable/errors/autowiring_error.html | 20 +- .../injectable/errors/injection_error.html | 20 +- .../_modules/injectable/injection/inject.html | 22 +- .../injection/injectable_decorator.html | 20 +- .../injectable_factory_decorator.html | 11 +- .../testing/clear_injectables_util.html | 20 +- .../testing/register_injectables_util.html | 11 +- .../reset_injection_container_util.html | 20 +- docs/_static/basic.css | 6 +- docs/_static/classic.css | 2 +- docs/_static/doctools.js | 77 +++-- docs/_static/documentation_options.js | 6 +- docs/_static/language_data.js | 2 +- docs/_static/pygments.css | 9 +- docs/_static/searchtools.js | 23 +- docs/authors.html | 18 +- docs/caveats.html | 23 +- docs/changelog.html | 283 +++++++++--------- docs/conf.py | 2 +- docs/contributing.html | 15 +- docs/index.html | 74 ++--- docs/installation.html | 15 +- docs/objects.inv | Bin 1429 -> 1429 bytes docs/py-modindex.html | 8 +- docs/readme.html | 25 +- docs/reference/index.html | 15 +- docs/reference/injectable.html | 47 +-- docs/reference/injectable_constants.html | 17 +- docs/reference/injectable_errors.html | 19 +- docs/reference/injectable_testing.html | 19 +- docs/searchindex.js | 2 +- docs/usage/TLDR.html | 15 +- docs/usage/basic_usage.html | 15 +- docs/usage/cyclic_dependency.html | 15 +- docs/usage/dependencies_precedence.html | 19 +- docs/usage/factory.html | 15 +- docs/usage/index.html | 15 +- docs/usage/injectable_mocking_for_tests.html | 15 +- docs/usage/injecting_existing_instance.html | 15 +- ...jection_container_resetting_for_tests.html | 15 +- docs/usage/lazy_injection.html | 15 +- docs/usage/namespaces.html | 15 +- docs/usage/optional_injection.html | 15 +- docs/usage/qualifier_overloading.html | 15 +- docs/usage/service_locator.html | 15 +- docs/usage/singletons.html | 15 +- requirements.dev.txt | 5 +- requirements.txt | 1 - setup.py | 6 +- 62 files changed, 660 insertions(+), 571 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index e21acff..6f31908 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.4.7 +current_version = 4.0.0 [bumpversion:file:Makefile] search = CURRENT_VERSION = {current_version} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 66a6041..7df0a95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: max-parallel: 4 matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0-rc.1] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca8acba..f675e07 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: - name: Publish new release to PyPI uses: mariamrf/py-package-publish-action@v1.0.0 with: - python_version: 3.7.7 + python_version: 3.8.19 env: TWINE_USERNAME: ${{ secrets.pypi_username }} TWINE_PASSWORD: ${{ secrets.pypi_password }} diff --git a/AUTHORS.rst b/AUTHORS.rst index e7abbd1..edc59bf 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -2,6 +2,7 @@ Authors ======= -* Rodrigo Martins de Oliveira - https://github.com/allrod5 +* Rodrigo Oliveira - https://github.com/roo-oliv * Craig Minihan - https://github.com/craigminihan * Teodor Kulej - https://github.com/mt3o +* David Lozano - https://github.com/lozanocampillod diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b6b0940..e102bdb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ Changelog ========= +4.0.0 (2024-07-04) +------------------ +* Drop support for Python version 3.6 and 3.7 +* Comply with PEP-593 and support typing.Annotated + 3.4.7 (2021-08-15) ------------------ diff --git a/Makefile b/Makefile index 919f122..a41cb57 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: environment environment: ## create environment - pyenv install -s 3.6.9 - pyenv virtualenv 3.6.9 injectable + pyenv install -s 3.8.19 + pyenv virtualenv 3.8.19 injectable pyenv local injectable .PHONY: requirements @@ -24,7 +24,7 @@ black-check: ## check Black code style @echo "\033[33mBlack Code Style\033[0m" @echo "\033[33m================\033[0m" @echo "" - @python -m black --target-version=py36 --check --exclude="build/|buck-out/|dist/|_build/\ + @python -m black --target-version=py38 --check --exclude="build/|buck-out/|dist/|_build/\ |pip/|env/|\.pip/|\.git/|\.hg/|\.mypy_cache/|\.tox/|\.venv/" . \ && echo "\n\n\033[32mSuccess\033[0m\n" || (echo "\n\n\033[31mFailure\033[0m\n\n\ \033[34mRun \"\e[4mmake black\e[24m\" to apply style formatting to your code\ @@ -32,7 +32,7 @@ black-check: ## check Black code style .PHONY: black black: ## apply the Black code style to code - black --target-version=py36 --exclude="build/|buck-out/|dist/|_build/|pip/|env/|\.pip/|\.git/\ + black --target-version=py38 --exclude="build/|buck-out/|dist/|_build/|pip/|env/|\.pip/|\.git/\ |\.hg/|\.mypy_cache/|\.tox/|\.venv/" . .PHONY: tests @@ -72,7 +72,7 @@ docs: make html -B cp -a build/html/. docs -CURRENT_VERSION = 3.4.7 +CURRENT_VERSION = 4.0.0 .PHONY: bump-patch-version bump-patch-version: diff --git a/docs/.buildinfo b/docs/.buildinfo index ce63eb4..897c783 100644 --- a/docs/.buildinfo +++ b/docs/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 608fa2521195fa2771065e2da377c1f9 +config: 59603b7feaea2199af3a5ec748336286 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_modules/index.html b/docs/_modules/index.html index 1f0ddd8..eb6e00a 100644 --- a/docs/_modules/index.html +++ b/docs/_modules/index.html @@ -4,7 +4,7 @@ - Overview: module code — injectable 3.4.7 documentation + Overview: module code — injectable 4.0.0 documentation @@ -28,7 +28,7 @@

Navigation

@@ -108,8 +108,8 @@

Navigation

\ No newline at end of file diff --git a/docs/_modules/injectable/autowiring/autowired_decorator.html b/docs/_modules/injectable/autowiring/autowired_decorator.html index c98d294..b165c3f 100644 --- a/docs/_modules/injectable/autowiring/autowired_decorator.html +++ b/docs/_modules/injectable/autowiring/autowired_decorator.html @@ -4,15 +4,14 @@ - injectable.autowiring.autowired_decorator — injectable 3.4.6 documentation - - + injectable.autowiring.autowired_decorator — injectable 3.4.7 documentation + + - + - @@ -29,7 +28,7 @@

Navigation

@@ -49,7 +48,7 @@

Navigation

Source code for injectable.autowiring.autowired_decorator

 import inspect
 from functools import wraps
-from typing import TypeVar, Callable, Any
+from typing import TypeVar, Callable, Any, get_args, _AnnotatedAlias
 
 from injectable.autowiring.autowired_type import _Autowired
 from injectable.errors import AutowiringError
@@ -58,7 +57,7 @@ 

Source code for injectable.autowiring.autowired_decorator

[docs]def autowired(func: T) -> T: - """ + """ Function decorator to setup dependency injection autowiring. Only parameters annotated with :class:`Autowired <injectable.Autowired>` will be @@ -92,7 +91,9 @@

Source code for injectable.autowiring.autowired_decorator

signature = inspect.signature(func) autowired_parameters = [] for index, parameter in enumerate(signature.parameters.values()): - if not isinstance(parameter.annotation, _Autowired): + annotation = _get_parameter_annotation(parameter) + + if not isinstance(annotation, _Autowired): if len(autowired_parameters) == 0 or parameter.kind in [ parameter.KEYWORD_ONLY, parameter.VAR_KEYWORD, @@ -117,7 +118,8 @@

Source code for injectable.autowiring.autowired_decorator

for parameter in autowired_parameters: if parameter.name in bound_arguments: continue - dependency = parameter.annotation.inject() + annotation = _get_parameter_annotation(parameter) + dependency = annotation.inject() if parameter.kind is parameter.POSITIONAL_ONLY: args.append(dependency) else: @@ -126,6 +128,20 @@

Source code for injectable.autowiring.autowired_decorator

return func(*args, **kwargs) return wrapper
+ + +def _get_parameter_annotation(parameter) -> type: + if isinstance(parameter.annotation, _AnnotatedAlias): + autowired_annotations = list( + filter(lambda t: isinstance(t, _Autowired), get_args(parameter.annotation)) + ) + if len(autowired_annotations) == 0: + return parameter.annotation + if len(autowired_annotations) > 1: + raise AutowiringError("Multiple Autowired annotations found") + return autowired_annotations[0] + + return parameter.annotation
@@ -141,7 +157,7 @@

Source code for injectable.autowiring.autowired_decorator

Quick search
@@ -152,6 +168,7 @@

Quick search

  • Installation
  • Usage Examples
  • Reference
  • +
  • Caveats
  • Contributing
  • Authors
  • Changelog
  • @@ -175,8 +192,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/_modules/injectable/autowiring/autowired_type.html b/docs/_modules/injectable/autowiring/autowired_type.html index 6014817..12fcf36 100644 --- a/docs/_modules/injectable/autowiring/autowired_type.html +++ b/docs/_modules/injectable/autowiring/autowired_type.html @@ -4,15 +4,14 @@ - injectable.autowiring.autowired_type — injectable 3.4.6 documentation - - + injectable.autowiring.autowired_type — injectable 3.4.7 documentation + + - + - @@ -29,7 +28,7 @@

    Navigation

    @@ -136,7 +135,7 @@

    Source code for injectable.autowiring.autowired_type

    [docs]class Autowired: - """ + """ Autowired type annotation marks a parameter to be autowired for injection. Autowired parameters must be last in declaration if there are others which aren't @@ -204,7 +203,7 @@

    Source code for injectable.autowiring.autowired_type

    Quick search
    @@ -215,6 +214,7 @@

    Quick search

  • Installation
  • Usage Examples
  • Reference
  • +
  • Caveats
  • Contributing
  • Authors
  • Changelog
  • @@ -238,8 +238,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/_modules/injectable/container/injectable.html b/docs/_modules/injectable/container/injectable.html index 89ed176..bb1fc08 100644 --- a/docs/_modules/injectable/container/injectable.html +++ b/docs/_modules/injectable/container/injectable.html @@ -4,15 +4,14 @@ - injectable.container.injectable — injectable 3.4.6 documentation - - + injectable.container.injectable — injectable 3.4.7 documentation + + - + - @@ -29,7 +28,7 @@

    Navigation

    @@ -58,7 +57,7 @@

    Source code for injectable.container.injectable

    <
    [docs]@dataclass(frozen=True) class Injectable: - """ + """ Injectable is the low-level container class in which information regarding an injectable dependency is stored for registering in a namespace. @@ -76,7 +75,7 @@

    Source code for injectable.container.injectable

    < one instance of it will be created and shared globally. Defaults to False. """ - constructor: callable = field(compare=False) + constructor: callable = field(compare=False) unique_id: str = field(default_factory=lambda: uuid.uuid1().hex) primary: bool = False group: Optional[str] = None @@ -111,7 +110,7 @@

    Source code for injectable.container.injectable

    <

    Quick search

    @@ -122,6 +121,7 @@

    Quick search

  • Installation
  • Usage Examples
  • Reference
  • +
  • Caveats
  • Contributing
  • Authors
  • Changelog
  • @@ -145,8 +145,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/_modules/injectable/container/injection_container.html b/docs/_modules/injectable/container/injection_container.html index 51a9912..8a9dcf4 100644 --- a/docs/_modules/injectable/container/injection_container.html +++ b/docs/_modules/injectable/container/injection_container.html @@ -61,7 +61,7 @@

    Source code for injectable.container.injection_container

    [docs]class InjectionContainer: - """ + """ InjectionContainer globally manages injection namespaces and the respective injectables registries. @@ -95,7 +95,7 @@

    Source code for injectable.container.injection_container

    *, default_namespace: str = DEFAULT_NAMESPACE, ): - """ + """ Loads injectables under the search path to the :class:`InjectionContainer` under the designated namespaces. @@ -271,6 +271,7 @@

    Quick search

  • Installation
  • Usage Examples
  • Reference
  • +
  • Caveats
  • Contributing
  • Authors
  • Changelog
  • @@ -294,8 +295,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/_modules/injectable/container/load_injection_container.html b/docs/_modules/injectable/container/load_injection_container.html index 29dacfc..13409c3 100644 --- a/docs/_modules/injectable/container/load_injection_container.html +++ b/docs/_modules/injectable/container/load_injection_container.html @@ -4,7 +4,7 @@ - injectable.container.load_injection_container — injectable 3.4.6 documentation + injectable.container.load_injection_container — injectable 3.4.7 documentation @@ -28,7 +28,7 @@

    Navigation

    @@ -59,7 +59,7 @@

    Source code for injectable.container.load_injection_container

    default_namespace: str = DEFAULT_NAMESPACE, encoding: str = "utf-8", ): - """ + """ Loads injectables under the search path to a shared injection container under the designated namespaces. @@ -119,6 +119,7 @@

    Quick search

  • Installation
  • Usage Examples
  • Reference
  • +
  • Caveats
  • Contributing
  • Authors
  • Changelog
  • @@ -142,8 +143,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/_modules/injectable/errors/autowiring_error.html b/docs/_modules/injectable/errors/autowiring_error.html index 0da7d0f..ed146a7 100644 --- a/docs/_modules/injectable/errors/autowiring_error.html +++ b/docs/_modules/injectable/errors/autowiring_error.html @@ -4,15 +4,14 @@ - injectable.errors.autowiring_error — injectable 3.4.6 documentation - - + injectable.errors.autowiring_error — injectable 3.4.7 documentation + + - + - @@ -29,7 +28,7 @@

    Navigation

    @@ -48,7 +47,7 @@

    Navigation

    Source code for injectable.errors.autowiring_error

     
    [docs]class AutowiringError(Exception): - """ + """ Error indicating autowiring of a function failed. """ @@ -68,7 +67,7 @@

    Source code for injectable.errors.autowiring_error

    Quick search
    @@ -79,6 +78,7 @@

    Quick search

  • Installation
  • Usage Examples
  • Reference
  • +
  • Caveats
  • Contributing
  • Authors
  • Changelog
  • @@ -102,8 +102,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/_modules/injectable/errors/injection_error.html b/docs/_modules/injectable/errors/injection_error.html index df27a74..6cecaef 100644 --- a/docs/_modules/injectable/errors/injection_error.html +++ b/docs/_modules/injectable/errors/injection_error.html @@ -4,15 +4,14 @@ - injectable.errors.injection_error — injectable 3.4.6 documentation - - + injectable.errors.injection_error — injectable 3.4.7 documentation + + - + - @@ -29,7 +28,7 @@

    Navigation

    @@ -48,7 +47,7 @@

    Navigation

    Source code for injectable.errors.injection_error

     
    [docs]class InjectionError(RuntimeError): - """ + """ Error indicating dependency injection failed. """ @@ -68,7 +67,7 @@

    Source code for injectable.errors.injection_error

    Quick search
    @@ -79,6 +78,7 @@

    Quick search

  • Installation
  • Usage Examples
  • Reference
  • +
  • Caveats
  • Contributing
  • Authors
  • Changelog
  • @@ -102,8 +102,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/_modules/injectable/injection/inject.html b/docs/_modules/injectable/injection/inject.html index 3fc490a..926706e 100644 --- a/docs/_modules/injectable/injection/inject.html +++ b/docs/_modules/injectable/injection/inject.html @@ -4,15 +4,14 @@ - injectable.injection.inject — injectable 3.4.6 documentation - - + injectable.injection.inject — injectable 3.4.7 documentation + + - + - @@ -29,7 +28,7 @@

    Navigation

    @@ -71,7 +70,7 @@

    Source code for injectable.injection.inject

         lazy: bool = False,
         optional: bool = False,
     ) -> T:
    -    """
    +    """
         Injects the requested dependency by instantiating a new instance of it or a
         singleton instance if specified by the injectable. Returns an instance of the
         requested dependency.
    @@ -154,7 +153,7 @@ 

    Source code for injectable.injection.inject

         lazy: bool = False,
         optional: bool = False,
     ) -> List[T]:
    -    """
    +    """
         Injects all injectables that resolves to the specified dependency. Returns a list of
         instances matching the requested dependency.
     
    @@ -239,7 +238,7 @@ 

    Source code for injectable.injection.inject

       

    Quick search

    @@ -250,6 +249,7 @@

    Quick search

  • Installation
  • Usage Examples
  • Reference
  • +
  • Caveats
  • Contributing
  • Authors
  • Changelog
  • @@ -273,8 +273,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/_modules/injectable/injection/injectable_decorator.html b/docs/_modules/injectable/injection/injectable_decorator.html index 6d1de1b..d37118a 100644 --- a/docs/_modules/injectable/injection/injectable_decorator.html +++ b/docs/_modules/injectable/injection/injectable_decorator.html @@ -4,15 +4,14 @@ - injectable.injection.injectable_decorator — injectable 3.4.6 documentation - - + injectable.injection.injectable_decorator — injectable 3.4.7 documentation + + - + - @@ -29,7 +28,7 @@

    Navigation

    @@ -64,7 +63,7 @@

    Source code for injectable.injection.injectable_decorator

    group: str = None, singleton: bool = False, ) -> T: - """ + """ Class decorator to mark it as an injectable dependency. This decorator accepts customization parameters but can be invoked without the @@ -121,7 +120,7 @@

    Source code for injectable.injection.injectable_decorator

    Quick search
    @@ -132,6 +131,7 @@

    Quick search

  • Installation
  • Usage Examples
  • Reference
  • +
  • Caveats
  • Contributing
  • Authors
  • Changelog
  • @@ -155,8 +155,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/_modules/injectable/injection/injectable_factory_decorator.html b/docs/_modules/injectable/injection/injectable_factory_decorator.html index 83feb29..a21da00 100644 --- a/docs/_modules/injectable/injection/injectable_factory_decorator.html +++ b/docs/_modules/injectable/injection/injectable_factory_decorator.html @@ -4,7 +4,7 @@ - injectable.injection.injectable_factory_decorator — injectable 3.4.6 documentation + injectable.injection.injectable_factory_decorator — injectable 3.4.7 documentation @@ -28,7 +28,7 @@

    Navigation

    @@ -64,7 +64,7 @@

    Source code for injectable.injection.injectable_factory_decorator

    group: str = None, singleton: bool = False, ) -> Callable[..., Callable[..., T]]: - """ + """ Function decorator to mark it as a injectable factory for the dependency. At least one of ``dependency`` or ``qualifier`` parameters need to be defined. An @@ -148,6 +148,7 @@

    Quick search

  • Installation
  • Usage Examples
  • Reference
  • +
  • Caveats
  • Contributing
  • Authors
  • Changelog
  • @@ -171,8 +172,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/_modules/injectable/testing/clear_injectables_util.html b/docs/_modules/injectable/testing/clear_injectables_util.html index 5cb39f1..ec0e8f5 100644 --- a/docs/_modules/injectable/testing/clear_injectables_util.html +++ b/docs/_modules/injectable/testing/clear_injectables_util.html @@ -4,15 +4,14 @@ - injectable.testing.clear_injectables_util — injectable 3.4.6 documentation - - + injectable.testing.clear_injectables_util — injectable 3.4.7 documentation + + - + - @@ -29,7 +28,7 @@

    Navigation

    @@ -58,7 +57,7 @@

    Source code for injectable.testing.clear_injectables_util

    [docs]def clear_injectables( dependency: Union[type, str], namespace: str = None ) -> Set[Injectable]: - """ + """ Utility function to clear all injectables registered for the dependency in a given namespace. Returns a set containing all cleared injectables. @@ -97,7 +96,7 @@

    Source code for injectable.testing.clear_injectables_util

    Quick search
    @@ -108,6 +107,7 @@

    Quick search

  • Installation
  • Usage Examples
  • Reference
  • +
  • Caveats
  • Contributing
  • Authors
  • Changelog
  • @@ -131,8 +131,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/_modules/injectable/testing/register_injectables_util.html b/docs/_modules/injectable/testing/register_injectables_util.html index 4b1935a..e3c5efc 100644 --- a/docs/_modules/injectable/testing/register_injectables_util.html +++ b/docs/_modules/injectable/testing/register_injectables_util.html @@ -4,7 +4,7 @@ - injectable.testing.register_injectables_util — injectable 3.4.6 documentation + injectable.testing.register_injectables_util — injectable 3.4.7 documentation @@ -28,7 +28,7 @@

    Navigation

    @@ -60,7 +60,7 @@

    Source code for injectable.testing.register_injectables_util

    namespace: str = DEFAULT_NAMESPACE, propagate: bool = False, ): - """ + """ Utility function to manually register injectables in a given namespace for the provided class and/or qualifier. @@ -128,6 +128,7 @@

    Quick search

  • Installation
  • Usage Examples
  • Reference
  • +
  • Caveats
  • Contributing
  • Authors
  • Changelog
  • @@ -151,8 +152,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/_modules/injectable/testing/reset_injection_container_util.html b/docs/_modules/injectable/testing/reset_injection_container_util.html index 330298c..91a25ae 100644 --- a/docs/_modules/injectable/testing/reset_injection_container_util.html +++ b/docs/_modules/injectable/testing/reset_injection_container_util.html @@ -4,15 +4,14 @@ - injectable.testing.reset_injection_container_util — injectable 3.4.6 documentation - - + injectable.testing.reset_injection_container_util — injectable 3.4.7 documentation + + - + - @@ -29,7 +28,7 @@

    Navigation

    @@ -51,7 +50,7 @@

    Source code for injectable.testing.reset_injection_container_util

    [docs]def reset_injection_container(): - """ + """ Utility function to reset the injection container, clearing all injectables registered from all namespaces and reseting the record for already scanned files. @@ -81,7 +80,7 @@

    Source code for injectable.testing.reset_injection_container_util

    Quick search
    @@ -92,6 +91,7 @@

    Quick search

  • Installation
  • Usage Examples
  • Reference
  • +
  • Caveats
  • Contributing
  • Authors
  • Changelog
  • @@ -115,8 +115,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/_static/basic.css b/docs/_static/basic.css index 1dba819..80a225d 100644 --- a/docs/_static/basic.css +++ b/docs/_static/basic.css @@ -4,7 +4,7 @@ * * Sphinx stylesheet -- basic theme. * - * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -731,8 +731,9 @@ dl.glossary dt { .classifier:before { font-style: normal; - margin: 0.5em; + margin: 0 0.5em; content: ":"; + display: inline-block; } abbr, acronym { @@ -756,6 +757,7 @@ span.pre { -ms-hyphens: none; -webkit-hyphens: none; hyphens: none; + white-space: nowrap; } div[class*="highlight-"] { diff --git a/docs/_static/classic.css b/docs/_static/classic.css index 679adc8..e7f5610 100644 --- a/docs/_static/classic.css +++ b/docs/_static/classic.css @@ -4,7 +4,7 @@ * * Sphinx stylesheet -- classic theme. * - * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ diff --git a/docs/_static/doctools.js b/docs/_static/doctools.js index 8cbf1b1..e1bfd70 100644 --- a/docs/_static/doctools.js +++ b/docs/_static/doctools.js @@ -4,7 +4,7 @@ * * Sphinx JavaScript utilities for all documentation. * - * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -154,9 +154,7 @@ var Documentation = { this.fixFirefoxAnchorBug(); this.highlightSearchWords(); this.initIndexTable(); - if (DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) { - this.initOnKeyListeners(); - } + this.initOnKeyListeners(); }, /** @@ -264,6 +262,16 @@ var Documentation = { hideSearchWords : function() { $('#searchbox .highlight-link').fadeOut(300); $('span.highlighted').removeClass('highlighted'); + var url = new URL(window.location); + url.searchParams.delete('highlight'); + window.history.replaceState({}, '', url); + }, + + /** + * helper function to focus on search bar + */ + focusSearchBar : function() { + $('input[name=q]').first().focus(); }, /** @@ -288,27 +296,54 @@ var Documentation = { }, initOnKeyListeners: function() { + // only install a listener if it is really needed + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && + !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) + return; + $(document).keydown(function(event) { var activeElementType = document.activeElement.tagName; // don't navigate when in search box, textarea, dropdown or button if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT' - && activeElementType !== 'BUTTON' && !event.altKey && !event.ctrlKey && !event.metaKey - && !event.shiftKey) { - switch (event.keyCode) { - case 37: // left - var prevHref = $('link[rel="prev"]').prop('href'); - if (prevHref) { - window.location.href = prevHref; - return false; - } - break; - case 39: // right - var nextHref = $('link[rel="next"]').prop('href'); - if (nextHref) { - window.location.href = nextHref; - return false; - } - break; + && activeElementType !== 'BUTTON') { + if (event.altKey || event.ctrlKey || event.metaKey) + return; + + if (!event.shiftKey) { + switch (event.key) { + case 'ArrowLeft': + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) + break; + var prevHref = $('link[rel="prev"]').prop('href'); + if (prevHref) { + window.location.href = prevHref; + return false; + } + break; + case 'ArrowRight': + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) + break; + var nextHref = $('link[rel="next"]').prop('href'); + if (nextHref) { + window.location.href = nextHref; + return false; + } + break; + case 'Escape': + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) + break; + Documentation.hideSearchWords(); + return false; + } + } + + // some keyboard layouts may need Shift to get / + switch (event.key) { + case '/': + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) + break; + Documentation.focusSearchBar(); + return false; } } }); diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index 5812ff2..7440b26 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '3.4.7', + VERSION: '4.0.0', LANGUAGE: 'None', COLLAPSE_INDEX: false, BUILDER: 'html', @@ -8,5 +8,7 @@ var DOCUMENTATION_OPTIONS = { LINK_SUFFIX: '.html', HAS_SOURCE: true, SOURCELINK_SUFFIX: '.txt', - NAVIGATION_WITH_KEYS: false + NAVIGATION_WITH_KEYS: false, + SHOW_SEARCH_SUMMARY: true, + ENABLE_SEARCH_SHORTCUTS: true, }; \ No newline at end of file diff --git a/docs/_static/language_data.js b/docs/_static/language_data.js index 863704b..ebe2f03 100644 --- a/docs/_static/language_data.js +++ b/docs/_static/language_data.js @@ -5,7 +5,7 @@ * This script contains the language-specific data used by searchtools.js, * namely the list of stopwords, stemmer, scorer and splitter. * - * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ diff --git a/docs/_static/pygments.css b/docs/_static/pygments.css index 6b001a7..9e207a0 100644 --- a/docs/_static/pygments.css +++ b/docs/_static/pygments.css @@ -1,7 +1,7 @@ -pre { line-height: 125%; margin: 0; } -td.linenos pre { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } -span.linenos { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } -td.linenos pre.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +pre { line-height: 125%; } +td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight { background: #ffffff; } @@ -17,6 +17,7 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: .highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #999999 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ diff --git a/docs/_static/searchtools.js b/docs/_static/searchtools.js index e09f926..0a44e85 100644 --- a/docs/_static/searchtools.js +++ b/docs/_static/searchtools.js @@ -4,7 +4,7 @@ * * Sphinx JavaScript utilities for the full-text search. * - * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -172,10 +172,6 @@ var Search = { } // stem the word var word = stemmer.stemWord(tmp[i].toLowerCase()); - // prevent stemmer from cutting word smaller than two chars - if(word.length < 3 && tmp[i].length >= 3) { - word = tmp[i]; - } var toAppend; // select the correct list if (word[0] == '-') { @@ -276,13 +272,16 @@ var Search = { setTimeout(function() { displayNextItem(); }, 5); - } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) { + } else if (DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY) { $.ajax({url: requestUrl, dataType: "text", complete: function(jqxhr, textstatus) { var data = jqxhr.responseText; if (data !== '' && data !== undefined) { - listItem.append(Search.makeSearchSummary(data, searchterms, hlterms)); + var summary = Search.makeSearchSummary(data, searchterms, hlterms); + if (summary) { + listItem.append(summary); + } } Search.output.append(listItem); setTimeout(function() { @@ -290,7 +289,7 @@ var Search = { }, 5); }}); } else { - // no source available, just display title + // just display title Search.output.append(listItem); setTimeout(function() { displayNextItem(); @@ -325,7 +324,9 @@ var Search = { var results = []; for (var prefix in objects) { - for (var name in objects[prefix]) { + for (var iMatch = 0; iMatch != objects[prefix].length; ++iMatch) { + var match = objects[prefix][iMatch]; + var name = match[4]; var fullname = (prefix ? prefix + '.' : '') + name; var fullnameLower = fullname.toLowerCase() if (fullnameLower.indexOf(object) > -1) { @@ -339,7 +340,6 @@ var Search = { } else if (parts[parts.length - 1].indexOf(object) > -1) { score += Scorer.objPartialMatch; } - var match = objects[prefix][name]; var objname = objnames[match[1]][2]; var title = titles[match[0]]; // If more than one term searched for, we require other words to be @@ -498,6 +498,9 @@ var Search = { */ makeSearchSummary : function(htmlText, keywords, hlwords) { var text = Search.htmlToText(htmlText); + if (text == "") { + return null; + } var textLower = text.toLowerCase(); var start = 0; $.each(keywords, function() { diff --git a/docs/authors.html b/docs/authors.html index dd8af66..f3566a2 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -3,8 +3,9 @@ - - Authors — injectable 3.4.7 documentation + + + Authors — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -46,14 +47,15 @@

    Navigation

    -
    +

    Authors

    -
    +
    @@ -117,8 +119,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/caveats.html b/docs/caveats.html index 6512cd3..df83f25 100644 --- a/docs/caveats.html +++ b/docs/caveats.html @@ -3,8 +3,9 @@ - - Caveats — injectable 3.4.7 documentation + + + Caveats — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -46,10 +47,10 @@

    Navigation

    -
    +

    Caveats

    This is a non-exhaustive list of known caveats to the usage of this library.

    -
    +

    Automatic dependency discovery

    Injectable automatic dependency discovery system is inspired from Airflow’s DAG automatic discovery. So first all files in the search path are recursively read looking for any @@ -69,8 +70,8 @@

    Automatic dependency discoveryisinstance builtin functions. If one must type check using the type’s __qualname__ attribute is a possible workaround.

    -

    -
    +
    +

    Pytest and relative imports

    As described in this issue: https://github.com/pytest-dev/pytest/issues/9007 , pytest won’t work with injectable’s automatic dependency discovery system if one declares @@ -79,8 +80,8 @@

    Pytest and relative importsAttributeError: 'AssertionRewritingHook' object has no attribute 'get_code'.

    Currently the workaround for this is either to use absolute imports in these files or to move the declaration of injectables to any other file other than the test’s file.

    -

    -
    + +
    @@ -148,8 +149,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/changelog.html b/docs/changelog.html index 3e9c443..acce0cb 100644 --- a/docs/changelog.html +++ b/docs/changelog.html @@ -3,8 +3,9 @@ - - Changelog — injectable 3.4.7 documentation + + + Changelog — injectable 4.0.0 documentation @@ -29,7 +30,7 @@

    Navigation

    @@ -45,56 +46,60 @@

    Navigation

    -
    +

    Changelog

    -
    -

    3.4.7 (2021-08-15)

    +
    +

    4.0.0 (2024-07-04)

    +
      +
    • Drop support for Python version 3.6 and 3.7

    • +
    • Comply with PEP-593 and support typing.Annotated

    • +
    +
    +
    +

    3.4.7 (2021-08-15)

    • Fix injectable crashing when relative imports are used in files containing injectables.

    -
    -
    -

    3.4.6 (2021-03-20)

    +
    +
    +

    3.4.6 (2021-03-20)

      -
    • -
      Fix testing.register_injectables not creating the namespace when it doesn’t exist

      yet

      -
      -
      -
    • +
    • Fix testing.register_injectables not creating the namespace when it doesn’t exist +yet

    -
    -
    -

    3.4.5 (2021-03-11)

    + +
    +

    3.4.5 (2021-03-11)

    • Fix opening of UTF-8 files & allow for user set encoding

    -
    -
    -

    3.4.4 (2020-07-29)

    + +
    +

    3.4.4 (2020-07-29)

    • Fix inject return type hint

    -
    -
    -

    3.4.3 (2020-06-24)

    + +
    +

    3.4.3 (2020-06-24)

    • Fix Injectable failing to resolve complex/entangled imports

    -
    -
    -

    3.4.2 (2020-05-22)

    + +
    +

    3.4.2 (2020-05-22)

    • Fix optional injection bug when the namespace is empty

    -
    -
    -

    3.4.1 (2020-05-11)

    + +
    +

    3.4.1 (2020-05-11)

    • Fix the use of named args by the caller breaking autowired functions injection

    -
    -
    -

    3.4.0 (2020-05-09)

    + +
    +

    3.4.0 (2020-05-09)

    -
    -
    -

    3.3.0 (2020-04-20)

    + +
    +

    3.3.0 (2020-04-20)

    • Include the injectable.testing utilities to ease mocking injectables.

    -
    -
    -

    3.2.1 (2020-04-19)

    + +
    +

    3.2.1 (2020-04-19)

      -
    • -
      InjectionContainer::load is more resilient against duplicated injectables

      registering

      -
      -
      -
    • +
    • InjectionContainer::load is more resilient against duplicated injectables +registering

    -
    -
    -

    3.2.0 (2020-04-15)

    + +
    +

    3.2.0 (2020-04-15)

    • Support for optional injection in declarative fashion: Autowired(Optional[...])

    -
    -
    -

    3.1.4 (2020-04-15)

    + +
    +

    3.1.4 (2020-04-15)

    • Fix Autowired(List[...]) not working with qualifiers

    -
    -
    -

    3.1.3 (2020-04-15)

    + +
    +

    3.1.3 (2020-04-15)

    • Fix Windows injectables not being loaded.

    -
    -
    -

    3.1.2 (2020-04-14)

    + +
    +

    3.1.2 (2020-04-14)

    • Remove unused inspect imports.

    -
    -
    -

    3.1.1 (2020-04-13)

    + +
    +

    3.1.1 (2020-04-13)

      -
    • -
      Fix bug of scanning the same module more than once when InjectionContainer.load()

      is called multiple times with different relative search paths.

      -
      -
      -
    • +
    • Fix bug of scanning the same module more than once when InjectionContainer.load() +is called multiple times with different relative search paths.

    -
    -
    -

    3.1.0 (2020-04-13)

    + +
    +

    3.1.0 (2020-04-13)

    • Added @injectable_factory decorator for declaring injectable factory methods

    • Include the console output in the examples

    -
    -
    -

    3.0.1 (2020-04-13)

    + +
    +

    3.0.1 (2020-04-13)

    • Fix package content missing

    -
    -
    -

    3.0.0 (2020-04-12)

    + +
    +

    3.0.0 (2020-04-12)

    • Drop support for autowiring without previous initialization of the InjectionContainer

    • Refactor @autowired decorator for working with the Autowired type annotation

    • @@ -183,79 +182,70 @@

      3.0.0 (2020-04-12) -

      2.0.0 (2018-02-24)

      +

    +
    +

    2.0.0 (2018-02-24)

    • Drop Python 3.3 official support

    -
    -
    -

    1.1.2 (2018-02-24)

    + +
    +

    1.1.2 (2018-02-24)

    • Support for dependencies of classes without signature

    • Fix bug of builtin types not being accepted for injectable dependencies

    -
    -
    -

    1.1.1 (2018-02-23)

    + +
    +

    1.1.1 (2018-02-23)

      -
    • -
      Statically infer dependency’s constructor suitability for injection instead of using

      trial instantiation

      -
      -
      -
    • -
    • -
      Fix bug of raising TypeError when injectable fails on the trial dependency

      instantiation which can happen when the dependency does provide a default +

    • Statically infer dependency’s constructor suitability for injection instead of using +trial instantiation

    • +
    • Fix bug of raising TypeError when injectable fails on the trial dependency +instantiation which can happen when the dependency does provide a default constructor with no arguments but the running environment (possibly a test suite -environment) will make the instantiation fail

      -
    • -
      -
    • +environment) will make the instantiation fail

    -
    -
    -

    1.1.0 (2018-02-10)

    + +
    +

    1.1.0 (2018-02-10)

    • Enable the use of @autowired decorator without parenthesis

    -
    -
    -

    1.0.1 (2018-02-10)

    + +
    +

    1.0.1 (2018-02-10)

      -
    • -
      Fixes required dependency lazy_object_proxy not being installed when installing

      injectable through pip

      -
      -
      -
    • +
    • Fixes required dependency lazy_object_proxy not being installed when installing +injectable through pip

    -
    -
    -

    1.0.0 (2018-02-06)

    + +
    +

    1.0.0 (2018-02-06)

    • First stable release

    -
    -
    -

    0.2.0 (2018-02-06)

    + +
    +

    0.2.0 (2018-02-06)

    • Support for lazy dependency initialization

    • Support for type annotations with strings

    -
    -
    -

    0.1.1 (2018-02-05)

    + +
    +

    0.1.1 (2018-02-05)

    • Python 3.3 and 3.4 support

    -
    -
    -

    0.1.0 (2018-02-05)

    + +
    +

    0.1.0 (2018-02-05)

    • First beta release

    -
    -
    + +
    @@ -286,33 +276,34 @@

    Quick search

  • Contributing
  • Authors
  • Changelog
  • @@ -345,8 +336,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 3b8153e..6468d68 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -27,7 +27,7 @@ year = "2018" author = "Rodrigo Martins de Oliveira" copyright = "{0}, {1}".format(year, author) -version = release = "3.4.7" +version = release = "4.0.0" pygments_style = "trac" templates_path = ["."] diff --git a/docs/contributing.html b/docs/contributing.html index c8031f3..dc61f9b 100644 --- a/docs/contributing.html +++ b/docs/contributing.html @@ -3,8 +3,9 @@ - - Contributing — injectable 3.4.7 documentation + + + Contributing — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -46,7 +47,7 @@

    Navigation

    -
    +

    Contributing

    Contributions of any kind are welcome in any form.

    If you want to submit a code contribution you may do so by forking the project and then @@ -62,7 +63,7 @@

    Contributing

    @@ -126,8 +127,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 56985ff..5d2852f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,8 +3,9 @@ - - Contents — injectable 3.4.7 documentation + + + Contents — injectable 4.0.0 documentation @@ -29,7 +30,7 @@

    Navigation

    @@ -45,7 +46,7 @@

    Navigation

    - + +
    @@ -186,8 +188,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/installation.html b/docs/installation.html index 5adf959..010b731 100644 --- a/docs/installation.html +++ b/docs/installation.html @@ -3,8 +3,9 @@ - - Installation — injectable 3.4.7 documentation + + + Installation — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -46,13 +47,13 @@

    Navigation

    -
    +

    Installation

    At the command line:

    pip install injectable
     
    -
    +
    @@ -116,8 +117,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/objects.inv b/docs/objects.inv index 0ffc4129b22edbfecb9f135dc103dd43aa2879a0..a846a864e9d847e788cbff3dbe1651fb02ae367a 100644 GIT binary patch delta 16 XcmbQrJ(YWc9jl3+fu6xe=O9)9CnN+< delta 16 XcmbQrJ(YWc9jmdPiJtjJ=O9)9Ct3tq diff --git a/docs/py-modindex.html b/docs/py-modindex.html index 7159001..c4cf826 100644 --- a/docs/py-modindex.html +++ b/docs/py-modindex.html @@ -4,7 +4,7 @@ - Python Module Index — injectable 3.4.7 documentation + Python Module Index — injectable 4.0.0 documentation @@ -31,7 +31,7 @@

    Navigation

    @@ -210,8 +210,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/readme.html b/docs/readme.html index 2f0acbc..2f02fe4 100644 --- a/docs/readme.html +++ b/docs/readme.html @@ -3,8 +3,9 @@ - - Injectable: Dependency Injection for Humans™ — injectable 3.4.7 documentation + + + Injectable: Dependency Injection for Humans™ — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -46,7 +47,7 @@

    Navigation

    -
    +

    Injectable: Dependency Injection for Humans™

    Usage Examples 🚩 | Developer Reference 👩‍💻 | Authors 👫

    @@ -129,7 +130,7 @@

    Navigation

    - -
    + +
    @@ -220,8 +221,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/reference/index.html b/docs/reference/index.html index fa08ae9..dd8cd30 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -3,8 +3,9 @@ - - Reference — injectable 3.4.7 documentation + + + Reference — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -46,7 +47,7 @@

    Navigation

    -
    +

    Reference

    -
    +
    @@ -126,8 +127,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/reference/injectable.html b/docs/reference/injectable.html index 2048907..ff94e8c 100644 --- a/docs/reference/injectable.html +++ b/docs/reference/injectable.html @@ -3,8 +3,9 @@ - - injectable — injectable 3.4.7 documentation + + + injectable — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    injectable

    This is the injectable’s public API.

    @@ -57,7 +58,7 @@

    injectable
    -class injectable.Autowired(dependency: Union[T, str], *, namespace: Optional[str] = None, group: Optional[str] = None, exclude_groups: Optional[Sequence[str]] = None, lazy: bool = False)[source]
    +class injectable.Autowired(dependency: Union[injectable.autowiring.autowired_type.T, str], *, namespace: str = None, group: str = None, exclude_groups: Sequence[str] = None, lazy: bool = False)[source]

    Autowired type annotation marks a parameter to be autowired for injection.

    Autowired parameters must be last in declaration if there are others which aren’t autowired. Also, autowired parameters must not be given default values.

    @@ -87,7 +88,7 @@

    injectable
    >>> from injectable import Autowired, autowired
    ->>>
    +>>>
     >>> @autowired
     ... def foo(arg: Autowired("qualifier")):
     ...     ...
    @@ -97,7 +98,7 @@ 

    injectable
    -class injectable.Injectable(constructor: callable, unique_id: str = <factory>, primary: bool = False, group: Optional[str] = None, singleton: bool = False)[source]
    +class injectable.Injectable(constructor: callable, unique_id: str = <factory>, primary: bool = False, group: typing.Optional[str] = None, singleton: bool = False)[source]

    Injectable is the low-level container class in which information regarding an injectable dependency is stored for registering in a namespace.

    This class is not meant for direct usage. It should be used in conjunction with @@ -121,7 +122,7 @@

    injectable
    -class injectable.InjectionContainer[source]
    +class injectable.InjectionContainer[source]

    InjectionContainer globally manages injection namespaces and the respective injectables registries.

    This class shouldn’t be used directly and will be removed from the injectable’s @@ -137,7 +138,7 @@

    injectable
    -classmethod load(search_path: Optional[str] = None, *, default_namespace: str = 'DEFAULT_NAMESPACE')[source]
    +classmethod load(search_path: str = None, *, default_namespace: str = 'DEFAULT_NAMESPACE')[source]

    Loads injectables under the search path to the InjectionContainer under the designated namespaces.

    @@ -175,7 +176,7 @@

    injectable
    -injectable.autowired(func: T) T[source]
    +injectable.autowired(func: injectable.autowiring.autowired_decorator.T) injectable.autowiring.autowired_decorator.T[source]

    Function decorator to setup dependency injection autowiring.

    Only parameters annotated with Autowired will be autowired for injection.

    @@ -197,7 +198,7 @@

    injectable
    >>> from injectable import Autowired, autowired
    ->>>
    +>>>
     >>> @autowired
     ... def foo(dep: Autowired(...)):
     ...     ...
    @@ -207,7 +208,7 @@ 

    injectable
    -injectable.inject(dependency: Union[Type[T], str], *, namespace: Optional[str] = None, group: Optional[str] = None, exclude_groups: Optional[Sequence[str]] = None, lazy: bool = False, optional: bool = False) T[source]
    +injectable.inject(dependency: Union[Type[injectable.injection.inject.T], str], *, namespace: str = None, group: str = None, exclude_groups: Sequence[str] = None, lazy: bool = False, optional: bool = False) injectable.injection.inject.T[source]

    Injects the requested dependency by instantiating a new instance of it or a singleton instance if specified by the injectable. Returns an instance of the requested dependency.

    @@ -252,7 +253,7 @@

    injectable
    >>> from foo import Foo
     >>> from injectable import inject
    ->>>
    +>>>
     >>> class Bar:
     ...     def __init__(self, foo: Foo = None):
     ...         self.foo = foo or inject(Foo)
    @@ -262,7 +263,7 @@ 

    injectable
    -injectable.inject_multiple(dependency: Union[Type[T], str], *, namespace: Optional[str] = None, group: Optional[str] = None, exclude_groups: Optional[Sequence[str]] = None, lazy: bool = False, optional: bool = False) List[T][source]
    +injectable.inject_multiple(dependency: Union[Type[injectable.injection.inject.T], str], *, namespace: str = None, group: str = None, exclude_groups: Sequence[str] = None, lazy: bool = False, optional: bool = False) List[injectable.injection.inject.T][source]

    Injects all injectables that resolves to the specified dependency. Returns a list of instances matching the requested dependency.

    One can use this method directly for injecting dependencies though this is not @@ -302,7 +303,7 @@

    injectable
    >>> from com import AbstractService
     >>> from injectable import inject_multiple
     >>> from typing import Sequence
    ->>>
    +>>>
     >>> class Foo:
     ...     def __init__(self, services: Sequence[AbstractService] = None):
     ...         self.services = services or inject_multiple(AbstractService)
    @@ -312,7 +313,7 @@ 

    injectable
    -injectable.injectable(cls: Optional[T] = None, *, qualifier: Optional[str] = None, primary: bool = False, namespace: Optional[str] = None, group: Optional[str] = None, singleton: bool = False) T[source]
    +injectable.injectable(cls: injectable.injection.injectable_decorator.T = None, *, qualifier: str = None, primary: bool = False, namespace: str = None, group: str = None, singleton: bool = False) injectable.injection.injectable_decorator.T[source]

    Class decorator to mark it as an injectable dependency.

    This decorator accepts customization parameters but can be invoked without the parenthesis when no parameter will be specified.

    @@ -341,7 +342,7 @@

    injectable
    >>> from injectable import injectable
    ->>>
    +>>>
     >>> @injectable
     ... class Foo:
     ...     ...
    @@ -351,7 +352,7 @@ 

    injectable
    -injectable.injectable_factory(dependency: Optional[T] = None, *, qualifier: Optional[str] = None, primary: bool = False, namespace: Optional[str] = None, group: Optional[str] = None, singleton: bool = False) Callable[..., Callable[..., T]][source]
    +injectable.injectable_factory(dependency: injectable.injection.injectable_factory_decorator.T = None, *, qualifier: str = None, primary: bool = False, namespace: str = None, group: str = None, singleton: bool = False) Callable[[...], Callable[[...], injectable.injection.injectable_factory_decorator.T]][source]

    Function decorator to mark it as a injectable factory for the dependency.

    At least one of dependency or qualifier parameters need to be defined. An InjectableLoadError will be raised @@ -388,7 +389,7 @@

    injectable
    >>> from injectable import injectable_factory
     >>> from foo import Foo
    ->>>
    +>>>
     >>> @injectable_factory(Foo)
     ... def foo_factory() -> Foo:
     ...     return Foo(...)
    @@ -398,7 +399,7 @@ 

    injectable
    -injectable.load_injection_container(search_path: Optional[str] = None, *, default_namespace: str = 'DEFAULT_NAMESPACE', encoding: str = 'utf-8')[source]
    +injectable.load_injection_container(search_path: str = None, *, default_namespace: str = 'DEFAULT_NAMESPACE', encoding: str = 'utf-8')[source]

    Loads injectables under the search path to a shared injection container under the designated namespaces.

    @@ -433,7 +434,7 @@

    injectable

    @@ -503,8 +504,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/reference/injectable_constants.html b/docs/reference/injectable_constants.html index 2131851..93e2184 100644 --- a/docs/reference/injectable_constants.html +++ b/docs/reference/injectable_constants.html @@ -3,8 +3,9 @@ - - injectable.constants — injectable 3.4.7 documentation + + + injectable.constants — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,15 +48,15 @@

    Navigation

    -
    +

    injectable.constants

    -injectable.constants.DEFAULT_NAMESPACE = 'DEFAULT_NAMESPACE'
    +injectable.constants.DEFAULT_NAMESPACE = 'DEFAULT_NAMESPACE'

    Default namespace used for registering and searching injectables

    -
    +

    @@ -125,8 +126,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/reference/injectable_errors.html b/docs/reference/injectable_errors.html index e08fa25..fd6ddc3 100644 --- a/docs/reference/injectable_errors.html +++ b/docs/reference/injectable_errors.html @@ -3,8 +3,9 @@ - - injectable.errors — injectable 3.4.7 documentation + + + injectable.errors — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,22 +48,22 @@

    Navigation

    -
    +

    injectable.errors

    Custom exceptions raised by injectable.

    -exception injectable.errors.AutowiringError[source]
    +exception injectable.errors.AutowiringError[source]

    Error indicating autowiring of a function failed.

    -exception injectable.errors.InjectionError[source]
    +exception injectable.errors.InjectionError[source]

    Error indicating dependency injection failed.

    -
    +
    @@ -132,8 +133,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/reference/injectable_testing.html b/docs/reference/injectable_testing.html index 5e507fa..4e6ea3d 100644 --- a/docs/reference/injectable_testing.html +++ b/docs/reference/injectable_testing.html @@ -3,8 +3,9 @@ - - injectable.testing — injectable 3.4.7 documentation + + + injectable.testing — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    injectable.testing

    Testing utilities to ease mocking injectables.

    @@ -68,7 +69,7 @@

    injectable.testing
    -injectable.testing.clear_injectables(dependency: Union[type, str], namespace: Optional[str] = None) Set[injectable.container.injectable.Injectable][source]
    +injectable.testing.clear_injectables(dependency: Union[type, str], namespace: str = None) Set[injectable.container.injectable.Injectable][source]

    Utility function to clear all injectables registered for the dependency in a given namespace. Returns a set containing all cleared injectables.

    @@ -92,7 +93,7 @@

    injectable.testing
    -injectable.testing.register_injectables(injectables: Collection[injectable.container.injectable.Injectable], klass: Optional[type] = None, qualifier: Optional[str] = None, namespace: str = 'DEFAULT_NAMESPACE', propagate: bool = False)[source]
    +injectable.testing.register_injectables(injectables: Collection[injectable.container.injectable.Injectable], klass: Optional[type] = None, qualifier: Optional[str] = None, namespace: str = 'DEFAULT_NAMESPACE', propagate: bool = False)[source]

    Utility function to manually register injectables in a given namespace for the provided class and/or qualifier.

    At least one of klass or qualifier parameters need to be defined. Otherwise @@ -144,7 +145,7 @@

    injectable.testing

    @@ -214,8 +215,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/searchindex.js b/docs/searchindex.js index 83de44c..ff82139 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["authors","caveats","changelog","contributing","index","installation","readme","reference/index","reference/injectable","reference/injectable_constants","reference/injectable_errors","reference/injectable_testing","usage/TLDR","usage/basic_usage","usage/cyclic_dependency","usage/dependencies_precedence","usage/factory","usage/index","usage/injectable_mocking_for_tests","usage/injecting_existing_instance","usage/injection_container_resetting_for_tests","usage/lazy_injection","usage/namespaces","usage/optional_injection","usage/qualifier_overloading","usage/service_locator","usage/singletons"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":4,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.intersphinx":1,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["authors.rst","caveats.rst","changelog.rst","contributing.rst","index.rst","installation.rst","readme.rst","reference/index.rst","reference/injectable.rst","reference/injectable_constants.rst","reference/injectable_errors.rst","reference/injectable_testing.rst","usage/TLDR.rst","usage/basic_usage.rst","usage/cyclic_dependency.rst","usage/dependencies_precedence.rst","usage/factory.rst","usage/index.rst","usage/injectable_mocking_for_tests.rst","usage/injecting_existing_instance.rst","usage/injection_container_resetting_for_tests.rst","usage/lazy_injection.rst","usage/namespaces.rst","usage/optional_injection.rst","usage/qualifier_overloading.rst","usage/service_locator.rst","usage/singletons.rst"],objects:{"":{injectable:[8,0,0,"-"]},"examples.basic_usage":{basic_usage_example:[13,0,0,"-"]},"examples.cyclic_dependency":{cyclic_dependency_example:[14,0,0,"-"]},"examples.dependencies_precedence":{dependencies_precedence_example:[15,0,0,"-"]},"examples.factory":{factory_example:[16,0,0,"-"]},"examples.injectable_mocking_for_tests":{injectable_mocking_example:[18,0,0,"-"]},"examples.injecting_existing_instance":{injecting_existing_instance_example:[19,0,0,"-"]},"examples.injection_container_resetting_for_tests":{injection_container_resetting_example:[20,0,0,"-"]},"examples.lazy_injection":{lazy_injection_example:[21,0,0,"-"]},"examples.namespaces":{namespaces_example:[22,0,0,"-"]},"examples.optional_injection":{optional_injection_example:[23,0,0,"-"]},"examples.qualifier_overloading":{qualifier_overloading_example:[24,0,0,"-"]},"examples.service_locator":{service_locator_example:[25,0,0,"-"]},"examples.singletons":{singleton_example:[26,0,0,"-"]},"examples.tldr":{tldr_example:[12,0,0,"-"]},"injectable.InjectionContainer":{load:[8,2,1,""]},"injectable.constants":{DEFAULT_NAMESPACE:[9,4,1,""]},"injectable.errors":{AutowiringError:[10,5,1,""],InjectionError:[10,5,1,""]},"injectable.testing":{clear_injectables:[11,3,1,""],register_injectables:[11,3,1,""],reset_injection_container:[11,3,1,""]},injectable:{Autowired:[8,1,1,""],Injectable:[8,1,1,""],InjectionContainer:[8,1,1,""],autowired:[8,3,1,""],constants:[9,0,0,"-"],errors:[10,0,0,"-"],inject:[8,3,1,""],inject_multiple:[8,3,1,""],injectable:[8,3,1,""],injectable_factory:[8,3,1,""],load_injection_container:[8,3,1,""],testing:[11,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","function","Python function"],"4":["py","data","Python data"],"5":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:function","4":"py:data","5":"py:exception"},terms:{"0":[4,8,11,25],"02":4,"03":4,"04":4,"05":4,"06":[4,22],"07":4,"08":4,"09":4,"1":[4,25],"10":4,"11":4,"12":4,"13":4,"14":4,"15":4,"151":22,"19":4,"2":[4,15,25],"20":4,"2018":4,"2020":4,"2021":4,"22":4,"23":4,"24":4,"29":4,"3":[4,8,11],"38":22,"4":[4,8,11,15],"42":[11,19],"5":4,"6":[4,15],"7":4,"8":[2,8,15],"9007":1,"94":22,"abstract":[15,24],"break":2,"case":[1,3,8,16],"class":[1,2,6,8,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26],"default":[2,8,9,11,13,21,22],"do":[1,3,20,21],"final":13,"function":[1,2,6,8,10,11,16,18,19,20],"import":[2,4,6,8,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26],"long":11,"new":[8,11],"public":8,"return":[2,8,11,13,14,16,19,22,25],"static":[2,6],"true":[6,8,11,14,15,21,25,26],"try":20,"while":[3,21,23],A:[14,16,26],As:1,At:[5,8,11],By:22,For:[4,11,12,14,17,19],If:[1,3,8,15],In:[13,14,15,16,18,19,21,22,23,24,25,26],It:8,No:20,One:8,The:[1,8,11,12,13,14,15,16,19,21,22,23,24,25],Then:[1,22],These:6,To:22,Will:8,__init__:[6,8,12,13,14,15,16,18,19,21,22,23,24,25,26],__main__:[12,13,14,15,16,18,19,20,21,22,23,24,25,26],__name__:[12,13,14,15,16,18,19,20,21,22,23,24,25,26],__qualname__:1,_global:2,_state:[13,25],abc:[6,15,24],about:[3,24],absolut:[1,8],abstract_servic:15,abstract_service_1:15,abstract_service_2:15,abstractmethod:[15,24],abstractservic:[8,15],accept:[2,8],access:14,action:8,actual:[6,16,21],ad:2,add:[2,3,8],address:8,advantag:24,after:8,against:2,airflow:1,alias:1,all:[1,6,8,11,13,15,16,20,23,24],all_basic_service_implement:25,allow:2,allrod5:0,alreadi:[8,11,19],also:[8,15,16,19,21,22,24],ambigu:[8,15],among:8,an:[1,3,6,8,12,14,15,16,18,19,20,21,22,23,25,26],analysi:6,ani:[1,3,8,20,22,23],annot:[2,6,8,13,25],anoth:1,another_basic_servic:13,api:[8,25],app:19,appli:8,applic:[1,3,19],ar:[1,2,3,6,8,13,14,15,20,21,22,24],aren:[8,23],arg:[2,8],argument:[2,6,8,22,23],assert_cal:18,assertionrewritinghook:1,assign:[8,19,22],attempt:8,attribut:[1,14,15],attributeerror:1,author:[4,6],auto:3,automat:[4,6,8],autowir:[2,6,8,10,12,13,14,15,16,18,19,20,21,22,23,24,26],autowiringerror:[8,10],b:[14,15],bar:[8,13,20,23],base:[6,8,11,15,24,25],basic:[4,12,17,25],basic_servic:13,basic_usag:13,basic_usage_exampl:13,basicservic:13,basicusag:13,befor:[8,18,20],behav:26,behavior:13,behind:13,being:[1,2,8,20,21,26],beta:2,better:[3,12],between:26,black:3,bool:[8,11],both:[15,21,22,23,26],branch:3,brief:3,broker:6,bug:2,built:6,builtin:[1,2],bunch_of_servic:23,call:[2,6,8,18,20,21],callabl:8,caller:[2,8],can:[1,2,6,8,12,14,16,18,19,20,21,22,26],cannot:[8,16,22],carefulli:6,caus:1,caveat:4,chang:[2,11,26],changelog:4,check:[1,3,6],circular:[14,21],cl:8,clarifi:3,classmethod:8,clear:[3,8,11,20],clear_inject:[11,18],client1:26,client2:26,client:16,client_endpoint:16,client_endpoint_example_env_var:16,client_factori:16,code:[1,2,3,16],collect:[8,11],com:[0,1,8],combin:[1,15],command:5,comment:3,common:16,complet:13,complex:2,compli:6,concret:24,conflict:22,conjunct:8,connect:[16,26],consol:2,constant:[4,7,8,11],constructor:[2,8,11],contain:[1,2,4,8,11,17],content:2,contribut:4,cool:6,corner:1,correct:8,craig:0,craigminihan:0,crash:2,creat:[2,8,24],cryptic:3,current:1,custom:[8,10],cyclic:[4,17,21],cyclic_dependency_exampl:14,cyclicdepend:14,dag:1,databas:6,de:0,deal:[14,16,21],declar:[1,2,6,8,13,15,16,21,22,23,24,25,26],decor:[1,2,6,8,13,16,19,25],def:[6,8,12,13,14,15,16,18,19,20,21,22,23,24,25,26],default_measuring_servic:22,default_namespac:[2,8,9,11],defin:[8,11,26],demonstr:13,dep:[6,8,12,18],depend:[2,4,8,10,11,13,17,18,21,23,24,25,26],dependencies_preced:15,dependencies_precedence_exampl:15,dependenciespreced:15,deprec:[2,8],describ:[1,25],descript:3,design:[6,8],detail:[14,21,22,25],dev:1,develop:6,differ:[2,6,8,15,22],direct:8,directli:[1,8,25],directori:8,discourag:3,discov:[6,8],discoveri:[4,6],do_someth:20,doc:6,docstr:3,document:[2,3],doe:[2,8,21],doesn:2,dr:[4,17],drop:2,due:8,dummi:16,duplic:[2,8],dure:1,e:[8,20,21],each:[1,13,14,15,22],earth_to_sun_dist:22,eas:[2,11],easier:14,effect:1,either:[1,8],eleg:6,email:24,email_sender_servic:24,emailsenderservic:24,empti:[2,8,20,23],enabl:[2,14],encod:[2,8],encourag:3,end:24,endpoint:16,ensur:3,entangl:2,environ:2,error:[4,7,8,15,20],everi:26,exampl:[2,3,4,6,8,11,12],except:[10,20],exclud:8,exclude_group:[8,24],execut:[1,8],exhaust:1,exist:[2,4,16,17],expect:23,explicit:15,explicitli:[8,15],expos:15,extend:6,extern:16,external_cli:16,externalcli:16,f:[15,16,24],factori:[2,4,8,17,19],factory_exampl:16,fail:[1,2,10,15,23],fall:14,fals:[8,11,26],fashion:[2,6],favor:2,fax:24,fax_sender_servic:24,faxsenderservic:24,featur:4,feedback:3,few:6,file:[1,2,8,11,12],filter:[8,24],finish:21,first:[1,2,8,22],fix:2,follow:[1,3],foo:[6,8,11,12,13,20,23],foo_factori:8,fork:3,form:3,format:3,found:[8,23],four:1,framework:[6,12,13,14,22,25],friendli:6,from:[1,2,6,8,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26],func:8,futur:8,g:8,gener:[2,8],get:[15,18,23],get_cod:1,get_pending_messag:6,get_repository_st:[13,25],get_some_property_from_a:14,get_some_property_from_b:14,getenv:16,github:[0,1],given:[8,11],global:8,good:12,grasp:13,group:[2,8,24],guidelin:3,ha:[1,22],happen:[2,24],hard:3,have:[13,14,15,16,19,22],heart:6,hello:24,high:25,hint:[2,6],how:[8,11,13,14,15,16,18,19,20,21,22,23,24,25,26],http:[0,1,16],human:4,i:[8,21],idea:13,identifi:8,illustr:[13,22,25],illustrativeexampl:12,implement:[1,15,24],imposs:[1,8],includ:[2,3,20],inclus:11,incompat:1,independ:[13,22],index:4,indic:[8,10,15],infer:2,inform:8,inherit:25,init:21,initi:[2,6,8,19],inject:[1,2,4,5,7,12,13,14,15,16,17,22,24,25,26],inject_multipl:[2,8,25],injectable_factori:[1,2,8,16,19],injectable_factory_decor:16,injectable_mocking_exampl:18,injectableloaderror:8,injectablemock:18,injecting_existing_inst:19,injecting_existing_instance_exampl:19,injectingexistinginst:19,injection_container_resetting_exampl:20,injectioncontain:[2,8],injectioncontainerreset:20,injectionerror:[8,10,20,23],insid:[8,25],inspect:2,inspir:1,instal:[2,4],instanc:[4,6,8,13,15,16,17,23,24,26],instanti:[2,8,14,16,21,26],instead:[2,8,13,14,15,23],internationalmeasuringservic:22,intl:22,intl_measuring_servic:22,invoc:8,invok:[8,14,21],isinst:1,isn:8,issu:[1,3],its:[14,22,26],itself:[1,3,8],just:[6,15,19,23],kafkaproduc:6,keep:3,kind:3,klass:11,km:22,know:16,known:1,kulej:0,label:24,lambda:[11,16,18,19],last:[8,22],lazi:[2,4,6,8,14,17],lazili:21,lazy_inject:21,lazy_injection_exampl:21,lazy_object_proxi:2,lazyinject:21,lead:1,learn:[14,24],least:[8,11],level:[1,8,25],leverag:21,librari:1,licens:6,like:[6,16],line:5,linter:[3,6],list:[1,2,6,8,23,24],ll:[4,13,14,15,16,19,21,22,23,24,25,26],load:[1,2,8],load_injection_contain:[2,6,8,12,13,14,15,16,18,19,20,21,22,23,24,25,26],locat:[2,4,17],log:8,logic:16,look:[1,8,12],lookup:8,loop:14,love:4,low:[8,25],maco:2,made:[8,20,26],magic:[3,8],mai:[1,3,23],make:[2,3,6,8,13,14,18,20],manag:8,mani:6,manual:11,mark:[2,8],martin:0,master:3,match:[8,20,24],meant:8,measuring_servic:22,messag:[6,24],message_brok:6,method:[2,8,13,14,15,21,23,25],mile:22,million:22,mind:3,minihan:0,minor:2,miss:2,mock:[2,4,11,17],mocked_dep:18,mocked_inject:18,mockeddep:18,model:6,modifi:14,modul:[1,2,4,8],more:[2,8,24],move:1,mt3o:0,multipl:[2,8,24],multipleservic:15,multipli:15,multiply_servic:15,multiplyservic:15,must:[1,8],name:[1,2],namespac:[2,4,6,8,9,11,17,20],namespaces_exampl:22,necessari:[8,16],need:[3,8,11,18,21],never:[1,8,18],nevertheless:3,non:[1,8],none:[8,11,13,22,23,25],now:[15,16,19,21],number:19,object:1,occurr:1,offici:2,often:3,ok:23,old:24,oliveira:0,onc:[2,8,26],one:[1,8,11,13,14,15,18,20,22,23,26],ones:[8,22],onli:[6,8,14,21,22,26],open:[2,3],oper:1,option:[2,4,8,11,17,22],optional_injection_exampl:23,optionalinject:23,organ:3,origin:6,os:16,other:[1,8,12,13,14,22,24,26],otherwis:11,our:[6,13,14,15,16,19,21,22,23,24,25,26],out:[6,8,24],outermost:23,output:2,outsid:[1,8],over:25,overload:[4,6,15,17,23,25],own:22,packag:[2,6],page:4,paramet:[2,6,8,11,21,22,24,26],parenthesi:[2,8],particular:22,pass:[6,8,25],path:[1,2,6,8],pend:6,perform:8,pip:[2,5],place:[8,26],posit:8,possibl:[1,2,14],potenti:1,preced:[4,17,24],prefer:25,present:[8,23],preserv:6,prevent:[8,14],previou:[2,8],previous:8,primari:[8,15,23,25],primary_basic_servic:25,print:[12,13,14,15,16,18,19,20,21,22,23,24,25,26],project:[3,6,8],propag:[11,24],properti:[13,14,25],provid:[2,11],pull:3,purpos:[8,11],py:[12,13,14,15,16,18,19,20,21,22,23,24,25,26],pycharm:6,pytest:4,python:[1,2,8,12],qualifi:[2,4,6,8,11,14,15,17,22,23,25],qualifier_overload:24,qualifier_overloading_exampl:24,qualifieroverload:24,quirk:2,rais:[2,8,10,11,15],re:24,read:[1,8],readabl:3,readi:6,realdep:18,reason:[1,8,16,19],receiv:[3,8,23],recipi:24,recommend:8,record:11,recurs:[1,11],refactor:2,refer:[4,6,14,21],reflect:26,regard:[8,24],regardless:8,regist:[1,2,8,9,11,14,18,20,22],register_inject:[2,11,18],registri:[8,22],regular:[1,19],rel:[2,4,8],releas:2,remov:[2,8],render:1,repositori:[3,13,25],repres:16,request:[3,8],requir:2,reset:[4,11,17],reset_injection_contain:[2,11,20],resili:2,resolut:[8,24],resolv:[2,8,15,22,23,24],respect:[8,22],respons:16,review:3,right:21,rodrigo:0,root:[6,20],run:[1,2,3,12,13,14,15,16,18,19,20,21,22,23,24,25,26],run_exampl:[12,13,14,15,16,18,19,20,21,22,23,24,25,26],s:[1,2,3,6,8,13,25],same:[1,2,6,8,21,24,26],sample_servic:25,sampleservic:25,satisfi:23,scan:[2,8,11],search:[1,2,4,8,9],search_path:8,section:[8,11,12],see:[15,16,19,21,22,23,25,26],self:[6,8,12,13,14,15,16,18,19,20,21,22,23,24,25,26],send:24,send_messag:24,send_pend:6,sender_servic:24,senderservic:24,sequenc:8,servic:[2,4,6,8,13,14,17,24],service_a:[14,21],service_b:[14,21],service_loc:25,service_locator_exampl:25,servicea:[14,21],serviceb:[14,21],serviceloc:25,set:[2,11,13],set_repository_st:[13,25],setter:[13,25],setup:8,shall:[8,23],share:[6,8,13,26],should:8,shouldn:8,show:[11,13,15,16,19,23,24],side:1,side_effect:18,signatur:2,simpl:6,simpler:16,simpli:23,sinc:[8,15,18],singl:[6,12,22,24],singleton:[4,6,8,13,17],singleton_cli:26,singleton_exampl:26,singletoncli:26,situat:23,sm:24,sms_sender_servic:24,smssenderservic:24,so:[1,3,16,19,23],some:[1,14,16,23],some_properti:14,some_servic:23,someth:[20,21],sourc:[8,10,11],speak:3,specialized_servic:25,specializedservic:25,specif:8,specifi:[6,8,11,15,21,22],sqsproduc:6,stabl:2,start:[12,21],state:[11,13,20,25,26],stateful_repositori:[13,25],statefulrepositori:[13,25],statefulservic:13,staticmethod:18,step:1,still:8,store:8,str:[8,11,16,24],straightforward:12,string:[1,2,8,14],style:3,submit:3,success:8,successfulli:22,suit:2,suitabl:2,sum:15,sum_servic:15,sumservic:15,suppli:19,support:2,sure:[8,20],system:1,t:[1,2,8,11,15,18,23],take:24,teodor:0,test:[1,2,3,4,6,7,8,17],than:[1,2,3,8],thei:[13,21,26],them:[6,14,22],themselv:8,therefor:22,thi:[1,3,8,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26],thoroughli:3,those:1,though:[8,15,18,23],three:[22,24],through:[1,2,16],time:[2,8,21],tl:[4,17],tldr_exampl:12,ton:2,trail:8,transpar:6,trial:2,tricki:3,turn:[13,19,25,26],twice:1,two:[13,22,24,26],type:[1,2,6,8,11,13,22,23,24],typeerror:2,ubuntu:2,unabl:8,under:8,understand:12,unintend:1,union:[8,11],uniqu:8,unique_id:8,unit:[2,3],unitedstatesmeasuringservic:22,unittest:18,unless:11,unus:2,up:24,us:[1,2,3,6,8,9,11,13,14,15,16,18,19,20,22,23,24,25,26],us_measuring_servic:22,usag:[1,2,4,6,8,11,12,25],user:2,utf:[2,8],util:[2,8,11,18,20],uuid:8,valid:8,valu:[8,13,23,25],valueerror:11,variabl:19,varieti:8,version:[8,11],wa:[8,15,18,26],wai:[3,21],want:[3,23],warn:[8,20],wasn:[8,15],we:[13,14,15,16,18,19,21,22,23,24,25,26],welcom:3,well:[3,15],were:[22,24],what:[3,22,23],whatev:19,when:[2,6,8,11,14,15,21,23,24,26],whenev:26,where:8,which:[2,8,11,13,14,15,16,19,21,23,25,26],window:2,wire:8,without:[2,8,16,22],won:[1,11,23],work:[1,2,14,21,22,23,24,25],workaround:1,world:24,would:15,wouldn:18,wrap:[8,16,18],write:3,wrote:3,yet:2,you:[3,4,12,13,14,15,16,19,21,22,23,24,25,26],your:[3,6,16]},titles:["Authors","Caveats","Changelog","Contributing","Contents","Installation","Injectable: Dependency Injection for Humans\u2122","Reference","injectable","injectable.constants","injectable.errors","injectable.testing","TL;DR","Basic Usage Example","Cyclic Dependency Example","Dependencies Precedence Example","Factory Example","Usage Examples","Injectable Mocking For Tests Example","Injecting Existing Instance Example","Injection Container Resetting For Tests Example","Lazy Injection Example","Namespaces Example","Optional Injection Example","Qualifier Overloading Example","Service Locator Example","Singletons Example"],titleterms:{"0":2,"02":2,"03":2,"04":2,"05":2,"06":2,"07":2,"08":2,"09":2,"1":2,"10":2,"11":2,"12":2,"13":2,"14":2,"15":2,"19":2,"2":2,"20":2,"2018":2,"2020":2,"2021":2,"22":2,"23":2,"24":2,"29":2,"3":2,"4":2,"5":2,"6":2,"7":2,"import":1,For:[18,20],author:0,automat:1,basic:13,caveat:1,changelog:2,constant:9,contain:20,content:4,contribut:3,cyclic:14,depend:[1,6,14,15],discoveri:1,dr:12,error:10,exampl:[13,14,15,16,17,18,19,20,21,22,23,24,25,26],exist:19,factori:16,featur:6,human:6,indic:4,inject:[6,8,9,10,11,18,19,20,21,23],instal:5,instanc:19,lazi:21,ll:6,locat:25,love:6,mock:18,namespac:22,option:23,overload:24,preced:15,pytest:1,qualifi:24,refer:7,rel:1,reset:20,servic:25,singleton:26,tabl:4,test:[11,18,20],tl:12,usag:[13,17],you:6}}) \ No newline at end of file +Search.setIndex({docnames:["authors","caveats","changelog","contributing","index","installation","readme","reference/index","reference/injectable","reference/injectable_constants","reference/injectable_errors","reference/injectable_testing","usage/TLDR","usage/basic_usage","usage/cyclic_dependency","usage/dependencies_precedence","usage/factory","usage/index","usage/injectable_mocking_for_tests","usage/injecting_existing_instance","usage/injection_container_resetting_for_tests","usage/lazy_injection","usage/namespaces","usage/optional_injection","usage/qualifier_overloading","usage/service_locator","usage/singletons"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":5,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.intersphinx":1,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["authors.rst","caveats.rst","changelog.rst","contributing.rst","index.rst","installation.rst","readme.rst","reference/index.rst","reference/injectable.rst","reference/injectable_constants.rst","reference/injectable_errors.rst","reference/injectable_testing.rst","usage/TLDR.rst","usage/basic_usage.rst","usage/cyclic_dependency.rst","usage/dependencies_precedence.rst","usage/factory.rst","usage/index.rst","usage/injectable_mocking_for_tests.rst","usage/injecting_existing_instance.rst","usage/injection_container_resetting_for_tests.rst","usage/lazy_injection.rst","usage/namespaces.rst","usage/optional_injection.rst","usage/qualifier_overloading.rst","usage/service_locator.rst","usage/singletons.rst"],objects:{"":[[8,0,0,"-","injectable"]],"examples.basic_usage":[[13,0,0,"-","basic_usage_example"]],"examples.cyclic_dependency":[[14,0,0,"-","cyclic_dependency_example"]],"examples.dependencies_precedence":[[15,0,0,"-","dependencies_precedence_example"]],"examples.factory":[[16,0,0,"-","factory_example"]],"examples.injectable_mocking_for_tests":[[18,0,0,"-","injectable_mocking_example"]],"examples.injecting_existing_instance":[[19,0,0,"-","injecting_existing_instance_example"]],"examples.injection_container_resetting_for_tests":[[20,0,0,"-","injection_container_resetting_example"]],"examples.lazy_injection":[[21,0,0,"-","lazy_injection_example"]],"examples.namespaces":[[22,0,0,"-","namespaces_example"]],"examples.optional_injection":[[23,0,0,"-","optional_injection_example"]],"examples.qualifier_overloading":[[24,0,0,"-","qualifier_overloading_example"]],"examples.service_locator":[[25,0,0,"-","service_locator_example"]],"examples.singletons":[[26,0,0,"-","singleton_example"]],"examples.tldr":[[12,0,0,"-","tldr_example"]],"injectable.InjectionContainer":[[8,2,1,"","load"]],"injectable.constants":[[9,4,1,"","DEFAULT_NAMESPACE"]],"injectable.errors":[[10,5,1,"","AutowiringError"],[10,5,1,"","InjectionError"]],"injectable.testing":[[11,3,1,"","clear_injectables"],[11,3,1,"","register_injectables"],[11,3,1,"","reset_injection_container"]],injectable:[[8,1,1,"","Autowired"],[8,1,1,"","Injectable"],[8,1,1,"","InjectionContainer"],[8,3,1,"","autowired"],[9,0,0,"-","constants"],[10,0,0,"-","errors"],[8,3,1,"","inject"],[8,3,1,"","inject_multiple"],[8,3,1,"","injectable"],[8,3,1,"","injectable_factory"],[8,3,1,"","load_injection_container"],[11,0,0,"-","testing"]]},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","function","Python function"],"4":["py","data","Python data"],"5":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:function","4":"py:data","5":"py:exception"},terms:{"0":[4,8,11,25],"02":4,"03":4,"04":4,"05":4,"06":[4,22],"07":4,"08":4,"09":4,"1":[4,25],"10":4,"11":4,"12":4,"13":4,"14":4,"15":4,"151":22,"19":4,"2":[4,15,25],"20":4,"2018":4,"2020":4,"2021":4,"2024":4,"22":4,"23":4,"24":4,"29":4,"3":[4,8,11],"38":22,"4":[4,8,11,15],"42":[11,19],"5":4,"593":2,"6":[4,15],"7":4,"8":[2,8,15],"9007":1,"94":22,"abstract":[15,24],"break":2,"case":[1,3,8,16],"class":[1,2,6,8,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26],"default":[2,8,9,11,13,21,22],"do":[1,3,20,21],"final":13,"function":[1,2,6,8,10,11,16,18,19,20],"import":[2,4,6,8,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26],"long":11,"new":[8,11],"public":8,"return":[2,8,11,13,14,16,19,22,25],"static":[2,6],"true":[6,8,11,14,15,21,25,26],"try":20,"while":[3,21,23],A:[14,16,26],As:1,At:[5,8,11],By:22,For:[4,11,12,14,17,19],If:[1,3,8,15],In:[13,14,15,16,18,19,21,22,23,24,25,26],It:8,No:20,One:8,The:[1,8,11,12,13,14,15,16,19,21,22,23,24,25],Then:[1,22],These:6,To:22,Will:8,__init__:[6,8,12,13,14,15,16,18,19,21,22,23,24,25,26],__main__:[12,13,14,15,16,18,19,20,21,22,23,24,25,26],__name__:[12,13,14,15,16,18,19,20,21,22,23,24,25,26],__qualname__:1,_global:2,_state:[13,25],abc:[6,15,24],about:[3,24],absolut:[1,8],abstract_servic:15,abstract_service_1:15,abstract_service_2:15,abstractmethod:[15,24],abstractservic:[8,15],accept:[2,8],access:14,action:8,actual:[6,16,21],ad:2,add:[2,3,8],address:8,advantag:24,after:8,against:2,airflow:1,alias:1,all:[1,6,8,11,13,15,16,20,23,24],all_basic_service_implement:25,allow:2,allrod5:[],alreadi:[8,11,19],also:[8,15,16,19,21,22,24],ambigu:[8,15],among:8,an:[1,3,6,8,12,14,15,16,18,19,20,21,22,23,25,26],analysi:6,ani:[1,3,8,20,22,23],annot:[2,6,8,13,25],anoth:1,another_basic_servic:13,api:[8,25],app:19,appli:8,applic:[1,3,19],ar:[1,2,3,6,8,13,14,15,20,21,22,24],aren:[8,23],arg:[2,8],argument:[2,6,8,22,23],assert_cal:18,assertionrewritinghook:1,assign:[8,19,22],attempt:8,attribut:[1,14,15],attributeerror:1,author:[4,6],auto:3,automat:[4,6,8],autowir:[2,6,8,10,12,13,14,15,16,18,19,20,21,22,23,24,26],autowired_decor:8,autowired_typ:8,autowiringerror:[8,10],b:[14,15],bar:[8,13,20,23],base:[6,8,11,15,24,25],basic:[4,12,17,25],basic_servic:13,basic_usag:13,basic_usage_exampl:13,basicservic:13,basicusag:13,befor:[8,18,20],behav:26,behavior:13,behind:13,being:[1,2,8,20,21,26],beta:2,better:[3,12],between:26,black:3,bool:[8,11],both:[15,21,22,23,26],branch:3,brief:3,broker:6,bug:2,built:6,builtin:[1,2],bunch_of_servic:23,call:[2,6,8,18,20,21],callabl:8,caller:[2,8],can:[1,2,6,8,12,14,16,18,19,20,21,22,26],cannot:[8,16,22],carefulli:6,caus:1,caveat:4,chang:[2,11,26],changelog:4,check:[1,3,6],circular:[14,21],cl:8,clarifi:3,classmethod:8,clear:[3,8,11,20],clear_inject:[11,18],client1:26,client2:26,client:16,client_endpoint:16,client_endpoint_example_env_var:16,client_factori:16,code:[1,2,3,16],collect:[8,11],com:[0,1,8],combin:[1,15],command:5,comment:3,common:16,complet:13,complex:2,compli:[2,6],concret:24,conflict:22,conjunct:8,connect:[16,26],consol:2,constant:[4,7,8,11],constructor:[2,8,11],contain:[1,2,4,8,11,17],content:2,contribut:4,cool:6,corner:1,correct:8,craig:0,craigminihan:0,crash:2,creat:[2,8,24],cryptic:3,current:1,custom:[8,10],cyclic:[4,17,21],cyclic_dependency_exampl:14,cyclicdepend:14,dag:1,databas:6,david:0,de:[],deal:[14,16,21],declar:[1,2,6,8,13,15,16,21,22,23,24,25,26],decor:[1,2,6,8,13,16,19,25],def:[6,8,12,13,14,15,16,18,19,20,21,22,23,24,25,26],default_measuring_servic:22,default_namespac:[2,8,9,11],defin:[8,11,26],demonstr:13,dep:[6,8,12,18],depend:[2,4,8,10,11,13,17,18,21,23,24,25,26],dependencies_preced:15,dependencies_precedence_exampl:15,dependenciespreced:15,deprec:[2,8],describ:[1,25],descript:3,design:[6,8],detail:[14,21,22,25],dev:1,develop:6,differ:[2,6,8,15,22],direct:8,directli:[1,8,25],directori:8,discourag:3,discov:[6,8],discoveri:[4,6],do_someth:20,doc:6,docstr:3,document:[2,3],doe:[2,8,21],doesn:2,dr:[4,17],drop:2,due:8,dummi:16,duplic:[2,8],dure:1,e:[8,20,21],each:[1,13,14,15,22],earth_to_sun_dist:22,eas:[2,11],easier:14,effect:1,either:[1,8],eleg:6,email:24,email_sender_servic:24,emailsenderservic:24,empti:[2,8,20,23],enabl:[2,14],encod:[2,8],encourag:3,end:24,endpoint:16,ensur:3,entangl:2,environ:2,error:[4,7,8,15,20],everi:26,exampl:[2,3,4,6,8,11,12],except:[10,20],exclud:8,exclude_group:[8,24],execut:[1,8],exhaust:1,exist:[2,4,16,17],expect:23,explicit:15,explicitli:[8,15],expos:15,extend:6,extern:16,external_cli:16,externalcli:16,f:[15,16,24],factori:[2,4,8,17,19],factory_exampl:16,fail:[1,2,10,15,23],fall:14,fals:[8,11,26],fashion:[2,6],favor:2,fax:24,fax_sender_servic:24,faxsenderservic:24,featur:4,feedback:3,few:6,file:[1,2,8,11,12],filter:[8,24],finish:21,first:[1,2,8,22],fix:2,follow:[1,3],foo:[6,8,11,12,13,20,23],foo_factori:8,fork:3,form:3,format:3,found:[8,23],four:1,framework:[6,12,13,14,22,25],friendli:6,from:[1,2,6,8,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26],func:8,futur:8,g:8,gener:[2,8],get:[15,18,23],get_cod:1,get_pending_messag:6,get_repository_st:[13,25],get_some_property_from_a:14,get_some_property_from_b:14,getenv:16,github:[0,1],given:[8,11],global:8,good:12,grasp:13,group:[2,8,24],guidelin:3,ha:[1,22],happen:[2,24],hard:3,have:[13,14,15,16,19,22],heart:6,hello:24,high:25,hint:[2,6],how:[8,11,13,14,15,16,18,19,20,21,22,23,24,25,26],http:[0,1,16],human:4,i:[8,21],idea:13,identifi:8,illustr:[13,22,25],illustrativeexampl:12,implement:[1,15,24],imposs:[1,8],includ:[2,3,20],inclus:11,incompat:1,independ:[13,22],index:4,indic:[8,10,15],infer:2,inform:8,inherit:25,init:21,initi:[2,6,8,19],inject:[1,2,4,5,7,12,13,14,15,16,17,22,24,25,26],inject_multipl:[2,8,25],injectable_decor:8,injectable_factori:[1,2,8,16,19],injectable_factory_decor:[8,16],injectable_mocking_exampl:18,injectableloaderror:8,injectablemock:18,injecting_existing_inst:19,injecting_existing_instance_exampl:19,injectingexistinginst:19,injection_container_resetting_exampl:20,injectioncontain:[2,8],injectioncontainerreset:20,injectionerror:[8,10,20,23],insid:[8,25],inspect:2,inspir:1,instal:[2,4],instanc:[4,6,8,13,15,16,17,23,24,26],instanti:[2,8,14,16,21,26],instead:[2,8,13,14,15,23],internationalmeasuringservic:22,intl:22,intl_measuring_servic:22,invoc:8,invok:[8,14,21],isinst:1,isn:8,issu:[1,3],its:[14,22,26],itself:[1,3,8],just:[6,15,19,23],kafkaproduc:6,keep:3,kind:3,klass:11,km:22,know:16,known:1,kulej:0,label:24,lambda:[11,16,18,19],last:[8,22],lazi:[2,4,6,8,14,17],lazili:21,lazy_inject:21,lazy_injection_exampl:21,lazy_object_proxi:2,lazyinject:21,lead:1,learn:[14,24],least:[8,11],level:[1,8,25],leverag:21,librari:1,licens:6,like:[6,16],line:5,linter:[3,6],list:[1,2,6,8,23,24],ll:[4,13,14,15,16,19,21,22,23,24,25,26],load:[1,2,8],load_injection_contain:[2,6,8,12,13,14,15,16,18,19,20,21,22,23,24,25,26],locat:[2,4,17],log:8,logic:16,look:[1,8,12],lookup:8,loop:14,love:4,low:[8,25],lozano:0,lozanocampillod:0,maco:2,made:[8,20,26],magic:[3,8],mai:[1,3,23],make:[2,3,6,8,13,14,18,20],manag:8,mani:6,manual:11,mark:[2,8],martin:[],master:3,match:[8,20,24],meant:8,measuring_servic:22,messag:[6,24],message_brok:6,method:[2,8,13,14,15,21,23,25],mile:22,million:22,mind:3,minihan:0,minor:2,miss:2,mock:[2,4,11,17],mocked_dep:18,mocked_inject:18,mockeddep:18,model:6,modifi:14,modul:[1,2,4,8],more:[2,8,24],move:1,mt3o:0,multipl:[2,8,24],multipleservic:15,multipli:15,multiply_servic:15,multiplyservic:15,must:[1,8],name:[1,2],namespac:[2,4,6,8,9,11,17,20],namespaces_exampl:22,necessari:[8,16],need:[3,8,11,18,21],never:[1,8,18],nevertheless:3,non:[1,8],none:[8,11,13,22,23,25],now:[15,16,19,21],number:19,object:1,occurr:1,offici:2,often:3,ok:23,old:24,oliv:0,oliveira:0,onc:[2,8,26],one:[1,8,11,13,14,15,18,20,22,23,26],ones:[8,22],onli:[6,8,14,21,22,26],open:[2,3],oper:1,option:[2,4,8,11,17,22],optional_injection_exampl:23,optionalinject:23,organ:3,origin:6,os:16,other:[1,8,12,13,14,22,24,26],otherwis:11,our:[6,13,14,15,16,19,21,22,23,24,25,26],out:[6,8,24],outermost:23,output:2,outsid:[1,8],over:25,overload:[4,6,15,17,23,25],own:22,packag:[2,6],page:4,paramet:[2,6,8,11,21,22,24,26],parenthesi:[2,8],particular:22,pass:[6,8,25],path:[1,2,6,8],pend:6,pep:2,perform:8,pip:[2,5],place:[8,26],posit:8,possibl:[1,2,14],potenti:1,preced:[4,17,24],prefer:25,present:[8,23],preserv:6,prevent:[8,14],previou:[2,8],previous:8,primari:[8,15,23,25],primary_basic_servic:25,print:[12,13,14,15,16,18,19,20,21,22,23,24,25,26],project:[3,6,8],propag:[11,24],properti:[13,14,25],provid:[2,11],pull:3,purpos:[8,11],py:[12,13,14,15,16,18,19,20,21,22,23,24,25,26],pycharm:6,pytest:4,python:[1,2,8,12],qualifi:[2,4,6,8,11,14,15,17,22,23,25],qualifier_overload:24,qualifier_overloading_exampl:24,qualifieroverload:24,quirk:2,rais:[2,8,10,11,15],re:24,read:[1,8],readabl:3,readi:6,realdep:18,reason:[1,8,16,19],receiv:[3,8,23],recipi:24,recommend:8,record:11,recurs:[1,11],refactor:2,refer:[4,6,14,21],reflect:26,regard:[8,24],regardless:8,regist:[1,2,8,9,11,14,18,20,22],register_inject:[2,11,18],registri:[8,22],regular:[1,19],rel:[2,4,8],releas:2,remov:[2,8],render:1,repositori:[3,13,25],repres:16,request:[3,8],requir:2,reset:[4,11,17],reset_injection_contain:[2,11,20],resili:2,resolut:[8,24],resolv:[2,8,15,22,23,24],respect:[8,22],respons:16,review:3,right:21,rodrigo:0,roo:0,root:[6,20],run:[1,2,3,12,13,14,15,16,18,19,20,21,22,23,24,25,26],run_exampl:[12,13,14,15,16,18,19,20,21,22,23,24,25,26],s:[1,2,3,6,8,13,25],same:[1,2,6,8,21,24,26],sample_servic:25,sampleservic:25,satisfi:23,scan:[2,8,11],search:[1,2,4,8,9],search_path:8,section:[8,11,12],see:[15,16,19,21,22,23,25,26],self:[6,8,12,13,14,15,16,18,19,20,21,22,23,24,25,26],send:24,send_messag:24,send_pend:6,sender_servic:24,senderservic:24,sequenc:8,servic:[2,4,6,8,13,14,17,24],service_a:[14,21],service_b:[14,21],service_loc:25,service_locator_exampl:25,servicea:[14,21],serviceb:[14,21],serviceloc:25,set:[2,11,13],set_repository_st:[13,25],setter:[13,25],setup:8,shall:[8,23],share:[6,8,13,26],should:8,shouldn:8,show:[11,13,15,16,19,23,24],side:1,side_effect:18,signatur:2,simpl:6,simpler:16,simpli:23,sinc:[8,15,18],singl:[6,12,22,24],singleton:[4,6,8,13,17],singleton_cli:26,singleton_exampl:26,singletoncli:26,situat:23,sm:24,sms_sender_servic:24,smssenderservic:24,so:[1,3,16,19,23],some:[1,14,16,23],some_properti:14,some_servic:23,someth:[20,21],sourc:[8,10,11],speak:3,specialized_servic:25,specializedservic:25,specif:8,specifi:[6,8,11,15,21,22],sqsproduc:6,stabl:2,start:[12,21],state:[11,13,20,25,26],stateful_repositori:[13,25],statefulrepositori:[13,25],statefulservic:13,staticmethod:18,step:1,still:8,store:8,str:[8,11,16,24],straightforward:12,string:[1,2,8,14],style:3,submit:3,success:8,successfulli:22,suit:2,suitabl:2,sum:15,sum_servic:15,sumservic:15,suppli:19,support:2,sure:[8,20],system:1,t:[1,2,8,11,15,18,23],take:24,teodor:0,test:[1,2,3,4,6,7,8,17],than:[1,2,3,8],thei:[13,21,26],them:[6,14,22],themselv:8,therefor:22,thi:[1,3,8,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26],thoroughli:3,those:1,though:[8,15,18,23],three:[22,24],through:[1,2,16],time:[2,8,21],tl:[4,17],tldr_exampl:12,ton:2,trail:8,transpar:6,trial:2,tricki:3,turn:[13,19,25,26],twice:1,two:[13,22,24,26],type:[1,2,6,8,11,13,22,23,24],typeerror:2,ubuntu:2,unabl:8,under:8,understand:12,unintend:1,union:[8,11],uniqu:8,unique_id:8,unit:[2,3],unitedstatesmeasuringservic:22,unittest:18,unless:11,unus:2,up:24,us:[1,2,3,6,8,9,11,13,14,15,16,18,19,20,22,23,24,25,26],us_measuring_servic:22,usag:[1,2,4,6,8,11,12,25],user:2,utf:[2,8],util:[2,8,11,18,20],uuid:8,valid:8,valu:[8,13,23,25],valueerror:11,variabl:19,varieti:8,version:[2,8,11],wa:[8,15,18,26],wai:[3,21],want:[3,23],warn:[8,20],wasn:[8,15],we:[13,14,15,16,18,19,21,22,23,24,25,26],welcom:3,well:[3,15],were:[22,24],what:[3,22,23],whatev:19,when:[2,6,8,11,14,15,21,23,24,26],whenev:26,where:8,which:[2,8,11,13,14,15,16,19,21,23,25,26],window:2,wire:8,without:[2,8,16,22],won:[1,11,23],work:[1,2,14,21,22,23,24,25],workaround:1,world:24,would:15,wouldn:18,wrap:[8,16,18],write:3,wrote:3,yet:2,you:[3,4,12,13,14,15,16,19,21,22,23,24,25,26],your:[3,6,16]},titles:["Authors","Caveats","Changelog","Contributing","Contents","Installation","Injectable: Dependency Injection for Humans\u2122","Reference","injectable","injectable.constants","injectable.errors","injectable.testing","TL;DR","Basic Usage Example","Cyclic Dependency Example","Dependencies Precedence Example","Factory Example","Usage Examples","Injectable Mocking For Tests Example","Injecting Existing Instance Example","Injection Container Resetting For Tests Example","Lazy Injection Example","Namespaces Example","Optional Injection Example","Qualifier Overloading Example","Service Locator Example","Singletons Example"],titleterms:{"0":2,"02":2,"03":2,"04":2,"05":2,"06":2,"07":2,"08":2,"09":2,"1":2,"10":2,"11":2,"12":2,"13":2,"14":2,"15":2,"19":2,"2":2,"20":2,"2018":2,"2020":2,"2021":2,"2024":2,"22":2,"23":2,"24":2,"29":2,"3":2,"4":2,"5":2,"6":2,"7":2,"import":1,For:[18,20],author:0,automat:1,basic:13,caveat:1,changelog:2,constant:9,contain:20,content:4,contribut:3,cyclic:14,depend:[1,6,14,15],discoveri:1,dr:12,error:10,exampl:[13,14,15,16,17,18,19,20,21,22,23,24,25,26],exist:19,factori:16,featur:6,human:6,indic:4,inject:[6,8,9,10,11,18,19,20,21,23],instal:5,instanc:19,lazi:21,ll:6,locat:25,love:6,mock:18,namespac:22,option:23,overload:24,preced:15,pytest:1,qualifi:24,refer:7,rel:1,reset:20,servic:25,singleton:26,tabl:4,test:[11,18,20],tl:12,usag:[13,17],you:6}}) \ No newline at end of file diff --git a/docs/usage/TLDR.html b/docs/usage/TLDR.html index 904e208..7c380e1 100644 --- a/docs/usage/TLDR.html +++ b/docs/usage/TLDR.html @@ -3,8 +3,9 @@ - - TL;DR — injectable 3.4.7 documentation + + + TL;DR — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    TL;DR

    This is an straightforward example of the injectable framework in a single Python file.

    @@ -88,7 +89,7 @@

    Navigation

    -
    +
    @@ -168,8 +169,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/basic_usage.html b/docs/usage/basic_usage.html index 5a6af06..fe5dc9c 100644 --- a/docs/usage/basic_usage.html +++ b/docs/usage/basic_usage.html @@ -3,8 +3,9 @@ - - Basic Usage Example — injectable 3.4.7 documentation + + + Basic Usage Example — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    Basic Usage Example

    In this example you’ll grasp the basic ideas behind this framework.

    We will be injecting dependencies into our BasicUsage class’s __init__ method @@ -151,7 +152,7 @@

    Navigation

    -
    +
    @@ -231,8 +232,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/cyclic_dependency.html b/docs/usage/cyclic_dependency.html index 5f6a551..acee420 100644 --- a/docs/usage/cyclic_dependency.html +++ b/docs/usage/cyclic_dependency.html @@ -3,8 +3,9 @@ - - Cyclic Dependency Example — injectable 3.4.7 documentation + + + Cyclic Dependency Example — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    Cyclic Dependency Example

    In this example you’ll learn how the injectable framework can make it easier to deal with circular references.

    @@ -129,7 +130,7 @@

    Navigation

    -
    +
    @@ -209,8 +210,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/dependencies_precedence.html b/docs/usage/dependencies_precedence.html index 7e1b584..94a5266 100644 --- a/docs/usage/dependencies_precedence.html +++ b/docs/usage/dependencies_precedence.html @@ -3,8 +3,9 @@ - - Dependencies Precedence Example — injectable 3.4.7 documentation + + + Dependencies Precedence Example — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    Dependencies Precedence Example

    In this example you’ll see the use of declaring an injectable as primary and the use of explicitly declared qualifiers.

    @@ -131,7 +132,7 @@

    Navigation

    @injectable(qualifier="sum", primary=True) class SumService(AbstractService): def combine(self, a, b): - print(f"{a} + {b} = {a + b}") + print(f"{a} + {b} = {a + b}")
    @@ -144,11 +145,11 @@

    Navigation

    @injectable(qualifier="multiply") class MultiplyService(AbstractService): def combine(self, a, b): - print(f"{a} * {b} = {a * b}") + print(f"{a} * {b} = {a * b}") - +
    @@ -228,8 +229,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/factory.html b/docs/usage/factory.html index 6586f75..dba6799 100644 --- a/docs/usage/factory.html +++ b/docs/usage/factory.html @@ -3,8 +3,9 @@ - - Factory Example — injectable 3.4.7 documentation + + + Factory Example — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    Factory Example

    In this example you’ll see how we can declare a function as a factory of injectable instances.

    @@ -124,7 +125,7 @@

    Navigation

    - +
    @@ -204,8 +205,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/index.html b/docs/usage/index.html index cc498ca..ba72586 100644 --- a/docs/usage/index.html +++ b/docs/usage/index.html @@ -3,8 +3,9 @@ - - Usage Examples — injectable 3.4.7 documentation + + + Usage Examples — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -46,7 +47,7 @@

    Navigation

    -
    +

    Usage Examples

    -
    +
    @@ -146,8 +147,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/injectable_mocking_for_tests.html b/docs/usage/injectable_mocking_for_tests.html index 0cd6b51..4a4ce63 100644 --- a/docs/usage/injectable_mocking_for_tests.html +++ b/docs/usage/injectable_mocking_for_tests.html @@ -3,8 +3,9 @@ - - Injectable Mocking For Tests Example — injectable 3.4.7 documentation + + + Injectable Mocking For Tests Example — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    Injectable Mocking For Tests Example

    This is an example of how one can use the testing utility functions clear_injectables and @@ -108,7 +109,7 @@

    Navigation

    -
    +
    @@ -188,8 +189,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/injecting_existing_instance.html b/docs/usage/injecting_existing_instance.html index 469834c..3a18d85 100644 --- a/docs/usage/injecting_existing_instance.html +++ b/docs/usage/injecting_existing_instance.html @@ -3,8 +3,9 @@ - - Injecting Existing Instance Example — injectable 3.4.7 documentation + + + Injecting Existing Instance Example — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    Injecting Existing Instance Example

    In this example you’ll see how to supply an already-initialized instance as injectable.

    For whatever reason we have already initialized an instance of Application and @@ -110,7 +111,7 @@

    Navigation

    - +
    @@ -190,8 +191,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/injection_container_resetting_for_tests.html b/docs/usage/injection_container_resetting_for_tests.html index 7c9edd4..c87420a 100644 --- a/docs/usage/injection_container_resetting_for_tests.html +++ b/docs/usage/injection_container_resetting_for_tests.html @@ -3,8 +3,9 @@ - - Injection Container Resetting For Tests Example — injectable 3.4.7 documentation + + + Injection Container Resetting For Tests Example — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    Injection Container Resetting For Tests Example

    This is an example of how one can use the testing utility function reset_injection_container to @@ -103,7 +104,7 @@

    Navigation

    - +
    @@ -183,8 +184,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/lazy_injection.html b/docs/usage/lazy_injection.html index 5e0f492..acd4dc1 100644 --- a/docs/usage/lazy_injection.html +++ b/docs/usage/lazy_injection.html @@ -3,8 +3,9 @@ - - Lazy Injection Example — injectable 3.4.7 documentation + + + Lazy Injection Example — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    Lazy Injection Example

    In this example you’ll see how to declare an injection as lazy and how does it work.

    We declare classes ServiceA and ServiceB which both print when they are being @@ -138,7 +139,7 @@

    Navigation

    - +
    @@ -218,8 +219,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/namespaces.html b/docs/usage/namespaces.html index 3e89549..cbbaad0 100644 --- a/docs/usage/namespaces.html +++ b/docs/usage/namespaces.html @@ -3,8 +3,9 @@ - - Namespaces Example — injectable 3.4.7 documentation + + + Namespaces Example — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    Namespaces Example

    In this example you’ll see how namespaces work in the framework.

    Each namespace has its own independent injectables registry and one namespace cannot @@ -140,7 +141,7 @@

    Navigation

    - +
    @@ -220,8 +221,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/optional_injection.html b/docs/usage/optional_injection.html index 59def8f..f686533 100644 --- a/docs/usage/optional_injection.html +++ b/docs/usage/optional_injection.html @@ -3,8 +3,9 @@ - - Optional Injection Example — injectable 3.4.7 documentation + + + Optional Injection Example — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    Optional Injection Example

    In this example you’ll see how to declare an injection as optional using typing.Optional.

    @@ -110,7 +111,7 @@

    Navigation

    - +
    @@ -190,8 +191,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/qualifier_overloading.html b/docs/usage/qualifier_overloading.html index 3f09837..f9e1733 100644 --- a/docs/usage/qualifier_overloading.html +++ b/docs/usage/qualifier_overloading.html @@ -3,8 +3,9 @@ - - Qualifier Overloading Example — injectable 3.4.7 documentation + + + Qualifier Overloading Example — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    Qualifier Overloading Example

    In this example you’ll learn about overloading qualifiers/classes for injection and how to take advantage of that to inject multiple dependencies as a list of instances.

    @@ -157,7 +158,7 @@

    Navigation

    - +
    @@ -237,8 +238,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/service_locator.html b/docs/usage/service_locator.html index 9e343f0..0cedfef 100644 --- a/docs/usage/service_locator.html +++ b/docs/usage/service_locator.html @@ -3,8 +3,9 @@ - - Service Locator Example — injectable 3.4.7 documentation + + + Service Locator Example — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    Service Locator Example

    In this example you’ll see how to use the low-level Service Locator API of this framework.

    @@ -181,7 +182,7 @@

    Navigation

    - +
    @@ -261,8 +262,8 @@

    Navigation

    \ No newline at end of file diff --git a/docs/usage/singletons.html b/docs/usage/singletons.html index cb81103..d486f23 100644 --- a/docs/usage/singletons.html +++ b/docs/usage/singletons.html @@ -3,8 +3,9 @@ - - Singletons Example — injectable 3.4.7 documentation + + + Singletons Example — injectable 4.0.0 documentation @@ -30,7 +31,7 @@

    Navigation

    @@ -47,7 +48,7 @@

    Navigation

    -
    +

    Singletons Example

    In this example you’ll see how we define dependencies as singletons and how they behave.

    A singleton injectable is instantiated only once and then this same instance is used @@ -115,7 +116,7 @@

    Navigation

    - +
    @@ -195,8 +196,8 @@

    Navigation

    \ No newline at end of file diff --git a/requirements.dev.txt b/requirements.dev.txt index 26f4d58..c0229da 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -4,8 +4,9 @@ pytest~=6.2 pytest-mock~=3.6 pytest-cov~=2.12 coveralls~=3.2 -black~=21.7b0 -flake8~=3.9 +black~=23.12 +flake8~=7.1.0 sphinx~=4.1 sphinx_py3doc_enhanced_theme~=2.4 bump2version~=1.0 +setuptools~=70.2.0 diff --git a/requirements.txt b/requirements.txt index a04cc49..ab74b38 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,3 @@ pycollect~=0.2 parameters-validation~=1.2 cached-property~=1.5 typing-inspect~=0.7 -dataclasses~=0.8; python_version >= '3.6' and python_version < '3.7' diff --git a/setup.py b/setup.py index dd31657..8a262cf 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ def read(*names, **kwargs): setup( name="injectable", - version="3.4.7", + version="4.0.0", packages=find_packages( exclude=( "tests", @@ -65,11 +65,11 @@ def read(*names, **kwargs): "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython", "Development Status :: 5 - Production/Stable",