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

✨ Add Typing for select of arbitrary length #839

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

maxispeicher
Copy link

Running mypy or similar type checkers on select queries with more than 4 arguments will lead to errors due to the limited type overloads.

In order to at least somehow circumvent this, this PR adds overloads for an arbitrary amount of arguments to select.

resolves #92

@svlandeg svlandeg changed the title Add Typing for select of arbitrary length ✨ Add Typing for select of arbitrary length Mar 19, 2025
@GiorgioPorgio
Copy link

@Seluj78 I'm not sure if @maxispeicher is active these days and there were a few conflicts (filename changes) that I could not resolve on their branch, so I changed an open PR I had to be Maxi's changes without the conflicts.

Credits go to @maxispeicher ofc - it'd be awesome if we can get better typing :)

Thank you for your work!

@GiorgioPorgio
Copy link

GiorgioPorgio commented Mar 27, 2025

I do not think this can work unfortunately. Python's type system doesn't provide a clean way to have variadic generic types that preserve the individual types of each argument without listing all possibilities.

This approach would remove the type specificity of individual arguments and break a lot of consumers that rely on it.

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

Successfully merging this pull request may close these issues.

Unexpected argument(s) warning in PyCharm when using select() with many parameters
5 participants