Skip to content

Commit a44232b

Browse files
committed
ci,pkg: poetry -> uv (#457)
# Changes ## ci,pkg: poetry -> uv uv: - https://pypi.org/project/uv/ - https://github.com/astral-sh/uv - https://docs.astral.sh/uv poetry: - https://pypi.org/project/poetry/ - https://github.com/python-poetry/poetry - https://python-poetry.org/ # Commands ``` uv sync --all-extras --dev ```
1 parent f57314b commit a44232b

File tree

12 files changed

+1544
-1704
lines changed

12 files changed

+1544
-1704
lines changed

.github/workflows/docs.yml

+10-11
Original file line numberDiff line numberDiff line change
@@ -28,37 +28,36 @@ jobs:
2828
python_files:
2929
- 'vcspull/**'
3030
- pyproject.toml
31-
- poetry.lock
31+
- uv.lock
3232
3333
- name: Should publish
3434
if: steps.changes.outputs.docs == 'true' || steps.changes.outputs.root_docs == 'true' || steps.changes.outputs.python_files == 'true'
3535
run: echo "PUBLISH=$(echo true)" >> $GITHUB_ENV
3636

37-
- name: Install poetry
37+
- name: Install uv
38+
uses: astral-sh/setup-uv@v3
3839
if: env.PUBLISH == 'true'
39-
run: pipx install "poetry==1.8.4"
40+
with:
41+
enable-cache: true
4042

4143
- name: Set up Python ${{ matrix.python-version }}
4244
if: env.PUBLISH == 'true'
43-
uses: actions/setup-python@v5
44-
with:
45-
python-version: ${{ matrix.python-version }}
46-
cache: 'poetry'
45+
run: uv python install ${{ matrix.python-version }}
4746

48-
- name: Install dependencies [w/ docs]
47+
- name: Install dependencies
4948
if: env.PUBLISH == 'true'
50-
run: poetry install --with=docs,lint
49+
run: uv sync --all-extras --dev
5150

5251
- name: Print python versions
5352
if: env.PUBLISH == 'true'
5453
run: |
5554
python -V
56-
poetry run python -V
55+
uv run python -V
5756
5857
- name: Build documentation
5958
if: env.PUBLISH == 'true'
6059
run: |
61-
pushd docs; make SPHINXBUILD='poetry run sphinx-build' html; popd
60+
pushd docs; make SPHINXBUILD='uv run sphinx-build' html; popd
6261
6362
- name: Push documentation to S3
6463
if: env.PUBLISH == 'true'

.github/workflows/tests.yml

+20-19
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,33 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v4
1515

16-
- name: Install poetry
17-
run: pipx install "poetry==1.8.4"
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v3
18+
with:
19+
enable-cache: true
1820

1921
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v5
21-
with:
22-
python-version: ${{ matrix.python-version }}
23-
cache: 'poetry'
22+
run: uv python install ${{ matrix.python-version }}
2423

2524
- name: Install dependencies
26-
run: poetry install --with=docs,test,coverage,lint
25+
run: uv sync --all-extras --dev
2726

2827
- name: Print python versions
2928
run: |
3029
python -V
31-
poetry run python -V
30+
uv run python -V
3231
3332
- name: Lint with ruff check
34-
run: poetry run ruff check .
33+
run: uv run ruff check .
3534

3635
- name: Format with ruff format
37-
run: poetry run ruff format . --check
36+
run: uv run ruff format . --check
3837

3938
- name: Lint with mypy
40-
run: poetry run mypy .
39+
run: uv run mypy .
4140

4241
- name: Test with pytest
43-
run: poetry run py.test --cov=./ --cov-append --cov-report=xml
42+
run: uv run py.test --cov=./ --cov-append --cov-report=xml
4443
env:
4544
COV_CORE_SOURCE: .
4645
COV_CORE_CONFIG: pyproject.toml
@@ -62,18 +61,20 @@ jobs:
6261
steps:
6362
- uses: actions/checkout@v4
6463

65-
- name: Install poetry
66-
run: pipx install "poetry==1.8.4"
64+
- name: Install uv
65+
uses: astral-sh/setup-uv@v3
66+
with:
67+
enable-cache: true
6768

6869
- name: Set up Python ${{ matrix.python-version }}
69-
uses: actions/setup-python@v5
70-
with:
71-
python-version: ${{ matrix.python-version }}
72-
cache: 'poetry'
70+
run: uv python install ${{ matrix.python-version }}
71+
72+
- name: Install dependencies
73+
run: uv sync --all-extras --dev
7374

7475
- name: Build package
7576
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
76-
run: poetry build
77+
run: uv build
7778

7879
- name: Publish package
7980
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

.tmuxp.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
session_name: vcspull
22
start_directory: ./ # load session relative to config location (project root).
3+
shell_command_before:
4+
- uv virtualenv --quiet > /dev/null 2>&1 && clear
35
windows:
46
- window_name: vcspull
57
focus: True

.tool-versions

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
poetry 1.8.4
1+
uv 0.5.4
22
python 3.13.0 3.12.7 3.11.10 3.10.15 3.9.20 3.8.20

CHANGES

+10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ $ pipx install --suffix=@next 'vcspull' --pip-args '\--pre' --force
2121

2222
<!-- Maintainers, insert changes / features for the next release here -->
2323

24+
_Maintenance only, no bug fixes, or new features_
25+
26+
### Development
27+
28+
#### Project and package management: poetry to uv (#457)
29+
30+
[uv] is the new package and project manager for the project, replacing Poetry.
31+
32+
[uv]: https://github.com/astral-sh/uv
33+
2434
#### libvcs 0.33.0 -> 0.34.0 (#456)
2535

2636
First libvcs release built with `uv` package and project manager. No changes to libvcs API itself.

Makefile

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ entr_warn:
1212
@echo "----------------------------------------------------------"
1313

1414
test:
15-
poetry run py.test $(test)
15+
uv run py.test $(test)
1616

1717
start:
18-
$(MAKE) test; poetry run ptw .
18+
$(MAKE) test; uv run ptw .
1919

2020
watch_test:
2121
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) test; else $(MAKE) test entr_warn; fi
@@ -30,16 +30,16 @@ design_docs:
3030
$(MAKE) -C docs design
3131

