music library manager and MusicBrainz tagger
  • Python 96.5%
  • JavaScript 3%
  • Shell 0.3%
  • HTML 0.1%
  • CSS 0.1%
Find a file
Šarūnas Nejus 73605d541e
typing: add missing types to beets.importer (#6711)
- This change tightens typing across the importer pipeline, mainly in
`beets.importer.session`, `beets.importer.stages`,
`beets.importer.tasks`, `beets.importer.state`, and
`beets.util.pipeline`.

- Architecturally, it makes the importer's core flow more explicit:
  - session methods now declare clear input/output types
- pipeline stage message types are named and propagated through
`Pipeline`
  - task classes expose more precise return values and argument types
- plugin event dispatch for `import_task_created` now has a typed
contract

- A small but important part of the change is switching importer config
handling to work with `confuse` views more safely, using `.set(...)` and
`.get(...)` instead of replacing values directly. This keeps config
mutation aligned with the config system instead of treating it like a
plain dict.

- There are also a few correctness-oriented fixes uncovered while adding
types, such as:
- keeping byte/string path handling consistent in importer task cleanup
and archive extraction
  - making nullable values explicit before use
  - returning `None` in places that already behaved that way implicitly

- High-level impact: no feature change to importer behavior is intended.
The main benefit is a clearer, more strongly typed importer architecture
that is easier to reason about, safer to refactor, and better at
catching edge cases during development.
2026-06-17 22:55:23 +01:00
.github Enable lyrics tests 2026-06-13 01:46:44 +01:00
beets Stricten ImportTask.album dirs type 2026-06-17 21:45:38 +01:00
beetsplug Add missing types to importer 2026-06-17 21:42:42 +01:00
docs Add a note to the changelog 2026-06-17 16:14:35 +01:00
extra Enable and fix flake8-builtins 2026-06-09 00:14:06 +01:00
test Fix test which falsely returned a single import_task_created task 2026-06-17 21:45:38 +01:00
.git-blame-ignore-revs Add commits to git-blame-ignore-revs 2026-06-17 21:45:36 +01:00
.gitignore fix transaction context manager signature 2025-10-19 15:07:17 +02:00
.pre-commit-config.yaml Configure docstrfmt 2025-08-10 16:25:04 +01:00
.readthedocs.yaml Fix path typo 2023-09-22 15:29:39 -04:00
CODE_OF_CONDUCT.rst Fix redirect URLs 2026-03-06 11:28:29 +00:00
codecov.yml Make cov setup a bit more useful and upgrade cov upload action 2025-08-09 15:11:59 +01:00
CONTRIBUTING.rst Show how to install extra dependencies 2026-05-02 02:47:02 +01:00
LICENSE Update copyright dates to 2016 2015-12-30 15:42:06 +00:00
poetry.lock Update poetry.lock 2026-05-22 20:27:17 +01:00
pyproject.toml Enable and fix flake8-builtins 2026-06-09 00:14:06 +01:00
README.rst Fix redirect URLs 2026-03-06 11:28:29 +00:00
README_kr.rst Fix redirect URLs 2026-03-06 11:28:29 +00:00
SECURITY.md Create security policy 2021-12-22 09:34:41 -08:00
setup.cfg Enable bpd plugin coverage 2026-06-04 12:57:19 +01:00

.. image:: https://img.shields.io/pypi/v/beets.svg
    :target: https://pypi.python.org/pypi/beets

.. image:: https://img.shields.io/codecov/c/github/beetbox/beets.svg
    :target: https://app.codecov.io/github/beetbox/beets

.. image:: https://img.shields.io/github/actions/workflow/status/beetbox/beets/ci.yaml
    :target: https://github.com/beetbox/beets/actions

.. image:: https://repology.org/badge/tiny-repos/beets.svg
    :target: https://repology.org/project/beets/versions

beets
=====

Beets is the media library management system for obsessive music geeks.

The purpose of beets is to get your music collection right once and for all. It
catalogs your collection, automatically improving its metadata as it goes. It
then provides a suite of tools for manipulating and accessing your music.

Here's an example of beets' brainy tag corrector doing its thing:

::

    $ beet import ~/music/ladytron
    Tagging:
        Ladytron - Witching Hour
    (Similarity: 98.4%)
     * Last One Standing      -> The Last One Standing
     * Beauty                 -> Beauty*2
     * White Light Generation -> Whitelightgenerator
     * All the Way            -> All the Way...

Because beets is designed as a library, it can do almost anything you can
imagine for your music collection. Via plugins_, beets becomes a panacea:

- Fetch or calculate all the metadata you could possibly need: `album art`_,
  lyrics_, genres_, tempos_, ReplayGain_ levels, or `acoustic fingerprints`_.
- Get metadata from MusicBrainz_, Discogs_, and Beatport_. Or guess metadata
  using songs' filenames or their acoustic fingerprints.
- `Transcode audio`_ to any format you like.
- Check your library for `duplicate tracks and albums`_ or for `albums that are
  missing tracks`_.
- Clean up crufty tags left behind by other, less-awesome tools.
- Embed and extract album art from files' metadata.
- Browse your music library graphically through a Web browser and play it in any
  browser that supports `HTML5 Audio`_.
- Analyze music files' metadata from the command line.
- Listen to your library with a music player that speaks the MPD_ protocol and
  works with a staggering variety of interfaces.

If beets doesn't do what you want yet, `writing your own plugin`_ is shockingly
simple if you know a little Python.

.. _acoustic fingerprints: https://beets.readthedocs.org/page/plugins/chroma.html

.. _album art: https://beets.readthedocs.org/page/plugins/fetchart.html

.. _albums that are missing tracks: https://beets.readthedocs.org/page/plugins/missing.html

.. _beatport: https://www.beatport.com

.. _discogs: https://www.discogs.com/

.. _duplicate tracks and albums: https://beets.readthedocs.org/page/plugins/duplicates.html

.. _genres: https://beets.readthedocs.org/page/plugins/lastgenre.html

.. _html5 audio: https://html.spec.whatwg.org/multipage/media.html#the-audio-element

.. _lyrics: https://beets.readthedocs.org/page/plugins/lyrics.html

.. _mpd: https://www.musicpd.org/

.. _musicbrainz: https://musicbrainz.org/

.. _musicbrainz music collection: https://musicbrainz.org/doc/Collections/

.. _plugins: https://beets.readthedocs.org/page/plugins/

.. _replaygain: https://beets.readthedocs.org/page/plugins/replaygain.html

.. _tempos: https://beets.readthedocs.org/page/plugins/acousticbrainz.html

.. _transcode audio: https://beets.readthedocs.org/page/plugins/convert.html

.. _writing your own plugin: https://beets.readthedocs.org/page/dev/plugins/index.html

Install
-------

You can install beets by typing ``pip install beets`` or directly from Github
(see details here_). Beets has also been packaged in the `software
repositories`_ of several distributions. Check out the `Getting Started`_ guide
for more information.

.. _getting started: https://beets.readthedocs.org/page/guides/main.html

.. _here: https://beets.readthedocs.io/en/latest/faq.html#run-the-latest-source-version-of-beets

.. _software repositories: https://repology.org/project/beets/versions

Contribute
----------

Thank you for considering contributing to ``beets``! Whether you're a programmer
or not, you should be able to find all the info you need at CONTRIBUTING.rst_.

.. _contributing.rst: https://github.com/beetbox/beets/blob/master/CONTRIBUTING.rst

Read More
---------

Learn more about beets at `its Web site`_. Follow `@b33ts`_ on Mastodon for news
and updates.

.. _@b33ts: https://fosstodon.org/@beets

.. _its web site: https://beets.io/

Contact
-------

- Encountered a bug you'd like to report? Check out our `issue tracker`_!

  - If your issue hasn't already been reported, please `open a new ticket`_ and
    we'll be in touch with you shortly.
  - If you'd like to vote on a feature/bug, simply give a :+1: on issues you'd
    like to see prioritized over others.
  - Need help/support, would like to start a discussion, have an idea for a new
    feature, or would just like to introduce yourself to the team? Check out
    `GitHub Discussions`_!

.. _github discussions: https://github.com/beetbox/beets/discussions

.. _issue tracker: https://github.com/beetbox/beets/issues

.. _open a new ticket: https://github.com/beetbox/beets/issues/new/choose

Authors
-------

Beets is by `Adrian Sampson`_ with a supporting cast of thousands.

.. _adrian sampson: https://www.cs.cornell.edu/~asampson/