Skip to content

Commit ca69e57

Browse files
committed
buiild: switch from poetry to uv
1 parent 08df368 commit ca69e57

8 files changed

Lines changed: 2927 additions & 2846 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ inputs:
55
python-version:
66
description: "Python version to install"
77
default: "3.12"
8-
poetry-version:
9-
description: "Poetry version to install"
10-
default: "2.2.1"
11-
cache:
12-
description: "Cache directory"
13-
default: "${{ runner.temp }}/cache"
148

159
runs:
1610
using: "composite"
@@ -22,39 +16,12 @@ runs:
2216
python-version: ${{ inputs.python-version }}
2317
update-environment: false
2418

25-
- name: "Set up Python 3.12 for Poetry"
26-
id: setup-poetry-python
27-
uses: actions/setup-python@v5
28-
with:
29-
python-version: 3.12
30-
31-
- name: "Set up dependency cache"
32-
uses: actions/cache@v4
33-
with:
34-
key: ${{ runner.os }}-${{ steps.setup-poetry-python.outputs.python-version }}-${{ steps.setup-python.outputs.python-version }}-${{ inputs.poetry-version }}-${{ hashFiles('poetry.lock') }}
35-
path: ${{ inputs.cache }}
36-
37-
- name: "Set up PATH on POSIX"
38-
if: ${{ runner.os != 'windows'}}
39-
shell: bash
40-
run: echo "${{ inputs.cache }}/tools/bin" >> $GITHUB_PATH
41-
42-
- name: "Set up PATH on Windows"
43-
if: ${{ runner.os == 'windows'}}
44-
shell: bash
45-
run: echo "${{ inputs.cache }}/tools/Scripts" >> $GITHUB_PATH
46-
47-
- name: "Install Poetry"
48-
shell: bash
49-
run: |
50-
if ! poetry --version; then
51-
"${{ steps.setup-poetry-python.outputs.python-path }}" -m venv "${{ inputs.cache }}/tools"
52-
pip install poetry==${{ inputs.poetry-version }}
53-
fi
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6
5421

5522
- name: "Install development dependencies"
5623
shell: bash
24+
env:
25+
python_path: ${{ steps.setup-python.outputs.python-path }}
5726
run: |
58-
poetry config cache-dir "${{ inputs.cache }}/poetry"
59-
poetry env use "${{ steps.setup-python.outputs.python-path }}"
60-
poetry sync --all-groups
27+
uv sync --all-groups --python "$python_path"

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ updates:
77
interval: "weekly"
88
day: "sunday"
99

10-
# Poetry dependencies
10+
# Python dependencies
1111
- package-ecosystem: "pip"
1212
directory: "/"
1313
schedule:

.github/workflows/ci.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ jobs:
2525
python-version: "3.7"
2626
- os: windows-latest
2727
python-version: "3.7"
28-
# TODO: re-enable macOS + Python 3.7 once off Poetry
29-
# - os: macos-15-intel
30-
# python-version: "3.7"
28+
- os: macos-15-intel
29+
python-version: "3.7"
3130

3231
steps:
3332
- name: "Check out repository"
@@ -39,7 +38,7 @@ jobs:
3938
python-version: ${{ matrix.python-version }}
4039

4140
- name: "Run tests"
42-
run: poetry run poe test-ci
41+
run: uv run poe test-ci
4342

4443
- name: "Upload coverage report"
4544
uses: codecov/codecov-action@v5
@@ -57,7 +56,7 @@ jobs:
5756
uses: ./.github/actions/setup
5857

5958
- name: "Check types, lints, and formatting"
60-
run: poetry run poe check-ci
59+
run: uv run poe check-ci
6160

6261
build-package:
6362
name: Build package
@@ -71,7 +70,7 @@ jobs:
7170
uses: ./.github/actions/setup
7271

7372
- name: "Build"
74-
run: poetry run poe build-package
73+
run: uv run poe build-package
7574

7675
- name: "Upload"
7776
uses: actions/upload-artifact@v6
@@ -91,7 +90,7 @@ jobs:
9190
uses: ./.github/actions/setup
9291

9392
- name: "Build"
94-
run: poetry run poe build-docs
93+
run: uv run poe build-docs
9594

9695
- name: "Upload"
9796
uses: actions/upload-pages-artifact@v4

CONTRIBUTING.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,43 @@ All contributions are greatly appreciated! Before contributing, please read the
44

55
## Development Setup
66

7-
This project uses [Poetry][] to manage dependencies and builds, and you will need to install it before working on Decoy.
7+
This project uses [uv][] to manage dependencies and builds, and you will need to install it before working on Decoy.
88

9-
Once Poetry is installed, you should be good to set up a virtual environment and install development dependencies. Python >=3.10 is recommended for development.
9+
Once `uv` is installed, you should be good to set up a virtual environment and install development dependencies. Python >=3.10 is recommended for development.
1010

1111
```bash
1212
git clone https://github.com/mcous/decoy.git
1313
cd decoy
14-
poetry install
14+
uv sync
1515
```
1616

1717
## Development Tasks
1818

1919
Decoy uses [poethepoet][] to manage development tasks. If you want to quickly check everything, run the following:
2020

2121
```shell
22-
poetry run poe all
22+
uv run poe all
2323
```
2424

25-
[poethepoet]: https://github.com/nat-n/poethepoet
26-
2725
### Tests
2826

2927
Decoy's tests are run using [pytest][]. To run tests in watch mode:
3028

3129
```bash
32-
poetry run poe test
30+
uv run poe test
3331
```
3432

3533
To run tests once and report coverage
3634

3735
```bash
38-
poetry run poe test-once
39-
poetry run poe coverage
36+
uv run poe test-once
37+
uv run poe coverage
4038
```
4139

4240
In an exciting twist, since version 1.6.0, Decoy's tests rely on Decoy itself to test (and more importantly, design) the relationships between Decoy's internal APIs. This means:
4341

44-
- Decoy's unit test suite serves as an end-to-end test of Decoy by virtue of existing (wow, very meta, actually kind of cool).
45-
- Changes that break a small part of Decoy may result in a large number of test failures, because if Decoy breaks it can't be used to test itself.
42+
- Decoy's unit test suite serves as an end-to-end test of Decoy by virtue of existing (wow, very meta, actually kind of cool).
43+
- Changes that break a small part of Decoy may result in a large number of test failures, because if Decoy breaks it can't be used to test itself.
4644

4745
If you find yourself in a situation where Decoy's test suite has blown up, **concentrate on getting the test suites that don't use Decoy to pass**. From there, lean on the type-checker to guide you to any components that aren't properly hooked up. Decoy also has a end-to-end smoke test suite (`tests/test_decoy.py`) that can be helpful in getting things back to green.
4846

@@ -51,17 +49,17 @@ If you find yourself in a situation where Decoy's test suite has blown up, **con
5149
Decoy's source code is typechecked with [mypy][] and linted/formatted with [ruff][].
5250

5351
```bash
54-
poetry run poe check
55-
poetry run poe lint
56-
poetry run poe format
52+
uv run poe check
53+
uv run poe lint
54+
uv run poe format
5755
```
5856

5957
### Documentation
6058

6159
Decoy's documentation is built with [mkdocs][], which you can use to preview the documentation site locally.
6260

6361
```bash
64-
poetry run docs
62+
uv run poe docs
6563
```
6664

6765
## Deploying
@@ -77,7 +75,7 @@ git pull
7775

7876
# bump the version
7977
# replace ${bump_version} with a bump specifier, like "minor"
80-
poetry version ${bump_version}
78+
uv version --bump ${bump_version}
8179

8280
# add the bumped pyproject.toml
8381
git add pyproject.toml
@@ -89,8 +87,9 @@ git tag -a v${release_version} -m "chore(release): ${release_version}"
8987
git push --follow-tags
9088
```
9189

90+
[uv]: https://docs.astral.sh/uv/
91+
[poethepoet]: https://github.com/nat-n/poethepoet
9292
[code of conduct]: https://github.com/mcous/decoy/blob/main/CODE_OF_CONDUCT.md
93-
[poetry]: https://python-poetry.org/
9493
[pytest]: https://docs.pytest.org/
9594
[pytest-xdist]: https://github.com/pytest-dev/pytest-xdist
9695
[mypy]: https://mypy.readthedocs.io

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,7 @@ Decoy mocks are **async/await** and **type-checking** friendly. Decoy is heavily
2222
## Install
2323

2424
```bash
25-
# pip
2625
pip install decoy
27-
28-
# poetry
29-
poetry add --dev decoy
30-
31-
# pipenv
32-
pipenv install --dev decoy
3326
```
3427

3528
## Setup

0 commit comments

Comments
 (0)