Skip to content

Adding type hints to dependency-injector #268

Closed
@awaizman1

Description

@awaizman1

Hi,

Now that python typing (type hints) is very common, it would be great that dependency-injector will have type hints / annotations.
Currently when using Container / Provider classes mypy complains since it doesn't have information about a provider returned type, etc.

For example:

provider: Provider[Animal] = providers.Factory(Cat)

animal = provider()  # mypy can know that animal is of type Animal

My current workaround is to put type: ignore in many places but it is less desired since I won't get errors at type checking time.

Thanks

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions