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

fix: type propogation through provided #733

Merged
merged 7 commits into from
Jan 8, 2025

Conversation

philipbjorge
Copy link

Addresses #731

@jonathangreen
Copy link

@rmk135 Any chance that this type fix could be merged as well?

@rmk135 rmk135 requested a review from ZipFile January 7, 2025 00:21
@rmk135 rmk135 changed the base branch from master to develop January 7, 2025 00:22
@rmk135
Copy link
Member

rmk135 commented Jan 7, 2025

Thank you for the contribution @philipbjorge .

@ZipFile can you please review this PR when you have a moment?

attr_getter5: providers.AttributeGetter = provider5.provided.attr
item_getter5: providers.ItemGetter = provider5.provided["item"]
method_caller: providers.MethodCaller = provider5.provided.method.call(123, arg=324)
provided5: Animal = provider5.provided
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is not exactly correct. The attribute provider5.provided returns a provider, not an object of Animal. I can't recall why it was important, but the current change will introduce a functional change in the typing approach.

To make a correct typing test with the .provided attribute we would need to do something like that:

provided5: Animal = provider5.provided()

At least, that would be what the library actually does.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmk135 updated the tests with .provided()

cc @philipbjorge thanks for flagging

@philipbjorge
Copy link
Author

I don't have capacity to address any feedback here and no longer work at the company using this library -- But I've reached out to my previous teammates to see if they can carry the torch :)

Thanks for reviewing! Excited to see this project waking back up!

src/dependency_injector/providers.pyi Outdated Show resolved Hide resolved
tests/typing/callable.py Show resolved Hide resolved
tests/typing/callable.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ZipFile ZipFile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ZipFile ZipFile merged commit 00326e9 into ets-labs:develop Jan 8, 2025
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

Successfully merging this pull request may close these issues.

5 participants