Skip to content

Commit de4c2fd

Browse files
committed
Switch from poetry to uv
1 parent 4dc2345 commit de4c2fd

22 files changed

+3308
-4815
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ updates:
1313
github-actions:
1414
patterns:
1515
- '*'
16-
- package-ecosystem: pip
16+
- package-ecosystem: uv
1717
directory: /
1818
schedule:
1919
interval: weekly

.github/workflows/changelog.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,12 @@ jobs:
3333
with:
3434
python-version: ${{ env.DEFAULT_PYTHON }}
3535

36-
- name: Install poetry
37-
uses: snok/install-poetry@v1
38-
39-
- name: Cache poetry
40-
uses: actions/cache@v5
41-
with:
42-
path: ~/.cache/pypoetry
43-
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-changelog-${{ hashFiles('**/poetry.lock') }}
44-
restore-keys: |
45-
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-changelog-${{ hashFiles('**/poetry.lock') }}
46-
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-changelog-
47-
${{ runner.os }}-python
48-
${{ runner.os }}-
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@v7
4938

5039
- name: Install dependencies
5140
run: |
52-
poetry install --no-root --with docs --without dev,test
41+
make venv
5342
5443
- name: Check changelog entry exists
5544
run: |
@@ -63,5 +52,5 @@ jobs:
6352
# Fetch the pull request' base branch so towncrier will be able to
6453
# compare the current branch with the base branch.
6554
git fetch --no-tags origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
66-
poetry run towncrier check --compare-with origin/${{ github.base_ref }}
67-
poetry run towncrier --draft
55+
uv run towncrier check --compare-with origin/${{ github.base_ref }}
56+
uv run towncrier --draft

.github/workflows/codeql-analysis.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,18 @@ jobs:
4747
libkrb5-dev \
4848
curl
4949
50-
- name: Install poetry
51-
uses: snok/install-poetry@v1
52-
53-
- name: Cache poetry
54-
uses: actions/cache@v5
55-
with:
56-
path: ~/.cache/pypoetry
57-
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-${{ hashFiles('**/poetry.lock') }}
58-
restore-keys: |
59-
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-${{ hashFiles('**/poetry.lock') }}
60-
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-
61-
${{ runner.os }}-python-
50+
- name: Install uv
51+
uses: astral-sh/setup-uv@v7
6252

6353
- name: Install dependencies
6454
run: |
65-
poetry install --no-root --all-extras --with dev --without test
55+
make venv
6656
6757
- name: Run flake8
68-
run: poetry run flake8 syncmaster/
58+
run: uv run flake8 syncmaster/
6959

7060
- name: Run mypy
71-
run: poetry run mypy --config-file ./pyproject.toml ./syncmaster/server
61+
run: uv run mypy --config-file ./pyproject.toml ./syncmaster/server
7262

7363
codeql:
7464
name: CodeQL

.github/workflows/dev-release.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,20 @@ jobs:
3434
with:
3535
python-version: ${{ env.DEFAULT_PYTHON }}
3636

37-
- name: Install poetry
38-
uses: snok/install-poetry@v1
39-
40-
- name: Generate unique version and update test version
41-
run: |
42-
poetry self add poetry-bumpversion
43-
poetry self install
44-
version=$(poetry version -s)
45-
poetry version "${version}.dev${GITHUB_RUN_ID}"
37+
- name: Install uv
38+
uses: astral-sh/setup-uv@v7
4639

4740
- name: Fix logo in Readme
4841
run: |
4942
sed -i "s#image:: docs/#image:: https://raw.githubusercontent.com/MobileTeleSystems/syncmaster/$GITHUB_SHA/docs/#g" README.rst
5043
sed -i "s#logo_wide_red_text.svg#logo_wide.svg#g" README.rst
5144
45+
- name: Patch version template
46+
# Due to change above, git stage area is dirty, so we need to patch the template
47+
run: sed -i 's#dirty_template = ".*"#dirty_template = "{tag}.dev{env:GITHUB_RUN_ID:{ccount}}"#' pyproject.toml
48+
5249
- name: Build package
53-
run: poetry build
50+
run: uv build
5451

5552
- name: Publish package
5653
uses: pypa/gh-action-pypi-publish@release/v1
Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,41 +36,36 @@ jobs:
3636
with:
3737
python-version: ${{ env.DEFAULT_PYTHON }}
3838

39-
- name: Install poetry
40-
uses: snok/install-poetry@v1
41-
42-
- name: Cache poetry
43-
uses: actions/cache@v5
44-
with:
45-
path: ~/.cache/pypoetry
46-
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-${{ hashFiles('**/poetry.lock') }}
47-
restore-keys: |
48-
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-${{ hashFiles('**/poetry.lock') }}
49-
${{ runner.os }}-python-
39+
- name: Install uv
40+
uses: astral-sh/setup-uv@v7
5041

5142
- name: Install dependencies
5243
run: |
53-
poetry install --no-root --all-extras --without test,dev,docs
44+
make venv
5445
5546
- name: Generate OpenAPI Schema
5647
run: |
57-
poetry run python -m syncmaster.server.scripts.export_openapi_schema docs/_static/openapi.json
48+
make docs-openapi
5849
5950
- name: Fix logo in Readme
6051
run: |
6152
sed -i "s#image:: docs/#image:: https://raw.githubusercontent.com/MobileTeleSystems/syncmaster/$GITHUB_SHA/docs/#g" README.rst
6253
sed -i "s#logo_wide_red_text.svg#logo_wide.svg#g" README.rst
6354
55+
- name: Patch version template
56+
# Due to change above, git stage area is dirty, so we need to patch the template
57+
run: sed -i 's#dirty_template = ".*"#dirty_template = "{tag}"#' pyproject.toml
58+
6459
- name: Build package
65-
run: poetry build
60+
run: uv build
6661

6762
- name: Publish package
6863
uses: pypa/gh-action-pypi-publish@release/v1
6964

7065
- name: Generate SBOM
7166
run: |
72-
pip install cyclonedx-bom
73-
cyclonedx-py poetry --extras server,scheduler,worker --without dev,test,docs > sbom.cyclonedx.json
67+
uv pip install cyclonedx-bom
68+
uv export --all-extras --format requirements.txt | uv run cyclonedx-py requirements - > sbom.cyclonedx.json
7469
7570
- name: Get changelog
7671
run: |

.github/workflows/scheduler_docker_image.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,10 @@ jobs:
4545
with:
4646
python-version: ${{ env.DEFAULT_PYTHON }}
4747

48-
- name: Install poetry
49-
uses: snok/install-poetry@v1
50-
5148
- name: Get version
5249
id: get_version
5350
run: |
54-
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
51+
echo "VERSION=$(cat syncmaster/VERSION)" >> $GITHUB_ENV
5552
5653
- name: Docker meta
5754
id: meta

.github/workflows/server_docker_image.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,10 @@ jobs:
4040
- name: Checkout code
4141
uses: actions/checkout@v6
4242

43-
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
44-
uses: actions/setup-python@v6
45-
with:
46-
python-version: ${{ env.DEFAULT_PYTHON }}
47-
48-
- name: Install poetry
49-
uses: snok/install-poetry@v1
50-
5143
- name: Get version
5244
id: get_version
5345
run: |
54-
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
46+
echo "VERSION=$(cat syncmaster/VERSION)" >> $GITHUB_ENV
5547
5648
- name: Docker meta
5749
id: meta

.github/workflows/unit-test.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ jobs:
1010
name: Run unit tests
1111
runs-on: ubuntu-latest
1212

13-
env:
14-
POETRY_VERSION: 2.1.2
15-
1613
steps:
1714
- name: Checkout code
1815
uses: actions/checkout@v6
@@ -39,24 +36,12 @@ jobs:
3936
libkrb5-dev \
4037
curl
4138
42-
- name: Install poetry ${{ env.POETRY_VERSION }}
43-
uses: snok/install-poetry@v1
44-
with:
45-
version: ${{ env.POETRY_VERSION }}
46-
47-
- name: Cache poetry
48-
uses: actions/cache@v5
49-
with:
50-
path: ~/.cache/pypoetry
51-
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-unit-${{ hashFiles('**/poetry.lock') }}
52-
restore-keys: |
53-
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-unit-${{ hashFiles('**/poetry.lock') }}
54-
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-unit-
55-
${{ runner.os }}-python-
39+
- name: Install uv
40+
uses: astral-sh/setup-uv@v7
5641

5742
- name: Install dependencies
5843
run: |
59-
poetry install --no-root --all-extras --with test
44+
make venv
6045
6146
- name: Start docker compose
6247
run: |
@@ -66,7 +51,7 @@ jobs:
6651
- name: Run Unit Tests
6752
run: |
6853
source .env.local.test
69-
poetry run coverage run -m pytest -vvv -s -k "test_unit or test_database"
54+
uv run coverage run -m pytest -vvv -s -k "test_unit or test_database"
7055
7156
- name: Dump worker logs on failure
7257
if: failure()

.github/workflows/worker_docker_image.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,10 @@ jobs:
4545
with:
4646
python-version: ${{ env.DEFAULT_PYTHON }}
4747

48-
- name: Install poetry
49-
uses: snok/install-poetry@v1
50-
5148
- name: Get version
5249
id: get_version
5350
run: |
54-
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
51+
echo "VERSION=$(cat syncmaster/VERSION)" >> $GITHUB_ENV
5552
5653
- name: Docker meta
5754
id: meta

.pre-commit-config.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,10 @@ repos:
124124
- id: pretty-format-yaml
125125
args: [--autofix, --indent, '2', --offset, '2']
126126

127-
- repo: https://github.com/sbrunner/hooks
128-
rev: 1.6.1
127+
- repo: https://github.com/astral-sh/uv-pre-commit
128+
rev: 0.9.18
129129
hooks:
130-
- id: poetry-check
131-
additional_dependencies:
132-
- poetry
133-
- id: poetry-lock
134-
additional_dependencies:
135-
- poetry
130+
- id: uv-lock
136131

137132
- repo: meta
138133
hooks:

0 commit comments

Comments
 (0)