## Description
Hello y'all.
One of the dev from the [beets-flask
app](https://github.com/pSpitzner/beets-flask) here. We are extending
the `ImportSession` in our application to get the interactive imports
working in our application. Overall that was not a too pleasant
experience as a ton of typehints are missing in that area of the beets
code. This PR wants to fix this ;)
### Changes
Moved importer state logic into a dataclass. Is clearer and more
isolated now in my opinion, we are not using it but I found it quite
confusing when looking at it.
Added a ton of typehints to the `importer.py` file. Predominantly the
`ImportSession`, `ImportTask` (and derivatives) and pipeline stage
decorators are now (hopefully) completely typed. Additionally I fixed
some typhint issues in the `util.__init__.py` file, mainly related to
the `PathLike` type.
If you have some strong opinions about any of the changes feel free to
revert or edit the PR.
Best,
Sebastian
P.S: I noticed that beets does not use Abstract Base Classes is there
any reason for that or is it just of historic nature? I think some Base
Classes could be adapted to use an ABC metaclass quite easily.
- genres are now called tags
- tags needs to be in "mb fetch includes"
- release-group has them
- release has them
- and recording as well but we don't use them
- not sure what this outdated check was doing, it looked at "recordings"
in the valid list even though genre fetching is only included in the
`album_info` code and not `track_info` 🤷
- see musicbrainz.VALID_INCLUDES for reference
Update documentation to use specific GitHub issue templates instead of
generic issue links. This helps users provide better structured feedback
when reporting bugs or requesting features.
This was noted in
https://github.com/beetbox/beets/issues/5610#issuecomment-2628985640
Without explicitly closing this file descriptor, the temp file would be
kept open until the program exited and could not be deleted by the
fetchart plugin.
Fixes#5521
Fixes a confusing typo when setting the MusicBrainz matcher in a few
tests. It looks like the matcher defaults to `IDENT` so change it to
that, since that would have been the value used in the tests with the
typo.
Without explicitly closing this file descriptor, the temp file would be kept open until the program exited and could not be deleted by the fetchart plugin.
The return type of the stage decorator should in theory be `T|None`
but the return of task types is not consistent in its usage. Would need
some bigger changes for which I'm not ready at the moment.
Refactor `beetsplug` to use native namespace packages by removing
`__init__.py`. Update documentation and `setup.cfg` to support namespace
packages.
### Motivation
Adopt PEP 420 native namespace packages to simplify plugin management
and eliminate the need for `__init__.py`.
See https://realpython.com/python-namespace-package.
This setup is backwards-compatible, so plugins using the old
pkgutil-based setup will continue working fine.
The advantage with this setup is that external plugins will now be able
to import modules from 'beetsplug' package for typing purposes.
Previously, mypy could not resolve these modules due to presence of
`__init__.py`.