Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a2b3892
[DOP-28270] migrate from poetry to uv
TiGrib Sep 8, 2025
7a04a24
[DOP-28270] update dev-releaase workflow
TiGrib Sep 9, 2025
06dd41a
[DOP-28270] update dev-releaase workflow
TiGrib Sep 9, 2025
8db43dc
[DOP-28270] update dev-releaase workflow
TiGrib Sep 9, 2025
95ac76e
[DOP-28270] update dev-releaase workflow
TiGrib Sep 9, 2025
fed7b8e
[DOP-28270] add verbose output for dev-releaase workflow
TiGrib Sep 9, 2025
5e5c434
[DOP-28270] fix dynamic version for setuptools
TiGrib Sep 10, 2025
8598f14
[DOP-28270] build with uv
TiGrib Sep 10, 2025
325dde0
[DOP-28270] build with uv
TiGrib Sep 10, 2025
9b4176e
[DOP-28270] remove dependencie installing from release
TiGrib Sep 10, 2025
48f37e3
[DOP-28270] fix readthedocs yaml file
TiGrib Sep 10, 2025
0456a85
[DOP-28270] fix readthedocs yaml file
TiGrib Sep 10, 2025
56efd5d
[DOP-28270] fix readthedocs yaml file
TiGrib Sep 10, 2025
15ef5af
[DOP-28270] fix readthedocs yaml file
TiGrib Sep 10, 2025
5523ed3
[DOP-28270] fix readthedocs yaml file
TiGrib Sep 10, 2025
a2fcf29
[DOP-28270] fix readthedocs yaml file
TiGrib Sep 10, 2025
d6c9915
[DOP-28270] fix readthedocs yaml file
TiGrib Sep 10, 2025
a3d5a30
[DOP-28270] fix readthedocs yaml file
TiGrib Sep 10, 2025
f757228
[DOP-28270] fix readthedocs yaml file
TiGrib Sep 10, 2025
4a4b970
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 10, 2025
e2dda44
[DOP-28270] add sphinx-tabs
TiGrib Sep 10, 2025
c6a6977
[DOP-28270] change make venv command
TiGrib Sep 10, 2025
7af75d1
[DOP-28270] change make venv command
TiGrib Sep 10, 2025
04bfa1a
[DOP-28270] change make venv command
TiGrib Sep 10, 2025
e50e0d8
[DOP-28270] fix ci venv
TiGrib Sep 11, 2025
e0d989b
[DOP-28270] fix ci venv
TiGrib Sep 11, 2025
109ab68
[DOP-28270] up version
TiGrib Sep 11, 2025
56188c3
[DOP-28270] update dependencies
TiGrib Sep 11, 2025
e18aa95
[DOP-28270] fix venv command
TiGrib Sep 11, 2025
f21c1d9
[DOP-28270] add package-data
TiGrib Sep 11, 2025
fbc12f2
[DOP-28270] add package-data
TiGrib Sep 11, 2025
21a60bb
[DOP-28270] add package-data
TiGrib Sep 11, 2025
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
17 changes: 3 additions & 14 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,15 @@ jobs:
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-${{ hashFiles('**/poetry.lock') }}
- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Install dependencies
run: |
make venv

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

codeql:
name: CodeQL
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
wait-code-analysis:
name: Dev release package
runs-on: ubuntu-latest
if: github.repository == 'MobileTeleSystems/data-rentgen' # prevent running on forks
if: github.repository == 'MobileTeleSystems/data-rentgen' # prevent running on forks

environment:
name: test-pypi
Expand All @@ -32,29 +32,25 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v6
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@v6

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

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

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
28 changes: 6 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
release:
name: Release package
runs-on: ubuntu-latest
if: github.repository == 'MobileTeleSystems/data-rentgen' # prevent running on forks
if: github.repository == 'MobileTeleSystems/data-rentgen' # prevent running on forks

environment:
name: pypi
Expand All @@ -36,24 +36,8 @@ 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:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
make venv
- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Generate OpenAPI Schema
run: |
Expand All @@ -65,15 +49,15 @@ jobs:
sed -i "s#logo_wide_white_text.svg#logo_wide.svg#g" README.rst

- 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,consumer,postgres,gssapi --without dev,test,docs > sbom.cyclonedx.json
uv pip install cyclonedx-bom
cyclonedx-py uv sync --group server,consumer,postgres,gssapi > sbom.cyclonedx.json

- name: Get changelog
run: |
Expand Down
16 changes: 2 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,10 @@ jobs:
with:
python-version: ${{ env.DEFAULT_PYTHON }}

- name: Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-${{ hashFiles('**/poetry.lock') }}
- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
make venv

Expand Down
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,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.7.19
hooks:
- id: poetry-check
additional_dependencies:
- poetry
- id: poetry-lock
additional_dependencies:
- poetry
- id: uv-lock

- repo: local
hooks:
Expand Down
10 changes: 4 additions & 6 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ build:
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 --extras server --extras consumer --extras postgres --extras seed --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 --extra server --extra consumer --extra postgres --extra seed --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
8 changes: 4 additions & 4 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,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 @@ -334,8 +334,8 @@ Before making a release from the ``develop`` branch, follow these steps:

.. code:: bash

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

3. Change file with changelog to release version number

Expand Down Expand Up @@ -392,7 +392,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 > data_rentgen/VERSION

git add .
git commit -m "Bump version"
Expand Down
17 changes: 8 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ VERSION = develop
VIRTUAL_ENV ?= .venv
PYTHON = ${VIRTUAL_ENV}/bin/python
PIP = ${VIRTUAL_ENV}/bin/pip
POETRY = ${VIRTUAL_ENV}/bin/poetry
UV = ${VIRTUAL_ENV}/bin/uv
PYTEST = ${VIRTUAL_ENV}/bin/pytest
COVERAGE = ${VIRTUAL_ENV}/bin/coverage

Expand All @@ -30,17 +30,16 @@ help: ##@Help Show this help



venv: venv-init venv-install##@Env Init venv and install poetry dependencies
venv: venv-cleanup venv-install##@Env Init venv and install uv dependencies

venv-init: ##@Env Init venv
python -m venv ${VIRTUAL_ENV}
venv-cleanup: ##@Env Cleanup venv
@rm -rf .venv || true
python3.12 -m venv .venv
${PIP} install -U setuptools wheel pip
${PIP} install poetry poetry-bumpversion
${PIP} install uv

venv-install: ##@Env Install requirements to venv
${POETRY} config virtualenvs.create false
${POETRY} install --no-root --extras server --extras consumer --extras postgres --extras seed --with dev,test,docs $(ARGS)
${PIP} install --no-deps sphinx-plantuml
${UV} sync --inexact --frozen --all-extras --all-groups --no-extra gssapi $(ARGS)


db: db-start db-upgrade db-partitions ##@DB Prepare database (in docker)
Expand All @@ -67,7 +66,7 @@ db-cleanup-partitions-ci: ##@DB Clean partitions in CI
${PYTHON} -m data_rentgen.db.scripts.cleanup_partitions $(ARGS)

db-views: ##@DB Create views
${POETRY} run coverage run python -m data_rentgen.db.scripts.refresh_analytic_views $(ARGS)
${UV} run coverage run python -m data_rentgen.db.scripts.refresh_analytic_views $(ARGS)

db-seed: ##@DB Seed database with random data
${PYTHON} -m data_rentgen.db.scripts.seed $(ARGS)
Expand Down
1 change: 1 addition & 0 deletions data_rentgen/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.4.0
8 changes: 3 additions & 5 deletions data_rentgen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# SPDX-FileCopyrightText: 2024-2025 MTS PJSC
# SPDX-License-Identifier: Apache-2.0

# _raw_version could contain pre-release version, like 0.0.1dev123
# value is updated automatically by `poetry version ...` and poetry-bumpversion plugin
_raw_version = "0.4.0"
from pathlib import Path

VERSION_FILE = Path(__file__).parent / "VERSION"
# version always contain only release number like 0.0.1
__version__ = ".".join(_raw_version.split(".")[:3])

__version__ = VERSION_FILE.read_text().strip()
# version tuple always contains only integer parts, like (0, 0, 1)
__version_tuple__ = tuple(map(int, __version__.split("."))) # noqa: RUF048
18 changes: 6 additions & 12 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,18 @@ RUN apt-get update \
libkrb5-dev \
&& rm -rf /var/lib/apt/lists/* /var/cache/*

ENV POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1

RUN --mount=type=cache,target=/root/.cache/pip \
pip install poetry

COPY ./pyproject.toml ./poetry.lock* ./
RUN --mount=type=cache,target=/root/.cache/pypoetry \
poetry install \
--no-root \
--all-extras \
--without dev,test,docs \
&& python -m compileall -j 4 .venv
pip install uv

COPY ./pyproject.toml ./uv.lock ./
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-install-project --all-extras \
&& python -m compileall -j 4 .venv

FROM base AS prod

# We don't need poetry and compilers in final image
# We don't need uv and compilers in final image
COPY --from=builder /app/.venv/ /app/.venv/
COPY ./data_rentgen/ /app/data_rentgen/
RUN python -m compileall data_rentgen
Expand Down
8 changes: 5 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@
#
# The short X.Y version.

# this value is updated automatically by `poetry version ...` and poetry-bumpversion plugin
ver = Version.parse("0.4.0")
version = ver.base_version
VERSION_FILE = PROJECT_ROOT_DIR / "data_rentgen" / "VERSION"
ver = Version.parse(VERSION_FILE.read_text())

# The full version, including alpha/beta/rc tags.
version = ver.base_version
# Release version
release = ver.public

# -- General configuration ---------------------------------------------------
Expand Down
Loading
Loading