Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from injection import Module, mod
from injection._core.module import Module as CoreModule
from injection.utils import PythonModuleLoader
from injection.loaders import PythonModuleLoader
from tests.helpers import EventHistory

logging.basicConfig(level=logging.DEBUG)
Expand Down
6 changes: 3 additions & 3 deletions documentation/utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To load Injectable1 and Injectable2 into memory you can do the following:

```python
# Imports
from injection.utils import PythonModuleLoader
from injection.loaders import PythonModuleLoader
import package
```

Expand Down Expand Up @@ -64,7 +64,7 @@ PythonModuleLoader.endswith(f"_{profile}").load(package)
`load_packages` is a simplified version of `PythonModuleLoader`.

```python
from injection.utils import load_packages
from injection.loaders import load_packages

import package

Expand All @@ -87,7 +87,7 @@ from abc import abstractmethod
from typing import Protocol

from injection import inject, mod, should_be_injectable, singleton
from injection.utils import load_profile
from injection.loaders import load_profile

@should_be_injectable
class SMSService(Protocol):
Expand Down
8 changes: 2 additions & 6 deletions injection/ext/fastapi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from types import GenericAlias
from typing import TYPE_CHECKING, Annotated, Any, TypeAliasType
from typing import Annotated, Any, TypeAliasType

from fastapi import Depends

Expand Down Expand Up @@ -33,10 +33,6 @@ def __getitem__(self, params: Any, /) -> Any:
return Annotated[cls, self(cls), *iter_params]


if TYPE_CHECKING:
type Inject[T, *Metadata] = Annotated[T, Depends(...), *Metadata]

else:
Inject = FastAPIInject()
Inject = FastAPIInject()

del FastAPIInject
5 changes: 5 additions & 0 deletions injection/ext/fastapi.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from typing import Annotated

from fastapi import Depends

type Inject[T, *Metadata] = Annotated[T, Depends(...), *Metadata]
File renamed without changes.
2 changes: 1 addition & 1 deletion injection/testing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import ContextManager, Final

from injection import Module, mod
from injection.utils import load_profile
from injection.loaders import load_profile

__all__ = (
"load_test_profile",
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_load_profile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from injection import find_instance, injectable, mod
from injection.utils import load_profile
from injection.loaders import load_profile


class TestLoadProfile:
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_python_module_loader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from injection.utils import PythonModuleLoader, load_packages
from injection.loaders import PythonModuleLoader, load_packages


class TestPythonModuleLoader:
Expand Down