Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from __future__ import annotations breaks dependency injection #39

Open
almeynman opened this issue Nov 19, 2024 · 2 comments
Open

from __future__ import annotations breaks dependency injection #39

almeynman opened this issue Nov 19, 2024 · 2 comments

Comments

@almeynman
Copy link

Hi. Thank you for the library 🙏 , I am really enjoying it

I found quite a weird edge case: when I import service decorator and there is from __future__ import annotations, then the dependency injection fails with missing {n} required positional arguments error

@almeynman almeynman changed the title from __future__ import annotations breaks dependency injection from __future__ import annotations breaks dependency injection Nov 19, 2024
@maldoinc
Copy link
Owner

Hi! Yes, sadly the library won't work at the moment with future annotations as the types are stringified. inspect.get_annotations is also only available from Python 3.10 so this would need a backport.

Looks like typing_extensions will have it in the next release, 4.13.

https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.get_annotations

@almeynman
Copy link
Author

All right, not a big deal at the moment, but took a bit of time to investigate why injection broke

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants