Skip to content

Add lots of Typing for python >=3.12 and Modernize#700

Closed
sakgoyal wants to merge 0 commit into
quodlibet:mainfrom
sakgoyal:main
Closed

Add lots of Typing for python >=3.12 and Modernize#700
sakgoyal wants to merge 0 commit into
quodlibet:mainfrom
sakgoyal:main

Conversation

@sakgoyal
Copy link
Copy Markdown

@sakgoyal sakgoyal commented Jan 13, 2026

Modernize this project by adding type hints to everything.

Work in Progress PR. getting the code to pass with mypy is extremely challenging given how the project is set up with mixins, multiple inheritance, decorators, etc.

There is a high chance I missed something or got some types wrong. I would greatly appreciate some help getting this working. Currently sitting at ~350 errors on mypy.

Major blockers: fix import cycle chains, figuring out generic typing for the loadfile() decorator. it makes it really hard for the LSP to see what's happening without types

Copy link
Copy Markdown
Collaborator

@phw phw left a comment

Choose a reason for hiding this comment

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

This is a lot of changes in a single commit, and the result raises during tests.

Overall this commit contains several unrelated changes:

  1. Getting rid of Python 2 specfics
  2. Add type hinting
  3. Different changes to more modern alternatives, like replacing c-style replacements with f-strings
  4. Some random code changes that are more a stylistic preference

It would be better to separate those changes and focus on one aspect in this PR.

Comment thread mutagen/_tools/mid3iconv.py Outdated
def main(argv: list[str]) -> None:
parser = ID3OptionParser()
parser.add_option(
_ = parser.add_option(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't really see the point of those assignments. They just make the code noisy, but are not needed. This is scattered all over the code now. Not every function call needs to be assigned to a variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants