Skip to content
Merged
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
21 changes: 6 additions & 15 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,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-
- 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 @@ -59,5 +50,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
19 changes: 5 additions & 14 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,16 @@ jobs:
# this step is needed for successful installation of "bonsai" library in python dependencies
run: sudo apt-get update && sudo apt-get install -y libldap2-dev libsasl2-dev

- 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 docs,test
export UV=$(which uv)
make venv-install

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

codeql:
name: CodeQL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,19 @@ 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
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/horizon/$GITHUB_SHA/docs/#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
5 changes: 1 addition & 4 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,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 horizon/VERSION)" >> $GITHUB_ENV

- name: Docker meta
id: meta
Expand Down
30 changes: 12 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,42 +36,36 @@ jobs:
# this step is needed for successful installation of "bonsai" library in python dependencies
run: sudo apt-get update && sudo apt-get install -y libldap2-dev libsasl2-dev

- 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-${{ env.DEFAULT_PYTHON }}-release-
${{ runner.os }}-python-
- name: Install uv
uses: astral-sh/setup-uv@v7

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

- name: Generate OpenAPI Schema
run: |
source .env.local
poetry run python -m horizon.backend.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/horizon/$GITHUB_SHA/docs/#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 backend,postgres,ldap --without dev,test,docs > sbom.cyclonedx.json
uv pip install cyclonedx-bom
uv export --extra backend --extra postgres --extra ldap --format requirements.txt | uv run cyclonedx-py requirements - > sbom.cyclonedx.json

- name: Get changelog
run: |
Expand Down
45 changes: 14 additions & 31 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

env:
DEFAULT_PYTHON: '3.13'
MIN_COVERAGE: 93
MIN_COVERAGE: 92

permissions:
contents: write
Expand All @@ -37,8 +37,6 @@ jobs:
- python-version: '3.13'
pydantic-version: '2'
os: ubuntu-latest
env:
POETRY_VERSION: ${{ matrix.python-version == '3.7' && '1.5.1' || '2.0.1' }}

steps:
- name: Checkout code
Expand Down Expand Up @@ -79,32 +77,21 @@ jobs:
# this step is needed for successful installation of "bonsai" library in python dependencies
run: sudo apt-get update && sudo apt-get install -y libldap2-dev libsasl2-dev

- name: Install poetry
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-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version }}-test-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-python-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version }}-test-${{ hashFiles('**/poetry.lock') }}
${{ runner.os }}-python-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version }}-test-
${{ runner.os }}-python-${{ matrix.python-version }}-pydantic-${{ matrix.pydantic-version }}-
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Install dependencies
run: |
poetry install --no-root --all-extras --with test --without dev,docs
export UV=$(which uv)
make venv-install
if [ "${{ matrix.pydantic-version }}" == "1" ]; then
poetry run pip install "pydantic<2.0.0"
uv run pip install "pydantic<2.0.0"
fi

- name: Run Tests
run: |
source .env.local
poetry run coverage run -m pytest
uv run coverage run -m pytest

- name: Dump backend logs on failure
if: failure()
Expand Down Expand Up @@ -149,17 +136,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 raw coverage data
uses: actions/download-artifact@v7
Expand All @@ -169,8 +152,8 @@ jobs:

- name: Combine Coverage Data
run: |
coverage combine coverage-data/*
coverage xml -o combined_coverage.xml
uv run coverage combine coverage-data/*
uv run coverage xml -o combined_coverage.xml

- name: Coverage comment
id: coverage
Expand Down
12 changes: 3 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-merge-conflict
- id: debug-statements
Expand Down Expand Up @@ -80,15 +79,10 @@ repos:
additional_dependencies:
- tomli

- 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: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.10
Expand Down
11 changes: 5 additions & 6 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ build:
jobs:
post_checkout:
- git fetch --unshallow || true

post_create_environment:
- python -m pip install poetry
- 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
- UV_PROJECT_ENVIRONMENT=$READTHEDOCS_VIRTUALENV_PATH uv sync --no-install-project --all-extras --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 @@ -60,7 +60,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 @@ -346,7 +346,7 @@ Before making a release from the ``develop`` branch, follow these steps:

.. code:: bash

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

3. Change file with changelog to release version number
Expand Down Expand Up @@ -404,7 +404,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 > horizon/VERSION

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