Skip to content

Commit c74913c

Browse files
committed
Replace poetry by uv
1 parent ff9f93e commit c74913c

10 files changed

Lines changed: 4470 additions & 209 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ jobs:
2828
- uses: actions/checkout@v5
2929
- name: Install Python tools
3030
uses: BrandonLWhite/pipx-install-action@v1.0.3
31-
- name: Setup Python with poetry caching
32-
# poetry cache requires poetry to already be installed, weirdly
33-
uses: actions/setup-python@v6
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v5
3433
with:
3534
python-version: ${{ matrix.python-version }}
36-
cache: poetry
3735

3836
- name: Install system dependencies on Windows
3937
if: matrix.platform == 'windows-latest'
@@ -72,15 +70,15 @@ jobs:
7270
- if: ${{ env.IS_MAIN_PYTHON != 'true' }}
7371
name: Test without coverage
7472
run: |
75-
poetry install --without=lint --extras=autobpm --extras=discogs --extras=lyrics --extras=replaygain --extras=reflink --extras=fetchart --extras=chroma --extras=sonosupdate
73+
uv sync --no-group lint --no-group typing --no-group release --extra autobpm --extra discogs --extra lyrics --extra replaygain --extra reflink --extra fetchart --extra chroma --extra sonosupdate
7674
poe test
7775
7876
- if: ${{ env.IS_MAIN_PYTHON == 'true' }}
7977
name: Test with coverage
8078
env:
8179
LYRICS_UPDATED: ${{ steps.lyrics-update.outputs.any_changed }}
8280
run: |
83-
poetry install --extras=autobpm --extras=discogs --extras=lyrics --extras=docs --extras=replaygain --extras=reflink --extras=fetchart --extras=chroma --extras=sonosupdate
81+
uv sync --no-group lint --no-group typing --no-group release --extra autobpm --extra discogs --extra lyrics --extra docs --extra replaygain --extra reflink --extra fetchart --extra chroma --extra sonosupdate
8482
poe docs
8583
poe test-with-coverage
8684

.github/workflows/integration_test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
- uses: actions/checkout@v5
1515
- name: Install Python tools
1616
uses: BrandonLWhite/pipx-install-action@v1.0.3
17-
- uses: actions/setup-python@v6
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v5
1819
with:
1920
python-version: ${{ env.PYTHON_VERSION }}
20-
cache: poetry
2121

2222
- name: Install dependencies
23-
run: poetry install
23+
run: uv sync
2424

2525
- name: Test
2626
env:

.github/workflows/lint.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ jobs:
3737
with:
3838
files: |
3939
**.py
40-
poetry.lock
40+
uv.lock
4141
4242
- name: Check changed python files
4343
id: changed-python-files
4444
env:
4545
CHANGED_PYTHON_FILES: ${{ steps.raw-changed-python-files.outputs.all_changed_files }}
4646
run: |
47-
if [[ " $CHANGED_PYTHON_FILES " == *" poetry.lock "* ]]; then
48-
# if poetry.lock is changed, we need to check everything
47+
if [[ " $CHANGED_PYTHON_FILES " == *" uv.lock "* ]]; then
48+
# if uv.lock is changed, we need to check everything
4949
CHANGED_PYTHON_FILES="."
5050
fi
5151
echo "all_changed_files=$CHANGED_PYTHON_FILES" >> "$GITHUB_OUTPUT"
@@ -59,13 +59,13 @@ jobs:
5959
- uses: actions/checkout@v5
6060
- name: Install Python tools
6161
uses: BrandonLWhite/pipx-install-action@v1.0.3
62-
- uses: actions/setup-python@v6
62+
- name: Install uv
63+
uses: astral-sh/setup-uv@v5
6364
with:
6465
python-version: ${{ env.PYTHON_VERSION }}
65-
cache: poetry
6666

6767
- name: Install dependencies
68-
run: poetry install --only=lint
68+
run: uv sync --only-group lint
6969

7070
- name: Check code formatting
7171
# the job output will contain colored diffs with what needs adjusting
@@ -80,13 +80,13 @@ jobs:
8080
- uses: actions/checkout@v5
8181
- name: Install Python tools
8282
uses: BrandonLWhite/pipx-install-action@v1.0.3
83-
- uses: actions/setup-python@v6
83+
- name: Install uv
84+
uses: astral-sh/setup-uv@v5
8485
with:
8586
python-version: ${{ env.PYTHON_VERSION }}
86-
cache: poetry
8787

8888
- name: Install dependencies
89-
run: poetry install --only=lint
89+
run: uv sync --only-group lint
9090

9191
- name: Lint code
9292
run: poe lint --output-format=github ${{ needs.changed-files.outputs.changed_python_files }}
@@ -100,13 +100,13 @@ jobs:
100100
- uses: actions/checkout@v5
101101
- name: Install Python tools
102102
uses: BrandonLWhite/pipx-install-action@v1.0.3
103-
- uses: actions/setup-python@v6
103+
- name: Install uv
104+
uses: astral-sh/setup-uv@v5
104105
with:
105106
python-version: ${{ env.PYTHON_VERSION }}
106-
cache: poetry
107107

108108
- name: Install dependencies
109-
run: poetry install --only=typing
109+
run: uv sync --only-group typing
110110

111111
- name: Type check code
112112
uses: liskin/gh-problem-matcher-wrap@v3
@@ -125,13 +125,13 @@ jobs:
125125
fetch-depth: 0 # needed to get the full git history for the changelog check
126126
- name: Install Python tools
127127
uses: BrandonLWhite/pipx-install-action@v1.0.3
128-
- uses: actions/setup-python@v6
128+
- name: Install uv
129+
uses: astral-sh/setup-uv@v5
129130
with:
130131
python-version: ${{ env.PYTHON_VERSION }}
131-
cache: poetry
132132

133133
- name: Install dependencies
134-
run: poetry install --extras=docs
134+
run: uv sync --no-dev --extra docs
135135

136136
- name: Add Sphinx problem matchers
137137
run: |

.github/workflows/make_release.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ jobs:
2020
- uses: actions/checkout@v5
2121
- name: Install Python tools
2222
uses: BrandonLWhite/pipx-install-action@v1.0.3
23-
- uses: actions/setup-python@v6
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v5
2425
with:
2526
python-version: ${{ env.PYTHON_VERSION }}
26-
cache: poetry
2727

2828
- name: Install dependencies
29-
run: poetry install --with=release --extras=docs
29+
run: uv sync --no-group test --no-group lint --no-group typing --extra docs
3030

3131
- name: Bump project version
3232
run: poe bump "${{ env.NEW_VERSION }}"
@@ -51,13 +51,13 @@ jobs:
5151

5252
- name: Install Python tools
5353
uses: BrandonLWhite/pipx-install-action@v1.0.3
54-
- uses: actions/setup-python@v6
54+
- name: Install uv
55+
uses: astral-sh/setup-uv@v5
5556
with:
5657
python-version: ${{ env.PYTHON_VERSION }}
57-
cache: poetry
5858

5959
- name: Install dependencies
60-
run: poetry install --with=release --extras=docs
60+
run: uv sync --no-group test --no-group lint --no-group typing --extra docs
6161

6262
- name: Install pandoc
6363
run: sudo apt update && sudo apt install pandoc -y

CONTRIBUTING.rst

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -65,71 +65,66 @@ Development Tools
6565

6666
In order to develop beets, you will need a few tools installed:
6767

68-
- poetry_ for packaging, virtual environment and dependency management
68+
- uv_ for packaging, virtual environment and dependency management
6969
- poethepoet_ to run tasks, such as linting, formatting, testing
7070

71-
Python community recommends using pipx_ to install stand-alone command-line
72-
applications such as above. pipx_ installs each application in an isolated
73-
virtual environment, where its dependencies will not interfere with your system
74-
and other CLI tools.
71+
Follow the `uv installation instructions
72+
<https://docs.astral.sh/uv/getting-started/installation/>`__ to install uv_.
7573

76-
If you do not have pipx_ installed in your system, follow `pipx installation
77-
instructions <https://pipx.pypa.io/stable/how-to/install-pipx/>`__ or
74+
poethepoet_ is a stand-alone CLI tool. The Python community recommends using
75+
pipx_ to install such tools in isolated environments so their dependencies don't
76+
interfere with your system. If you don't have pipx_ installed, follow the `pipx
77+
installation instructions <https://pipx.pypa.io/stable/how-to/install-pipx/>`__
78+
or run:
7879

7980
.. code-block:: sh
8081
8182
$ python3 -m pip install --user pipx
8283
83-
Install poetry_ and poethepoet_ using pipx_:
84+
Then install poethepoet_:
8485

8586
::
8687

87-
$ pipx install poetry poethepoet
88+
$ pipx install poethepoet
8889

8990
.. admonition:: Check ``tool.pipx-install`` section in ``pyproject.toml`` to see supported versions
9091

9192
.. code-block:: toml
9293
9394
[tool.pipx-install]
9495
poethepoet = ">=0.26"
95-
poetry = "<2"
9696
9797
.. _getting-the-source:
9898

9999
Getting the Source
100100
++++++++++++++++++
101101

102102
The easiest way to get started with the latest beets source is to clone the
103-
repository and install ``beets`` in a local virtual environment using poetry_.
103+
repository and install ``beets`` in a local virtual environment using uv_.
104104
This can be done with:
105105

106106
.. code-block:: bash
107107
108108
$ git clone https://github.com/beetbox/beets.git
109109
$ cd beets
110-
$ poetry install
110+
$ uv sync
111111
112-
This will install ``beets`` and all development dependencies into its own
113-
virtual environment in your ``$POETRY_CACHE_DIR``. See ``poetry install --help``
114-
for installation options, including installing ``extra`` dependencies for
115-
plugins.
112+
This will install ``beets`` and all development dependencies into a ``.venv``
113+
virtual environment. See ``uv sync --help`` for options, including installing
114+
``extra`` dependencies for plugins (e.g. ``uv sync --extra fetchart``).
116115

117-
In order to run something within this virtual environment, start the command
118-
with ``poetry run`` to them, for example ``poetry run pytest``.
119-
120-
On the other hand, it may get tedious to type ``poetry run`` before every
121-
command. Instead, you can activate the virtual environment in your shell with:
116+
To run commands within this virtual environment, either activate it:
122117

123118
::
124119

125-
$ poetry shell
120+
$ source .venv/bin/activate
121+
$ pytest
126122

127-
You should see ``(beets-py3.10)`` prefix in your shell prompt. Now you can run
128-
commands directly, for example:
123+
Or prefix commands with ``uv run``:
129124

130125
::
131126

132-
$ (beets-py3.10) pytest
127+
$ uv run pytest
133128

134129
Additionally, poethepoet_ task runner assists us with the most common
135130
operations. Formatting, linting, testing are defined as ``poe`` tasks in
@@ -351,7 +346,7 @@ Test Dependencies
351346
The tests have a few more dependencies than beets itself. (The additional
352347
dependencies consist of testing utilities and dependencies of non-default
353348
plugins exercised by the test suite.) The dependencies are listed under the
354-
``tool.poetry.group.test.dependencies`` section in pyproject.toml_.
349+
``test`` group in the ``dependency-groups`` section of pyproject.toml_.
355350

356351
Writing Tests
357352
~~~~~~~~~~~~~
@@ -412,7 +407,7 @@ beets also defines custom pytest markers in ``test/conftest.py``:
412407

413408
.. _poethepoet: https://poethepoet.natn.io/index.html
414409

415-
.. _poetry: https://python-poetry.org/docs/
410+
.. _uv: https://docs.astral.sh/uv/
416411

417412
.. _pyproject.toml: https://github.com/beetbox/beets/blob/master/pyproject.toml
418413

docs/dev/plugins/index.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,12 @@ and you're good to go!
7979
information, see for example pep-3119_.
8080
8181
.. [3] There are a variety of packaging tools available for python, for example
82-
you can use poetry_, setuptools_ or hatchling_.
82+
you can use setuptools_ or hatchling_.
8383
8484
.. _hatchling: https://hatch.pypa.io/latest/config/build/#build-system
8585

8686
.. _pep-3119: https://peps.python.org/pep-3119/#rationale
8787

88-
.. _poetry: https://python-poetry.org/docs/pyproject/#packages
89-
9088
.. _setuptools: https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#finding-simple-packages
9189

9290
.. _this article: https://realpython.com/python-namespace-package/#setting-up-some-namespace-packages

docs/faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ helpful to run on the "bleeding edge". To run the latest source:
152152
.. code-block:: shell
153153
154154
git clone https://github.com/beetbox/beets.git
155-
poetry install
155+
uv sync
156156
157157
This approach lets you decide where the source is stored, with any changes
158158
immediately reflected in your environment.

extra/release.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def validate_new_version(
208208
) -> Version:
209209
"""Validate the version is newer than the current one."""
210210
with PYPROJECT.open("rb") as f:
211-
current = parse(tomli.load(f)["tool"]["poetry"]["version"])
211+
current = parse(tomli.load(f)["project"]["version"])
212212

213213
if not value > current:
214214
msg = f"version must be newer than {current}"

0 commit comments

Comments
 (0)