Skip to content

Commit 3c7c5e4

Browse files
opportunity356Islam Alibekov
andauthored
Enhancements to pyproject (#123)
* refactor: extend pyproject.toml * refactor: migrating from setup.py to pyproject.toml only * refactor: unfreeze optional dependencies * ci: setup new workflow for checks using tox and uv * fix: fix genproto and release workflows * review fixes * ci: using conventional commits pre-commit hook * fix: fix release workflow --------- Co-authored-by: Islam Alibekov <[email protected]>
1 parent c5844ac commit 3c7c5e4

File tree

16 files changed

+1852
-1508
lines changed

16 files changed

+1852
-1508
lines changed

.github/workflows/checks.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Checks
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
check:
7+
name: Check ${{ matrix.env }} on Python ${{ matrix.python-version }}
8+
runs-on: ubuntu-latest
9+
10+
timeout-minutes: 10
11+
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
env:
16+
- "style"
17+
- "format"
18+
- "type"
19+
python-version:
20+
- "3.12"
21+
22+
steps:
23+
- name: Checkout sources
24+
uses: actions/checkout@v4
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v4
28+
with:
29+
# Install a specific version of uv.
30+
version: "0.5.8"
31+
enable-cache: true
32+
33+
- name: Install tox
34+
run: uv tool install --python-preference only-managed --python ${{ matrix.python-version }} tox --with tox-uv --with tox-gh
35+
36+
- name: Install Python ${{ matrix.python-version }}
37+
run: uv python install --python-preference only-managed ${{ matrix.python-version }}
38+
39+
- name: Run ${{ matrix.env }}
40+
run: make tox
41+
env:
42+
TOX_GH_MAJOR_MINOR: ${{ matrix.env }}

.github/workflows/genproto.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ jobs:
1717
with:
1818
token: ${{ secrets.YANDEX_CLOUD_BOT_TOKEN }}
1919

20+
- name: Install uv
21+
uses: astral-sh/setup-uv@v4
22+
with:
23+
# Install a specific version of uv.
24+
version: "0.5.8"
25+
enable-cache: true
26+
2027
- name: Set up Python
2128
uses: actions/setup-python@v5
2229
with:
@@ -29,7 +36,7 @@ jobs:
2936
make proto
3037
make deps
3138
make tox
32-
39+
3340
git config --global user.name 'Yandex.Cloud Bot'
3441
git config --global user.email '[email protected]'
3542
git add yandex cloudapi

.github/workflows/release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ jobs:
1919
with:
2020
fetch-depth: 0
2121

22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v4
24+
with:
25+
# Install a specific version of uv.
26+
version: "0.5.8"
27+
enable-cache: true
28+
2229
- name: Set up Python
2330
uses: actions/[email protected]
2431
with:
@@ -37,9 +44,9 @@ jobs:
3744
with:
3845
github_token: ${{ secrets.GITHUB_TOKEN }}
3946

40-
- name: Build python
47+
- name: Build yandexcloud
4148
run: |
42-
python3 setup.py sdist bdist_wheel
49+
make build
4350
4451
- name: Publish package distributions to PyPI
4552
uses: pypa/[email protected]

.github/workflows/run-tests.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Tests
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
test:
7+
name: Run tests with Python ${{ matrix.env }} on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
timeout-minutes: 10
10+
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
env:
15+
# uncomment when upgrade grpcio-tools, current version does not work with 3.13
16+
# - "3.13"
17+
- "3.12"
18+
- "3.11"
19+
- "3.10"
20+
- "3.9"
21+
os:
22+
- ubuntu-latest
23+
# - macos-latest
24+
25+
steps:
26+
- name: Checkout sources
27+
uses: actions/checkout@v4
28+
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v4
31+
with:
32+
# Install a specific version of uv.
33+
version: "0.5.8"
34+
enable-cache: true
35+
36+
- name: Install tox
37+
run: uv tool install --python-preference only-managed --python ${{ matrix.env }} tox --with tox-uv --with tox-gh
38+
39+
- name: Install Python
40+
run: uv python install --python-preference only-managed ${{ matrix.env }}
41+
42+
- name: Run test suite
43+
run: make tox
44+
env:
45+
TOX_GH_MAJOR_MINOR: ${{ matrix.env }}

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: "v5.0.0"
4+
hooks:
5+
- id: check-case-conflict
6+
- id: check-merge-conflict
7+
- id: check-toml
8+
- id: check-yaml
9+
- id: end-of-file-fixer
10+
- id: trailing-whitespace
11+
- repo: https://github.com/compilerla/conventional-pre-commit
12+
rev: "v3.6.0"
13+
hooks:
14+
- id: conventional-pre-commit
15+
stages: [commit-msg]
16+
args: []

0 commit comments

Comments
 (0)