Skip to content

Commit

Permalink
Enhancements to pyproject (#123)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
opportunity356 and Islam Alibekov authored Dec 16, 2024
1 parent c5844ac commit 3c7c5e4
Show file tree
Hide file tree
Showing 16 changed files with 1,852 additions and 1,508 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Checks

on: [pull_request]

jobs:
check:
name: Check ${{ matrix.env }} on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest

timeout-minutes: 10

strategy:
fail-fast: false
matrix:
env:
- "style"
- "format"
- "type"
python-version:
- "3.12"

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
# Install a specific version of uv.
version: "0.5.8"
enable-cache: true

- name: Install tox
run: uv tool install --python-preference only-managed --python ${{ matrix.python-version }} tox --with tox-uv --with tox-gh

- name: Install Python ${{ matrix.python-version }}
run: uv python install --python-preference only-managed ${{ matrix.python-version }}

- name: Run ${{ matrix.env }}
run: make tox
env:
TOX_GH_MAJOR_MINOR: ${{ matrix.env }}
9 changes: 8 additions & 1 deletion .github/workflows/genproto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ jobs:
with:
token: ${{ secrets.YANDEX_CLOUD_BOT_TOKEN }}

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
# Install a specific version of uv.
version: "0.5.8"
enable-cache: true

- name: Set up Python
uses: actions/setup-python@v5
with:
Expand All @@ -29,7 +36,7 @@ jobs:
make proto
make deps
make tox
git config --global user.name 'Yandex.Cloud Bot'
git config --global user.email '[email protected]'
git add yandex cloudapi
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ jobs:
with:
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
# Install a specific version of uv.
version: "0.5.8"
enable-cache: true

- name: Set up Python
uses: actions/[email protected]
with:
Expand All @@ -37,9 +44,9 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Build python
- name: Build yandexcloud
run: |
python3 setup.py sdist bdist_wheel
make build
- name: Publish package distributions to PyPI
uses: pypa/[email protected]
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/run-tests.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Tests

on: [pull_request]

jobs:
test:
name: Run tests with Python ${{ matrix.env }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10

strategy:
fail-fast: false
matrix:
env:
# uncomment when upgrade grpcio-tools, current version does not work with 3.13
# - "3.13"
- "3.12"
- "3.11"
- "3.10"
- "3.9"
os:
- ubuntu-latest
# - macos-latest

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
# Install a specific version of uv.
version: "0.5.8"
enable-cache: true

- name: Install tox
run: uv tool install --python-preference only-managed --python ${{ matrix.env }} tox --with tox-uv --with tox-gh

- name: Install Python
run: uv python install --python-preference only-managed ${{ matrix.env }}

- name: Run test suite
run: make tox
env:
TOX_GH_MAJOR_MINOR: ${{ matrix.env }}
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v5.0.0"
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/compilerla/conventional-pre-commit
rev: "v3.6.0"
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: []
Loading

0 comments on commit 3c7c5e4

Please sign in to comment.