Add type annotations to manim/_config/utils.py#4230
Add type annotations to manim/_config/utils.py#4230chopan050 merged 11 commits intoManimCommunity:mainfrom
manim/_config/utils.py#4230Conversation
eecabf9 to
4e2fb86
Compare
|
@JasonGrace2282 Would you take a look at this PR? |
5484d9e to
3dd725d
Compare
behackl
left a comment
There was a problem hiding this comment.
Seems fine to me, thank you very much!
behackl
left a comment
There was a problem hiding this comment.
Upon closer inspection (and actually due to our pre-commit mypy check): there now is an issue with the config.window_size key typing that revealed a bug:
The OpenGLWindow does expect config.window_size to be a string of shape 'width,height', or 'default'. If one sets config.window_size = (900, 600) or something like that (which is actually quite reasonable to assume, that an integer-tuple is a suitable choice), then the window crashes because it tries to call .split on the config value.
Suggestion (up for discussion of course): we could rewrite the setter of config.window_size to be tuple[int, int] | None, with None taking over the current role of 'default', and then simplify the logic in opengl_renderer_window.py. Thoughts?
|
Since we merged PR #4363 which typed |
manim/_config/utils.py
|
I just saw @behackl comment. Before reading it, I already committed a fix 😅
Would that also make the getter of Actually, instead of having too much logic for validating and parsing EDIT: this should all probably be done in a follow-up PR |
Head branch was pushed to by a user without write access
4a26029 to
f272e78
Compare
|
I would suggest to move all the interpretation of the |
d7f68f2 to
160bff3
Compare
160bff3 to
81f182c
Compare
|
I noticed that, in the last commit, the utils MyPy errors were ignored again. Was that intended? After stopping ignoring them on my machine, a lot of errors appeared. Almost all of them are "Incompatible return value type" because they depend on |
|
So, whats the latest status here? As per https://github.com/henrikmidtiby/manim/blob/9157452bd7120a0cbd6403cf78115249f92953e0/mypy.ini#L55-L56 the mypy errors are currently ignored in this file. I'm happy to merge this cleanup as-is if messing with the config dict is too tiring. (I'm heavily contemplating staring with pydantic-fying the config rather sooner than later, so not sure how much effort we should still put into the current state of affairs.) |
|
I would suggest to merge this issue now and then deal with the configuration changes in PR #4399 |
Overview: What does this pull request change?
More work on #3375
Continuation of PR #4134
The module manim/_config/utils.py is now going through mypy checks without raising any issues.
Reviewer Checklist