3232
ruff_format:
33-
poetry run ruff format .
33+
uv run ruff format .
3434

3535
ruff:
36-
poetry run ruff check .
36+
uv run ruff check .
3737

3838
watch_ruff:
3939
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) ruff; else $(MAKE) ruff entr_warn; fi
4040

4141
mypy:
42-
poetry run mypy `${PY_FILES}`
42+
uv run mypy `${PY_FILES}`
4343

4444
watch_mypy:
4545
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) mypy; else $(MAKE) mypy entr_warn; fi
@@ -48,7 +48,7 @@ format_markdown:
4848
prettier --parser=markdown -w *.md docs/*.md docs/**/*.md CHANGES
4949

5050
monkeytype_create:
51-
poetry run monkeytype run `poetry run which py.test`
51+
uv run monkeytype run `uv run which py.test`
5252

5353
monkeytype_apply:
54-
poetry run monkeytype list-modules | xargs -n1 -I{} sh -c 'poetry run monkeytype apply {}'
54+
uv run monkeytype list-modules | xargs -n1 -I{} sh -c 'uv run monkeytype apply {}'

docs/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ dev:
182182
$(MAKE) -j watch serve
183183

184184
start:
185-
poetry run sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) --port ${HTTP_PORT} $(O)
185+
uv run sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) --port ${HTTP_PORT} $(O)
186186

187187
design:
188188
# This adds additional watch directories (for _static file changes) and disable incremental builds
189-
poetry run sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) --port ${HTTP_PORT} --watch "." -a $(O)
189+
uv run sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) --port ${HTTP_PORT} --watch "." -a $(O)

docs/developing.md

+19-18
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ structure and workflow. At a later point these will refer to that website for do
77

88
## Bootstrap the project
99

10-
Install and [git] and [poetry]
10+
Install and [git] and [uv]
1111

1212
Clone:
1313

@@ -22,10 +22,10 @@ $ cd vcspull
2222
Install packages:
2323

2424
```console
25-
$ poetry install -E "docs test coverage lint"
25+
$ uv sync --all-extras --dev
2626
```
2727

28-
[installation documentation]: https://python-poetry.org/docs/#installation
28+
[installation documentation]: https://docs.astral.sh/uv/getting-started/installation/
2929
[git]: https://git-scm.com/
3030

3131
## Development loop
@@ -55,7 +55,7 @@ $ make watch_test
5555
#### Manual (just the command, please)
5656

5757
```console
58-
$ poetry run py.test
58+
$ uv run py.test
5959
```
6060

6161
or:
@@ -169,16 +169,16 @@ The project uses [ruff] to handle formatting, sorting imports and linting.
169169

170170
````{tab} Command
171171
172-
poetry:
172+
uv:
173173
174174
```console
175-
$ poetry run ruff
175+
$ uv run ruff check .
176176
```
177177
178178
If you setup manually:
179179
180180
```console
181-
$ ruff .
181+
$ ruff check .
182182
```
183183
184184
````
@@ -203,16 +203,16 @@ requires [`entr(1)`].
203203

204204
````{tab} Fix files
205205
206-
poetry:
206+
uv:
207207
208208
```console
209-
$ poetry run ruff . --fix
209+
$ uv run ruff check . --fix
210210
```
211211
212212
If you setup manually:
213213
214214
```console
215-
$ ruff . --fix
215+
$ ruff check . --fix
216216
```
217217
218218
````
@@ -223,10 +223,10 @@ $ ruff . --fix
223223

224224
````{tab} Command
225225
226-
poetry:
226+
uv:
227227
228228
```console
229-
$ poetry run ruff format .
229+
$ uv run ruff format .
230230
```
231231
232232
If you setup manually:
@@ -251,10 +251,10 @@ $ make ruff_format
251251

252252
````{tab} Command
253253
254-
poetry:
254+
uv:
255255
256256
```console
257-
$ poetry run mypy .
257+
$ uv run mypy .
258258
```
259259
260260
If you setup manually:
@@ -297,7 +297,7 @@ See `[tool.mypy]` in pyproject.toml.
297297

298298
## Publishing to PyPI
299299

300-
[poetry] handles virtualenv creation, package requirements, versioning,
300+
[uv] handles virtualenv creation, package requirements, versioning,
301301
building, and publishing. Therefore there is no setup.py or requirements files.
302302

303303
Update `__version__` in `__about__.py` and `pyproject.toml`::
@@ -306,10 +306,11 @@ Update `__version__` in `__about__.py` and `pyproject.toml`::
306306
git tag v0.1.1
307307
git push
308308
git push --tags
309-
poetry build
310-
poetry publish
311309

312-
[poetry]: https://python-poetry.org/
310+
GitHub Actions will detect the new git tag, and in its own workflow run `uv
311+
build` and push to PyPI.
312+
313+
[uv]: https://github.com/astral-sh/uv
313314
[entr(1)]: http://eradman.com/entrproject/
314315
[`entr(1)`]: http://eradman.com/entrproject/
315316
[ruff format]: https://docs.astral.sh/ruff/formatter/

0 commit comments

Comments
 (0)