From 69dc06dff763b051199deeab6abc086efe1d9b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= Date: Mon, 29 Sep 2025 11:38:13 +0100 Subject: [PATCH] Make musicbrainzngs dependency optional and requests required --- .github/workflows/ci.yaml | 4 ++-- docs/plugins/listenbrainz.rst | 9 ++++----- docs/plugins/mbcollection.rst | 15 ++++++++++++--- docs/plugins/missing.rst | 15 ++++++++++++--- docs/plugins/parentwork.rst | 11 +++++++++-- poetry.lock | 16 ++++++++++------ pyproject.toml | 8 ++++++-- 7 files changed, 55 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fa6e9a7be..3db70c7d3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -58,7 +58,7 @@ jobs: - if: ${{ env.IS_MAIN_PYTHON != 'true' }} name: Test without coverage run: | - poetry install --without=lint --extras=autobpm --extras=lyrics --extras=replaygain --extras=reflink --extras=fetchart --extras=chroma --extras=sonosupdate + poetry install --without=lint --extras=autobpm --extras=lyrics --extras=replaygain --extras=reflink --extras=fetchart --extras=chroma --extras=sonosupdate --extras=parentwork poe test - if: ${{ env.IS_MAIN_PYTHON == 'true' }} @@ -66,7 +66,7 @@ jobs: env: LYRICS_UPDATED: ${{ steps.lyrics-update.outputs.any_changed }} run: | - poetry install --extras=autobpm --extras=lyrics --extras=docs --extras=replaygain --extras=reflink --extras=fetchart --extras=chroma --extras=sonosupdate + poetry install --extras=autobpm --extras=lyrics --extras=docs --extras=replaygain --extras=reflink --extras=fetchart --extras=chroma --extras=sonosupdate --extras=parentwork poe docs poe test-with-coverage diff --git a/docs/plugins/listenbrainz.rst b/docs/plugins/listenbrainz.rst index 21629ab54..17926e878 100644 --- a/docs/plugins/listenbrainz.rst +++ b/docs/plugins/listenbrainz.rst @@ -9,13 +9,12 @@ service. Installation ------------ -To enable the ListenBrainz plugin, add the following to your beets configuration -file (config.yaml_): +To use the ``listenbrainz`` plugin, first enable it in your configuration (see +:ref:`using-plugins`). Then, install ``beets`` with ``listenbrainz`` extra -.. code-block:: yaml +.. code-block:: bash - plugins: - - listenbrainz + pip install "beets[listenbrainz]" You can then configure the plugin by providing your Listenbrainz token (see intructions here_) and username: diff --git a/docs/plugins/mbcollection.rst b/docs/plugins/mbcollection.rst index 87efcd6d5..ffa86f330 100644 --- a/docs/plugins/mbcollection.rst +++ b/docs/plugins/mbcollection.rst @@ -6,9 +6,18 @@ maintain your `music collection`_ list there. .. _music collection: https://musicbrainz.org/doc/Collections -To begin, just enable the ``mbcollection`` plugin in your configuration (see -:ref:`using-plugins`). Then, add your MusicBrainz username and password to your -:doc:`configuration file ` under a ``musicbrainz`` section: +Installation +------------ + +To use the ``mbcollection`` plugin, first enable it in your configuration (see +:ref:`using-plugins`). Then, install ``beets`` with ``mbcollection`` extra + +.. code-block:: bash + + pip install "beets[mbcollection]" + +Then, add your MusicBrainz username and password to your :doc:`configuration +file ` under a ``musicbrainz`` section: :: diff --git a/docs/plugins/missing.rst b/docs/plugins/missing.rst index 10842933c..f6962f337 100644 --- a/docs/plugins/missing.rst +++ b/docs/plugins/missing.rst @@ -5,12 +5,21 @@ This plugin adds a new command, ``missing`` or ``miss``, which finds and lists missing tracks for albums in your collection. Each album requires one network call to album data source. +Installation +------------ + +To use the ``missing`` plugin, first enable it in your configuration (see +:ref:`using-plugins`). Then, install ``beets`` with ``missing`` extra + +.. code-block:: bash + + pip install "beets[missing]" + Usage ----- -Add the ``missing`` plugin to your configuration (see :ref:`using-plugins`). The -``beet missing`` command fetches album information from the origin data source -and lists names of the **tracks** that are missing from your library. +The ``beet missing`` command fetches album information from the origin data +source and lists names of the **tracks** that are missing from your library. It can also list the names of missing **albums** for each artist, although this is limited to albums from the MusicBrainz data source only. diff --git a/docs/plugins/parentwork.rst b/docs/plugins/parentwork.rst index 50c2c1ff0..e015bed68 100644 --- a/docs/plugins/parentwork.rst +++ b/docs/plugins/parentwork.rst @@ -38,8 +38,15 @@ This plugin adds seven tags: to keep track of recordings whose works have changed. - **parentwork_date**: The composition date of the parent work. -To use the ``parentwork`` plugin, enable it in your configuration (see -:ref:`using-plugins`). +Installation +------------ + +To use the ``parentwork`` plugin, first enable it in your configuration (see +:ref:`using-plugins`). Then, install ``beets`` with ``parentwork`` extra + +.. code-block:: bash + + pip install "beets[parentwork]" Configuration ------------- diff --git a/poetry.lock b/poetry.lock index cb87e5f49..c7e5ff016 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1641,7 +1641,7 @@ type = ["mypy", "mypy-extensions"] name = "musicbrainzngs" version = "0.7.1" description = "Python bindings for the MusicBrainz NGS and the Cover Art Archive webservices" -optional = false +optional = true python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" files = [ {file = "musicbrainzngs-0.7.1-py2.py3-none-any.whl", hash = "sha256:e841a8f975104c0a72290b09f59326050194081a5ae62ee512f41915090e1a10"}, @@ -2844,13 +2844,13 @@ files = [ [[package]] name = "requests" -version = "2.32.4" +version = "2.32.5" description = "Python HTTP for Humans." optional = false -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "requests-2.32.4-py3-none-any.whl", hash = "sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c"}, - {file = "requests-2.32.4.tar.gz", hash = "sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422"}, + {file = "requests-2.32.5-py3-none-any.whl", hash = "sha256:2462f94637a34fd532264295e186976db0f5d453d1cdd31473c85a6a161affb6"}, + {file = "requests-2.32.5.tar.gz", hash = "sha256:dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf"}, ] [package.dependencies] @@ -3702,9 +3702,13 @@ import = ["py7zr", "rarfile"] kodiupdate = ["requests"] lastgenre = ["pylast"] lastimport = ["pylast"] +listenbrainz = ["musicbrainzngs"] lyrics = ["beautifulsoup4", "langdetect", "requests"] +mbcollection = ["musicbrainzngs"] metasync = ["dbus-python"] +missing = ["musicbrainzngs"] mpdstats = ["python-mpd2"] +parentwork = ["musicbrainzngs"] plexupdate = ["requests"] reflink = ["reflink"] replaygain = ["PyGObject"] @@ -3716,4 +3720,4 @@ web = ["flask", "flask-cors"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4" -content-hash = "2a77524f06c0a8feecc47a0ac64faf7e2f170d1c99329130bfc5af48691178b2" +content-hash = "2e624f891327526aa76af30a2126260e392b553fb213bafadc8fac445aaab99b" diff --git a/pyproject.toml b/pyproject.toml index 703d3d613..097d3d42c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,10 +48,10 @@ confuse = ">=1.5.0" jellyfish = "*" lap = ">=0.5.12" mediafile = ">=0.12.0" -musicbrainzngs = ">=0.4" numpy = ">=1.24.4" platformdirs = ">=3.5.0" pyyaml = "*" +requests = ">=2.32.5" requests-ratelimiter = ">=0.7.0" typing_extensions = "*" unidecode = ">=1.3.6" @@ -62,6 +62,7 @@ flask = { version = "*", optional = true } flask-cors = { version = "*", optional = true } langdetect = { version = "*", optional = true } librosa = { version = "^0.10.2.post1", optional = true } +musicbrainzngs = { version = ">=0.4", optional = true } mutagen = { version = ">=1.33", optional = true } Pillow = { version = "*", optional = true } py7zr = { version = "*", optional = true } @@ -73,7 +74,6 @@ python3-discogs-client = { version = ">=2.3.15", optional = true } pyxdg = { version = "*", optional = true } rarfile = { version = "*", optional = true } reflink = { version = "*", optional = true } -requests = { version = "*", optional = true } resampy = { version = ">=0.4.3", optional = true } requests-oauthlib = { version = ">=0.6.1", optional = true } soco = { version = "*", optional = true } @@ -152,9 +152,13 @@ import = ["py7zr", "rarfile"] kodiupdate = ["requests"] lastgenre = ["pylast"] lastimport = ["pylast"] +listenbrainz = ["musicbrainzngs"] lyrics = ["beautifulsoup4", "langdetect", "requests"] +mbcollection = ["musicbrainzngs"] metasync = ["dbus-python"] +missing = ["musicbrainzngs"] mpdstats = ["python-mpd2"] +parentwork = ["musicbrainzngs"] plexupdate = ["requests"] reflink = ["reflink"] replaygain = [