Skip to content

Commit 12d2388

Browse files
committed
ci,pkg: poetry -> uv (#479)
# 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 4756a41 commit 12d2388

File tree

12 files changed

+1445
-1668
lines changed

12 files changed

+1445
-1668
lines changed

.github/workflows/docs.yml

+8-9
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,30 @@ jobs:
2727
python_files:
2828
- 'libvcs/**'
2929
- pyproject.toml
30-
- poetry.lock
30+
- uv.lock
3131
3232
- name: Should publish
3333
if: steps.changes.outputs.docs == 'true' || steps.changes.outputs.root_docs == 'true' || steps.changes.outputs.python_files == 'true'
3434
run: echo "PUBLISH=$(echo true)" >> $GITHUB_ENV
3535

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

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

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

5150
- name: Build documentation
5251
if: env.PUBLISH == 'true'
5352
run: |
54-
pushd docs; make SPHINXBUILD='poetry run sphinx-build' html; popd
53+
pushd docs; make SPHINXBUILD='uv run sphinx-build' html; popd
5554
5655
- name: Push documentation to S3
5756
if: env.PUBLISH == 'true'

.github/workflows/tests.yml

+17-21
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,33 @@ jobs:
1919
python-version: ['3.9', '3.13']
2020
steps:
2121
- uses: actions/checkout@v4
22-
- name: Install poetry
23-
run: pipx install "poetry==1.8.4"
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v3
24+
with:
25+
enable-cache: true
2426

2527
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v5
27-
with:
28-
python-version: ${{ matrix.python-version }}
29-
cache: 'poetry'
28+
run: uv python install ${{ matrix.python-version }}
3029

3130
- name: Install dependencies
32-
run: poetry install --with=docs,test,coverage,lint
31+
run: uv sync --all-extras --dev
3332

3433
- name: Lint with ruff check
35-
run: poetry run ruff check .
34+
run: uv run ruff check .
3635

3736
- name: Format with ruff
38-
run: poetry run ruff format . --check
37+
run: uv run ruff format . --check
3938

4039
- name: Lint with mypy
41-
run: poetry run mypy .
40+
run: uv run mypy .
4241

4342
- name: Print python versions
4443
run: |
4544
python -V
46-
poetry run python -V
45+
uv run python -V
4746
4847
- name: Test with pytest
49-
run: poetry run py.test --cov=./ --cov-append --cov-report=xml
48+
run: uv run py.test --cov=./ --cov-append --cov-report=xml
5049
env:
5150
COV_CORE_SOURCE: .
5251
COV_CORE_CONFIG: .coveragerc
@@ -67,21 +66,18 @@ jobs:
6766
steps:
6867
- uses: actions/checkout@v4
6968

70-
- name: Install poetry
71-
run: pipx install "poetry==1.8.4"
69+
- name: Install uv
70+
uses: astral-sh/setup-uv@v3
71+
with:
72+
enable-cache: true
7273

7374
- name: Set up Python ${{ matrix.python-version }}
74-
uses: actions/setup-python@v5
75-
with:
76-
python-version: ${{ matrix.python-version }}
77-
cache: 'poetry'
75+
run: uv python install ${{ matrix.python-version }}
7876

7977
- name: Build package
80-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
81-
run: poetry build
78+
run: uv build
8279

8380
- name: Publish package
84-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
8581
uses: pypa/gh-action-pypi-publish@release/v1
8682
with:
8783
user: __token__

.tmuxp.yaml

+4-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
session_name: libvcs
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: libvcs
57
focus: True
68
layout: main-horizontal
79
options:
8-
main-pane-height: 35
10+
main-pane-height: 67%
911
panes:
1012
- focus: true
11-
- pane
12-
- make watch_mypy
13-
- make start
14-
- window_name: docs
15-
layout: main-horizontal
16-
options:
17-
main-pane-height: 35
18-
start_directory: docs/
19-
panes:
20-
- focus: true
21-
- pane
13+
- pane
2214
- pane
2315
- make start

.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 3.7.17

CHANGES

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ $ pip install --user --upgrade --pre libvcs
1515

1616
<!-- Maintainers, insert changes / features for the next release here -->
1717

18+
### Development
19+
20+
#### Project and package management: poetry to uv (#479)
21+
22+
[uv] is the new package and project manager for the project, replacing Poetry.
23+
24+
[uv]: https://github.com/astral-sh/uv
25+
1826
## libvcs 0.33.0 (2024-10-13)
1927

2028
### New features

Makefile

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

1515
test:
16-
poetry run py.test $(test)
16+
uv run py.test $(test)
1717

1818
start:
19-
$(MAKE) test; poetry run ptw .
19+
$(MAKE) test; uv run ptw .
2020

2121
watch_test:
2222
if command -v entr > /dev/null; then ${ALL_FILES} | entr -c $(MAKE) test; else $(MAKE) test entr_warn; fi
@@ -34,16 +34,16 @@ design_docs:
3434
$(MAKE) -C docs design
3535

3636
ruff_format:
37-
poetry run ruff format .
37+
uv run ruff format .
3838

3939
ruff:
40-
poetry run ruff .
40+
uv run ruff .
4141

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

4545
mypy:
46-
poetry run mypy `${PY_FILES}`
46+
uv run mypy `${PY_FILES}`
4747

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

5454
monkeytype_create:
55-
poetry run monkeytype run `poetry run which py.test`
55+
uv run monkeytype run `uv run which py.test`
5656

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

docs/Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ WATCH_FILES= find .. -type f -not -path '*/\.*' | grep -i '.*[.]\(rst\|md\)\$\|.
66

77
# You can set these variables from the command line.
88
SPHINXOPTS =
9-
SPHINXBUILD = poetry run sphinx-build
9+
SPHINXBUILD = uv run sphinx-build
1010
PAPER =
1111
BUILDDIR = _build
1212

@@ -173,16 +173,16 @@ serve:
173173
@echo 'docs server running at http://localhost:${HTTP_PORT}/'
174174
@echo
175175
@echo '=============================================================='
176-
poetry run python -m http.server ${HTTP_PORT} --directory _build/html
176+
uv run python -m http.server ${HTTP_PORT} --directory _build/html
177177

178178
dev:
179179
$(MAKE) -j watch serve
180180

181181
start:
182-
poetry run sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) --port ${HTTP_PORT} $(O)
182+
uv run sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) --port ${HTTP_PORT} $(O)
183183

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

docs/contributing/workflow.md

+17-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Development environment
66

7-
[poetry] is a required package to develop.
7+
[uv] is a required package to develop.
88

99
```console
1010
$ git clone https://github.com/vcs-python/libvcs.git
@@ -15,15 +15,15 @@ $ cd libvcs
1515
```
1616

1717
```console
18-
$ poetry install -E "docs test coverage lint"
18+
$ uv install -E "docs test coverage lint"
1919
```
2020

2121
Makefile commands prefixed with `watch_` will watch files and rerun.
2222

2323
## Tests
2424

2525
```console
26-
$ poetry run py.test
26+
$ uv run py.test
2727
```
2828

2929
Helpers: `make test` Rerun tests on file change: `make watch_test` (requires [entr(1)])
@@ -57,10 +57,10 @@ The project uses [ruff] to handle formatting, sorting imports and linting.
5757

5858
````{tab} Command
5959
60-
poetry:
60+
uv:
6161
6262
```console
63-
$ poetry run ruff
63+
$ uv run ruff
6464
```
6565
6666
If you setup manually:
@@ -91,10 +91,10 @@ requires [`entr(1)`].
9191

9292
````{tab} Fix files
9393
94-
poetry:
94+
uv:
9595
9696
```console
97-
$ poetry run ruff . --fix
97+
$ uv run ruff . --fix
9898
```
9999
100100
If you setup manually:
@@ -111,10 +111,10 @@ $ ruff . --fix
111111

112112
````{tab} Command
113113
114-
poetry:
114+
uv:
115115
116116
```console
117-
$ poetry run ruff format .
117+
$ uv run ruff format .
118118
```
119119
120120
If you setup manually:
@@ -139,10 +139,10 @@ $ make ruff_format
139139

140140
````{tab} Command
141141
142-
poetry:
142+
uv:
143143
144144
```console
145-
$ poetry run mypy .
145+
$ uv run mypy .
146146
```
147147
148148
If you setup manually:
@@ -176,10 +176,10 @@ requires [`entr(1)`].
176176

177177
````{tab} Command
178178
179-
poetry:
179+
uv:
180180
181181
```console
182-
$ poetry run mypy .
182+
$ uv run mypy .
183183
```
184184
185185
If you setup manually:
@@ -245,7 +245,7 @@ After `git push` and `git push --tags`, CI will automatically build and deploy t
245245

246246
### Releasing (manual)
247247

248-
As of 0.10, [poetry] handles virtualenv creation, package requirements, versioning, building, and
248+
As of 0.10, [uv] handles virtualenv creation, package requirements, versioning, building, and
249249
publishing. Therefore there is no setup.py or requirements files.
250250

251251
Update `__version__` in `__about__.py` and `pyproject.toml`::
@@ -254,10 +254,10 @@ Update `__version__` in `__about__.py` and `pyproject.toml`::
254254
git tag v0.1.1
255255
git push
256256
git push --tags
257-
poetry build
258-
poetry publish
257+
uv build
258+
uv publish
259259

260-
[poetry]: https://python-poetry.org/
260+
[uv]: https://github.com/astral-sh/uv
261261
[entr(1)]: http://eradman.com/entrproject/
262262
[`entr(1)`]: http://eradman.com/entrproject/
263263
[ruff format]: https://docs.astral.sh/ruff/formatter/

0 commit comments

Comments
 (0)