Skip to content

Commit 2125f19

Browse files
committed
fix: migrate to uv
1 parent 89a5520 commit 2125f19

20 files changed

+787
-1194
lines changed

.github/workflows/cd.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ jobs:
2323
python-version: "3.10"
2424
- name: Install dependencies
2525
run: |
26-
pip install poetry
27-
- name: Setup poetry
26+
pip install uv
27+
- name: Setup uv
2828
run: |
29-
poetry config virtualenvs.in-project true
30-
poetry install
29+
uv venv
30+
uv sync
3131
- name: Build package
3232
run: |
33-
poetry build
33+
uv build
3434
- name: Upload package
3535
uses: pypa/gh-action-pypi-publish@release/v1
3636
with:

.github/workflows/ci.yaml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,26 @@ jobs:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install dependencies
2626
run: |
27-
pip install -U poetry
28-
- name: Setup poetry
27+
pip install -U uv
28+
- name: Setup uv
2929
run: |
30-
poetry config virtualenvs.in-project true
31-
poetry install
30+
uv venv
31+
uv sync
3232
- name: Run lint
3333
if: always()
3434
run: |
35-
poetry run yamllint --version
36-
poetry run yamllint . -s
37-
poetry run mdformat --version
38-
poetry run mdformat .
39-
poetry run black --version
40-
poetry run black $MODULE_NAME tests
41-
poetry run ruff --version
42-
poetry run ruff check $MODULE_NAME tests
43-
poetry run mypy --version
44-
poetry run mypy $MODULE_NAME tests
35+
uv run yamllint --version
36+
uv run yamllint . -s
37+
uv run mdformat --version
38+
uv run mdformat .
39+
uv run ruff --version
40+
uv run ruff check $MODULE_NAME tests --fix
41+
uv run ruff format $MODULE_NAME tests
42+
uv run mypy --version
43+
uv run mypy $MODULE_NAME tests
4544
- name: Run tests
4645
run: |
47-
poetry run pytest --cov=$MODULE_NAME --cov-report=xml --cov-fail-under=$MIN_TEST_COV tests/unit
46+
uv run pytest --cov=$MODULE_NAME --cov-report=xml --cov-fail-under=$MIN_TEST_COV tests/unit
4847
# - name: Upload coverage to Codecov
4948
# uses: codecov/codecov-action@v2
5049
# with:

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"python.languageServer": "Pylance",
2+
"python.languageServer": "None",
33
"editor.formatOnSave": true,
44
"mypy.runUsingActiveInterpreter": true,
55
"python.analysis.autoImportCompletions": true,

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Build stage
22
FROM python:3.11-slim AS builder
33

4-
# Install poetry
5-
RUN pip install poetry
4+
# Install uv
5+
RUN pip install uv
66

77
WORKDIR /app
88

99
# Copy the entire project
1010
COPY . .
1111

12-
# Configure poetry to create the virtualenv inside the project directory
13-
RUN poetry config virtualenvs.in-project true
12+
# Configure uv to create the virtualenv inside the project directory
13+
RUN uv venv
1414

1515
# Install dependencies without installing the project itself
16-
RUN poetry install --no-root --no-interaction --no-ansi
16+
RUN uv sync
1717

1818
# Runtime stage
1919
FROM python:3.11-slim

Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
.PHONY: all python-poetry python-dependencies git-hooks-init
1+
.PHONY: all python-uv python-dependencies git-hooks-init
22

3-
all: python-poetry python-dependencies git-hooks-init
3+
all: python-uv python-dependencies git-hooks-init
44
echo "---- Your working directory is all set :) ----"
55

6-
python-poetry:
7-
@echo "---- Installing Python Poetry ----"
6+
python-uv:
7+
@echo "---- Installing Python UV ----"
88
pip install -U pip
9-
pip install -U poetry
10-
poetry config virtualenvs.in-project true
11-
poetry config virtualenvs.path ".venv"
9+
pip install -U uv
10+
uv venv
11+
uv config virtualenvs.in-project true
12+
uv config virtualenvs.path ".venv"
1213

13-
python-dependencies: python-poetry
14+
python-dependencies: python-uv
1415
@echo "---- Installing Python dependencies ----"
15-
poetry install
16-
poetry self add poetry-plugin-sembump
16+
uv sync
1717

1818
git-hooks-init:
1919
@echo "---- Git hooks init (using Gookme) ----"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ In order to use the workflows, you need to have the following environment variab
3232
### Bump all dependencies
3333

3434
```python
35-
poetry update
35+
uv sync
3636
```

app/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
"""Entry point of the CLI version.
44
5-
Called from poetry.
5+
Called from uv.
66
"""
77

88
from .main import main

hooks/commit-msg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"steps": [{
33
"name": "Lint commit message",
4-
"command": "poetry run gitlint --msg-filename $1"
4+
"command": "uv run gitlint --msg-filename $1"
55
}]
66
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
if [ -z "$@" ];
4+
then
5+
echo "$(git --no-pager diff --cached --name-only --relative --diff-filter=AMCRTUXB | perl -nle'print if m{.py$}')";
6+
else
7+
for f in $(git --no-pager diff --cached --name-only --relative --diff-filter=AMCRTUXB | perl -nle'print if m{.py$}');
8+
do
9+
if test -f "$f";
10+
then
11+
$@ $f
12+
fi
13+
done
14+
fi

hooks/pre-commit.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
{
22
"steps": [
33
{
4-
"from": "py-mypy"
5-
},
6-
{
7-
"from": "py-pytest"
8-
},
9-
{
4+
"name": "Python: Ruff Lint",
105
"from": "py-ruff-lint"
116
},
127
{
8+
"name": "Python: Ruff Format",
139
"from": "py-ruff-format"
1410
},
1511
{
12+
"name": "Python: Yamllint Remediations",
1613
"from": "py-yamllint"
1714
},
1815
{
16+
"name": "Python: MDFormat Docs",
1917
"from": "py-mdformat"
2018
},
2119
{
20+
"name": "Python: disallow TypedDict",
2221
"from": "py-typeddict"
2322
}
2423
]

0 commit comments

Comments
 (0)