Skip to content

Commit f8832fd

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

23 files changed

+3326
-4836
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: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,13 @@ 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+
export UV=$(which uv)
42+
make venv-install
5343
5444
- name: Check changelog entry exists
5545
run: |
@@ -63,5 +53,5 @@ jobs:
6353
# Fetch the pull request' base branch so towncrier will be able to
6454
# compare the current branch with the base branch.
6555
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
56+
uv run towncrier check --compare-with origin/${{ github.base_ref }}
57+
uv run towncrier --draft

.github/workflows/codeql-analysis.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,19 @@ 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+
export UV=$(which uv)
56+
make venv-install
6657
6758
- name: Run flake8
68-
run: poetry run flake8 syncmaster/
59+
run: uv run flake8 syncmaster/
6960

7061
- name: Run mypy
71-
run: poetry run mypy --config-file ./pyproject.toml ./syncmaster/server
62+
run: uv run mypy --config-file ./pyproject.toml ./syncmaster/server
7263

7364
codeql:
7465
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: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,41 +36,37 @@ 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+
export UV=$(which uv)
45+
make venv-install
5446
5547
- name: Generate OpenAPI Schema
5648
run: |
57-
poetry run python -m syncmaster.server.scripts.export_openapi_schema docs/_static/openapi.json
49+
make docs-openapi
5850
5951
- name: Fix logo in Readme
6052
run: |
6153
sed -i "s#image:: docs/#image:: https://raw.githubusercontent.com/MobileTeleSystems/syncmaster/$GITHUB_SHA/docs/#g" README.rst
6254
sed -i "s#logo_wide_red_text.svg#logo_wide.svg#g" README.rst
6355
56+
- name: Patch version template
57+
# Due to change above, git stage area is dirty, so we need to patch the template
58+
run: sed -i 's#dirty_template = ".*"#dirty_template = "{tag}"#' pyproject.toml
59+
6460
- name: Build package
65-
run: poetry build
61+
run: uv build
6662

6763
- name: Publish package
6864
uses: pypa/gh-action-pypi-publish@release/v1
6965

7066
- name: Generate SBOM
7167
run: |
72-
pip install cyclonedx-bom
73-
cyclonedx-py poetry --extras server,scheduler,worker --without dev,test,docs > sbom.cyclonedx.json
68+
uv pip install cyclonedx-bom
69+
uv export --all-extras --format requirements.txt | uv run cyclonedx-py requirements - > sbom.cyclonedx.json
7470
7571
- name: Get changelog
7672
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/tests.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,13 @@ jobs:
112112
with:
113113
python-version: ${{ env.DEFAULT_PYTHON }}
114114

115-
- name: Cache pip
116-
uses: actions/cache@v5
117-
with:
118-
path: ~/.cache/pip
119-
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-coverage
120-
121-
- name: Upgrade pip
122-
run: python -m pip install --upgrade pip setuptools wheel
115+
- name: Install uv
116+
uses: astral-sh/setup-uv@v7
123117

124118
- name: Install dependencies
125-
run: pip install -I coverage pytest
119+
run: |
120+
export UV=$(which uv)
121+
make venv-install
126122
127123
- name: Download all coverage reports
128124
uses: actions/download-artifact@v7
@@ -133,8 +129,8 @@ jobs:
133129

134130
- name: Generate coverage reports
135131
run: |
136-
coverage combine
137-
coverage xml -o reports/coverage.xml -i
132+
uv run coverage combine
133+
uv run coverage xml -o reports/coverage.xml -i
138134
139135
- name: Coverage comment
140136
id: coverage

.github/workflows/unit-test.yml

Lines changed: 5 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,13 @@ 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+
export UV=$(which uv)
45+
make venv-install
6046
6147
- name: Start docker compose
6248
run: |
@@ -66,7 +52,7 @@ jobs:
6652
- name: Run Unit Tests
6753
run: |
6854
source .env.local.test
69-
poetry run coverage run -m pytest -vvv -s -k "test_unit or test_database"
55+
uv run coverage run -m pytest -vvv -s -k "test_unit or test_database"
7056
7157
- name: Dump worker logs on failure
7258
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

0 commit comments

Comments
 (0)