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

[typing] Inconsistent typing in the work decorator #3510

Open
rodrigogiraoserrao opened this issue Oct 11, 2023 · 4 comments
Open

[typing] Inconsistent typing in the work decorator #3510

rodrigogiraoserrao opened this issue Oct 11, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@rodrigogiraoserrao
Copy link
Contributor

rodrigogiraoserrao commented Oct 11, 2023

See this discussion about the usage of Decorator versus Decorator[..., ReturnType] in src/textual/_work_decorator.py.

EDIT: Last time I tackled this (and opened PR #3862) I ended up hitting what looked like a mypy issue but might as well just be something I didn't get right.
I did try to outsource the fix to Twitter and a Discord server but no one was able to help me.
Independently from me, PR #3937 does similar work that would also fix this issue.

@willmcgugan
Copy link
Collaborator

@rodrigogiraoserrao I'm assuming this is a quick fix?

@rodrigogiraoserrao
Copy link
Contributor Author

Depends.
When it comes to typing, what do we use as the ground truth? mypy, pylance, or another typechecker?

@willmcgugan
Copy link
Collaborator

Ideally we can get them to agree. If not, Mypy.

@rodrigogiraoserrao rodrigogiraoserrao self-assigned this Dec 11, 2023
@rodrigogiraoserrao
Copy link
Contributor Author

rodrigogiraoserrao commented Dec 11, 2023

I was exploring a fix to the typing issues that then triggered new typing issues in other places of the codebase where the decorator work is used.

Work on this surfaced a possible mypy bug.
I've created a standalone gist which seems to contain this possible bug: https://mypy-play.net/?mypy=latest&python=3.12&gist=c451dedbb5ec867b98fcfec6aa24d698
I also asked for help on Twitter: https://twitter.com/mathsppblog/status/1734247854854599035

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants