Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ updates:
github-actions:
patterns:
- '*'
- package-ecosystem: pip
- package-ecosystem: uv
directory: /
schedule:
interval: weekly
Expand Down
22 changes: 6 additions & 16 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,13 @@ jobs:
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Install poetry
uses: snok/install-poetry@v1

- name: Cache poetry
uses: actions/cache@v5
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-changelog-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-changelog-${{ hashFiles('**/poetry.lock') }}
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-changelog-
${{ runner.os }}-python
${{ runner.os }}-
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Install dependencies
run: |
poetry install --no-root --with docs --without dev,test
export UV=$(which uv)
make venv-install

- name: Check changelog entry exists
run: |
Expand All @@ -63,5 +53,5 @@ jobs:
# Fetch the pull request' base branch so towncrier will be able to
# compare the current branch with the base branch.
git fetch --no-tags origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
poetry run towncrier check --compare-with origin/${{ github.base_ref }}
poetry run towncrier --draft
uv run towncrier check --compare-with origin/${{ github.base_ref }}
uv run towncrier --draft
21 changes: 6 additions & 15 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,19 @@ jobs:
libkrb5-dev \
curl

- name: Install poetry
uses: snok/install-poetry@v1

- name: Cache poetry
uses: actions/cache@v5
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-${{ hashFiles('**/poetry.lock') }}
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-codeql-
${{ runner.os }}-python-
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Install dependencies
run: |
poetry install --no-root --all-extras --with dev --without test
export UV=$(which uv)
make venv-install

- name: Run flake8
run: poetry run flake8 syncmaster/
run: uv run flake8 syncmaster/

- name: Run mypy
run: poetry run mypy --config-file ./pyproject.toml ./syncmaster/server
run: uv run mypy --config-file ./pyproject.toml ./syncmaster/server

codeql:
name: CodeQL
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/dev-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,20 @@ jobs:
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Install poetry
uses: snok/install-poetry@v1

- name: Generate unique version and update test version
run: |
poetry self add poetry-bumpversion
poetry self install
version=$(poetry version -s)
poetry version "${version}.dev${GITHUB_RUN_ID}"
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Fix logo in Readme
run: |
sed -i "s#image:: docs/#image:: https://raw.githubusercontent.com/MobileTeleSystems/syncmaster/$GITHUB_SHA/docs/#g" README.rst
sed -i "s#logo_wide_red_text.svg#logo_wide.svg#g" README.rst
- name: Patch version template
# Due to change above, git stage area is dirty, so we need to patch the template
run: sed -i 's#dirty_template = ".*"#dirty_template = "{tag}.dev{env:GITHUB_RUN_ID:{ccount}}"#' pyproject.toml

- name: Build package
run: poetry build
run: uv build

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
28 changes: 12 additions & 16 deletions .github/workflows/release.yaml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,41 +36,37 @@ jobs:
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Install poetry
uses: snok/install-poetry@v1

- name: Cache poetry
uses: actions/cache@v5
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-release-${{ hashFiles('**/poetry.lock') }}
${{ runner.os }}-python-
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Install dependencies
run: |
poetry install --no-root --all-extras --without test,dev,docs
export UV=$(which uv)
make venv-install

- name: Generate OpenAPI Schema
run: |
poetry run python -m syncmaster.server.scripts.export_openapi_schema docs/_static/openapi.json
make docs-openapi

- name: Fix logo in Readme
run: |
sed -i "s#image:: docs/#image:: https://raw.githubusercontent.com/MobileTeleSystems/syncmaster/$GITHUB_SHA/docs/#g" README.rst
sed -i "s#logo_wide_red_text.svg#logo_wide.svg#g" README.rst

- name: Patch version template
# Due to change above, git stage area is dirty, so we need to patch the template
run: sed -i 's#dirty_template = ".*"#dirty_template = "{tag}"#' pyproject.toml

- name: Build package
run: poetry build
run: uv build

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

- name: Generate SBOM
run: |
pip install cyclonedx-bom
cyclonedx-py poetry --extras server,scheduler,worker --without dev,test,docs > sbom.cyclonedx.json
uv pip install cyclonedx-bom
uv export --all-extras --format requirements.txt | uv run cyclonedx-py requirements - > sbom.cyclonedx.json

- name: Get changelog
run: |
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/scheduler_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,10 @@ jobs:
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Install poetry
uses: snok/install-poetry@v1

- name: Get version
id: get_version
run: |
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
echo "VERSION=$(cat syncmaster/VERSION)" >> $GITHUB_ENV

- name: Docker meta
id: meta
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/server_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Install poetry
uses: snok/install-poetry@v1

- name: Get version
id: get_version
run: |
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
echo "VERSION=$(cat syncmaster/VERSION)" >> $GITHUB_ENV

- name: Docker meta
id: meta
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,13 @@ jobs:
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Cache pip
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-coverage

- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools wheel
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Install dependencies
run: pip install -I coverage pytest
run: |
export UV=$(which uv)
make venv-install

- name: Download all coverage reports
uses: actions/download-artifact@v7
Expand All @@ -133,8 +129,8 @@ jobs:

- name: Generate coverage reports
run: |
coverage combine
coverage xml -o reports/coverage.xml -i
uv run coverage combine
uv run coverage xml -o reports/coverage.xml -i

- name: Coverage comment
id: coverage
Expand Down
24 changes: 5 additions & 19 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ jobs:
name: Run unit tests
runs-on: ubuntu-latest

env:
POETRY_VERSION: 2.1.2

steps:
- name: Checkout code
uses: actions/checkout@v6
Expand All @@ -39,24 +36,13 @@ jobs:
libkrb5-dev \
curl

- name: Install poetry ${{ env.POETRY_VERSION }}
uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}

- name: Cache poetry
uses: actions/cache@v5
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-unit-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-unit-${{ hashFiles('**/poetry.lock') }}
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-tests-unit-
${{ runner.os }}-python-
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Install dependencies
run: |
poetry install --no-root --all-extras --with test
export UV=$(which uv)
make venv-install

- name: Start docker compose
run: |
Expand All @@ -66,7 +52,7 @@ jobs:
- name: Run Unit Tests
run: |
source .env.local.test
poetry run coverage run -m pytest -vvv -s -k "test_unit or test_database"
uv run coverage run -m pytest -vvv -s -k "test_unit or test_database"

- name: Dump worker logs on failure
if: failure()
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/worker_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,10 @@ jobs:
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Install poetry
uses: snok/install-poetry@v1

- name: Get version
id: get_version
run: |
echo "VERSION=$(poetry version --short)" >> $GITHUB_ENV
echo "VERSION=$(cat syncmaster/VERSION)" >> $GITHUB_ENV

- name: Docker meta
id: meta
Expand Down
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,10 @@ repos:
- id: pretty-format-yaml
args: [--autofix, --indent, '2', --offset, '2']

- repo: https://github.com/sbrunner/hooks
rev: 1.6.1
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.9.18
hooks:
- id: poetry-check
additional_dependencies:
- poetry
- id: poetry-lock
additional_dependencies:
- poetry
- id: uv-lock

- repo: meta
hooks:
Expand Down
11 changes: 4 additions & 7 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@ build:
os: ubuntu-22.04
apt_packages:
- make
- libkrb5-dev
tools:
python: '3.13'
jobs:
post_checkout:
- git fetch --unshallow || true
post_create_environment:
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m pip install poetry
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m pip install --no-deps sphinx-plantuml # remove after https://github.com/zqmillet/sphinx-plantuml/pull/4
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m poetry config virtualenvs.create false
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m poetry debug info
- UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH python -m pip install uv
post_install:
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m poetry install --no-root --all-extras --with docs --without dev,test
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m poetry show -v
# avoid instaling worker dependencies
- UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv sync --no-install-project --extra server --extra scheduler --group docs
- UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv pip install --no-deps sphinx-plantuml # remove after https://github.com/zqmillet/sphinx-plantuml/pull/4
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH python -m pip list -v
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH make docs-openapi

Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ If you already have venv, but need to install dependencies required for developm

make venv-install

We are using `poetry <https://python-poetry.org/docs/managing-dependencies/>`_ for managing dependencies and building the package.
We are using `uv https://docs.astral.sh/uv/`_ for managing dependencies and building the package.
It allows to keep development environment the same for all developers due to using lock file with fixed dependency versions.

There are *extra* dependencies (included into package as optional):
Expand Down Expand Up @@ -367,7 +367,7 @@ Before making a release from the ``develop`` branch, follow these steps:

.. code:: bash

VERSION=$(poetry version -s)
VERSION=$(cat syncmaster/VERSION)
towncrier build "--version=${VERSION}" --yes

3. Change file with changelog to release version number
Expand Down Expand Up @@ -425,7 +425,7 @@ Before making a release from the ``develop`` branch, follow these steps:
git checkout develop

NEXT_VERSION=$(echo "$VERSION" | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.)
poetry version "$NEXT_VERSION"
echo $NEXT_VERSION > syncmaster/VERSION

git add .
git commit -m "Bump version"
Expand Down
Loading