Skip to content

Complete typing for logger_utils.py #4134

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

Merged
merged 4 commits into from
May 23, 2025

Conversation

fmuenkel
Copy link
Contributor

Motivation and Explanation: Why and how do your changes improve the library?

More work on #3375

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

@@ -126,7 +126,7 @@ def parse_theme(parser: configparser.SectionProxy) -> Theme:
:func:`make_logger`.

"""
theme = {key.replace("_", "."): parser[key] for key in parser}
theme: dict[str, Any] = {key.replace("_", "."): parser[key] for key in parser}

Choose a reason for hiding this comment

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

why not typing.Dict ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I might be wrong here, but I thought there is no difference between typing.Dict and dict anymore, since PEP 585 introduced generic type support for these built-in types.

Choose a reason for hiding this comment

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

You are right. I was just thinking that you wanted to use typing everywhere ;-)

@JasonGrace2282 JasonGrace2282 added the typehints For adding/discussing typehints label Feb 9, 2025
@JasonGrace2282
Copy link
Member

Hi! Could you please set ignore_errors = False in mypy.ini, so that we can have mypy check this code in CI?
Thanks :)

@henrikmidtiby
Copy link
Contributor

I have continued work on this pull request, the updated pull request is available here: #4230

Copy link
Contributor

@chopan050 chopan050 left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! The changes seem fine. There's only one thing which must be changed in mypy.ini and we would be done.

mypy.ini Outdated
Comment on lines 51 to 53
[mypy-manim._config.*]
ignore_errors = True
ignore_errors = False
disable_error_code = return-value
Copy link
Contributor

@chopan050 chopan050 May 22, 2025

Choose a reason for hiding this comment

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

This ignores errors for all files in manim/_config, which is showing multiple MyPy errors for other files which fall out of the scope of this PR. This is why pre-commit is failing in the workflows.

Instead, you'd want something like this to display only errors from the manim/_config/logger_utils.py file and ignore the rest:

[mypy-manim._config.*]
ignore_errors = True
disable_error_code = return-value

[mypy-manim._config.logger_utils]
ignore_errors = False

@chopan050 chopan050 enabled auto-merge (squash) May 23, 2025 01:07
Copy link
Contributor

@chopan050 chopan050 left a comment

Choose a reason for hiding this comment

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

LGTM!

@chopan050 chopan050 merged commit fdc496c into ManimCommunity:main May 23, 2025
20 of 21 checks passed
@fmuenkel fmuenkel deleted the typing-logger-utils branch May 23, 2025 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typehints For adding/discussing typehints
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants