Skip to content

Conversation

@ChadThackray
Copy link
Contributor

@ChadThackray ChadThackray commented Nov 29, 2025

Addresses #647.

When using mypy in strict mode I am forced to import items from root mutagen namespace as:

from mutagen import File as MutagenFile  # type: ignore[attr-defined]

If I remove the ignore statement I get this error:

src/shares/indexer.py:12: error: Module "mutagen" does not explicitly export attribute "File"  [attr-defined]

There is another PR relating to this issue: #695
But the tests are failing for that due to some changes made

@lazka
Copy link
Member

lazka commented Dec 24, 2025

Apparently this also makes mypy happy: https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport

from mutagen._util import MutagenError as MutagenError
from mutagen._file import FileType as FileType, StreamInfo as StreamInfo, File as File
from mutagen._tags import Tags as Tags, Metadata as Metadata, PaddingInfo as PaddingInfo

not sure which one I prefer

@lazka
Copy link
Member

lazka commented Dec 24, 2025

I guess we use __all__ in various places, so let's go with that.

In other places were we don't want to change __all__ that's what we have to do though.

@lazka lazka merged commit 905e815 into quodlibet:main Dec 24, 2025
16 checks passed
@lazka lazka mentioned this pull request Dec 24, 2025
@scratchmex
Copy link

This could be co-authored but ok, that's why reviews exist. I'm not trying to be pendantic tho

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.

3 participants