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

✨ Allow using dependables with functools.partial() #9753

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

lieryan
Copy link

@lieryan lieryan commented Jun 27, 2023

Discussion: #9744

Using functools.partial() with dependables feels like a very obvious idiom. partial() already works for dependables that are plain function, but it doesn't work consistently, partial of async and callable classes didn't work consistently.

This PR makes partial() work consistently in all combinations.

test_dependency_class.py have been renamed to test_dependency_types.py to reflect its bigger scope now.

There's quite a bit of repetition in the tests, part of me wants to just refactor those; but another part of me also wants to keep the tests simple.

@tiangolo tiangolo changed the title Allow using dependables with functools.partial() ✨ Allow using dependables with functools.partial() Jan 14, 2024
@tiangolo tiangolo added feature New feature or request p2 labels Jan 14, 2024
@lieryan lieryan force-pushed the lieryan-dependencies-with-functools-partial branch from 9562162 to 05ab699 Compare January 22, 2024 01:15
@Lemminkyinen
Copy link

This would be nice to have

@jtfidje
Copy link

jtfidje commented Mar 10, 2024

Yeah - I also just hit this! Please merge 😅

@jtfidje
Copy link

jtfidje commented Jul 23, 2024

@tiangolo Are we any closer to a merge on this? 🙂

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

Successfully merging this pull request may close these issues.

4 participants