Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[MNT] Typing: Use Literal for set_loglevel#30302

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
nrnavaneet wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromnrnavaneet:fix/literal-typing-setloglevel

Conversation

nrnavaneet
Copy link
Contributor

This PR addresses part of#30257 by improving type safety and IDE support for set_loglevel.

Changes in this PR:

  • Introduced LogLevel as a TypeAlias in matplotlib.typing, using Literal to restrict accepted values.
  • Updated set_loglevel() in init.py to use LogLevel.

This improves discoverability and static type checking for valid logging levels like "info", "debug", "error", etc.

Related work not included here
MarkerType updates were implemented by@ZPyrolink in#30261
Event type literals for connect methods were contributed by@ZPyrolink in#30275

@nrnavaneet
Copy link
ContributorAuthor

Hi all 👋,

I initially attempted to address multiple points from this issue in a single PR, but I realized that it introduced unnecessary complexity, especially for someone like me who is still learning and new to contributing at this scale.

To manage things better and ensure clarity in both review and implementation, I’ve now shifted to handling one fix at a time. I’ve started with set_loglevel as it seemed like a simpler, self-contained change to begin with.

This approach will also help me improve gradually and avoid making mistakes across unrelated parts. Thank you so much for your patience and guidance, it’s really encouraging for a beginner like me 🙏🙂

@timhoffm
Copy link
Member

Thanks. This is correct in the sense that it matches documentation now.

image

However, implementation-wise we've accepted any capitalization, in particular also thd capitalized form "INFO", which is passed through to/accepted by stdlibsLogger.setLevel - maybe we should take the opportunity to align more with the stdlib?

Copy link
Member

@timhoffmtimhoffm left a comment

Choose a reason for hiding this comment

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

Ok, let's take this as is. And handle the question of aligning with stdlib as a follow-up topic.

@nrnavaneet
Copy link
ContributorAuthor

nrnavaneet commentedJul 14, 2025
edited
Loading

Yes@timhoffm, you’re right. I’ve implemented this by normalising the input to lowercase within set_loglevel(), so it aligns with the stdlib behaviour. You think that will work?

Let me know if any further changes are required.
Thanks again for pointing that out

@nrnavaneetnrnavaneetforce-pushed thefix/literal-typing-setloglevel branch from1f29d69 to0555206CompareJuly 17, 2025 07:35
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@nrnavaneet@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp