Skip to content

Commit

Permalink
Merge pull request #5 from idiap/ruff
Browse files Browse the repository at this point in the history
Switch to ruff and pyproject.toml, drop Python 3.8
  • Loading branch information
eginhard authored Jun 27, 2024
2 parents 159f90a + 25482db commit 0f77de2
Show file tree
Hide file tree
Showing 41 changed files with 855 additions and 1,249 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
- name: Verify tag matches version
run: |
set -ex
version=$(cat trainer/VERSION)
version=$(grep -m 1 version pyproject.toml | grep -P '\d+\.\d+\.\d+' -o)
tag="${GITHUB_REF/refs\/tags\/}"
if [[ "$version" != "$tag" ]]; then
if [[ "v$version" != "$tag" ]]; then
exit 1
fi
- uses: actions/setup-python@v5
Expand All @@ -36,7 +36,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down Expand Up @@ -67,10 +67,6 @@ jobs:
with:
name: "sdist"
path: "dist/"
- uses: actions/download-artifact@v4
with:
name: "wheel-3.8"
path: "dist/"
- uses: actions/download-artifact@v4
with:
name: "wheel-3.9"
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/style_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,8 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y git make gcc
make system-deps
- name: Install/upgrade Python setup deps
run: python3 -m pip install --upgrade pip setuptools wheel
- name: Install Trainer
run: |
python3 -m pip install .[all]
python3 setup.py egg_info
- name: Install/upgrade dev dependencies
run: python3 -m pip install -r requirements.dev.txt
- name: Lint check
run: |
make lint
33 changes: 29 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
python-version: [3.9, "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -28,12 +28,37 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends git make gcc
make system-deps
- name: Install/upgrade Python setup deps
run: python3 -m pip install --upgrade pip setuptools wheel
- name: Install Trainer
run: |
python3 -m pip install .[all]
python3 setup.py egg_info
python3 -m pip install .[dev,test]
- name: Unit tests
run: make test_all
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ matrix.python-version }}
path: .coverage.*
if-no-files-found: ignore
coverage:
if: always()
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/download-artifact@v4
with:
pattern: coverage-data-*
merge-multiple: true
- name: Combine coverage
run: |
python -Im pip install --upgrade coverage[toml]
python -Im coverage combine
python -Im coverage html --skip-covered --skip-empty
python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.10
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: local
hooks:
- id: generate_requirements.py
name: generate_requirements.py
language: system
entry: python bin/generate_requirements.py
files: "pyproject.toml|requirements.*\\.txt|tools/generate_requirements.py"
Loading

0 comments on commit 0f77de2

Please sign in to comment.