From 041d4b803689fde0ccc96d1d8c4c43ee9fc48afb 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 | 8 ++++++-- pyproject.toml | 10 +++++++--- 7 files changed, 52 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bfd05c718..520a368ef 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -66,7 +66,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' }} @@ -74,7 +74,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 46bf443ca..8e489b4ed 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1838,7 +1838,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"}, @@ -4207,9 +4207,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"] @@ -4222,4 +4226,4 @@ web = ["flask", "flask-cors"] [metadata] lock-version = "2.0" python-versions = ">=3.10,<4" -content-hash = "1b69db4cdc3908316b2e18a5620916aa55235ded58b275c4433819ffa4ed660b" +content-hash = "8cf2ad0e6a842511e1215720a63bfdf9d5f49345410644cbb0b5fd8fb74f50d2" diff --git a/pyproject.toml b/pyproject.toml index 7fd1cadba..24cf21b33 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,13 +48,13 @@ confuse = ">=2.1.0" jellyfish = "*" lap = ">=0.5.12" mediafile = ">=0.12.0" -musicbrainzngs = ">=0.4" numpy = [ { python = "<3.13", version = ">=2.0.2" }, { python = ">=3.13", version = ">=2.3.4" }, ] platformdirs = ">=3.5.0" pyyaml = "*" +requests = ">=2.32.5" requests-ratelimiter = ">=0.7.0" typing_extensions = "*" unidecode = ">=1.3.6" @@ -69,6 +69,7 @@ scipy = [ # for librosa { python = "<3.13", version = ">=1.13.1", optional = true }, { python = ">=3.13", version = ">=1.16.1", optional = true }, ] +musicbrainzngs = { version = ">=0.4", optional = true } numba = [ # for librosa { python = "<3.13", version = ">=0.60", optional = true }, { python = ">=3.13", version = ">=0.62.1", optional = true }, @@ -84,7 +85,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 } @@ -94,7 +94,7 @@ pydata-sphinx-theme = { version = "*", optional = true } sphinx = { version = "*", optional = true } sphinx-design = { version = ">=0.6.1", optional = true } sphinx-copybutton = { version = ">=0.5.2", optional = true } -titlecase = {version = "^2.4.1", optional = true} +titlecase = { version = "^2.4.1", optional = true } [tool.poetry.group.test.dependencies] beautifulsoup4 = "*" @@ -165,9 +165,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 = [