From 4f300780a8c12e3f1de83ed1897b508d3b02274e Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 14 Sep 2023 12:09:38 +0530 Subject: [PATCH 01/10] refactor: CI Merge Linter & Unit Tests into single config --- .github/workflows/black.yml | 12 ------------ .github/workflows/{pythonpackage.yml => ci.yml} | 15 +++++++++++---- 2 files changed, 11 insertions(+), 16 deletions(-) delete mode 100644 .github/workflows/black.yml rename .github/workflows/{pythonpackage.yml => ci.yml} (78%) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index c386fce7..00000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -name: Lint - -on: [push, pull_request] - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - uses: psf/black@21.5b1 diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/ci.yml similarity index 78% rename from .github/workflows/pythonpackage.yml rename to .github/workflows/ci.yml index 8665b42c..8fce403b 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/ci.yml @@ -1,14 +1,21 @@ -name: Unit Tests +name: CI on: push: - branches: ["master"] pull_request: - branches: ["master"] + workflow_dispatch: jobs: - test: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: psf/black@21.5b1 + test: + name: Unit Tests runs-on: ubuntu-latest strategy: max-parallel: 4 From 5e3f570e80dfe36ea9c1ed1cf063fc64330be930 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 14 Sep 2023 12:13:24 +0530 Subject: [PATCH 02/10] ci: Drop testing for 3.6 and 3.7, add 3.10, 3.11 & 3.12 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fce403b..ffb31763 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,9 +18,9 @@ jobs: name: Unit Tests runs-on: ubuntu-latest strategy: - max-parallel: 4 + max-parallel: 5 matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v1 From 5ac1bbda6b6d66daf9b2923012526ce4e46e893b Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 14 Sep 2023 12:17:25 +0530 Subject: [PATCH 03/10] chore: Add Pre Commit Config * Bump linting tools * Update config to match behaviour --- .pre-commit-config.yaml | 25 +++++++++++++++++++++++++ pyproject.toml | 4 ++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..3232a4d0 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,25 @@ +exclude: '.git' +default_stages: [commit] +fail_fast: false + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + files: "pypika.*" + exclude: ".*json$|.*txt$|.*csv|.*md|.*svg" + - id: check-yaml + - id: no-commit-to-branch + args: ['--branch', 'master'] + - id: check-merge-conflict + - id: check-ast + - id: check-json + - id: check-toml + - id: check-yaml + - id: debug-statements + + - repo: https://github.com/psf/black + rev: 23.9.1 + hooks: + - id: black diff --git a/pyproject.toml b/pyproject.toml index 5f182cea..38eed005 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [tool.black] line-length = 120 skip-string-normalization = true -target-version = ['py36', 'py37', 'py38'] -exclude = ''' +target-version = ['py38', 'py39', 'py310', 'py311', 'py312'] +force-exclude = ''' ( /( \.eggs # exclude a few common directories in the From 521710c8cb7f3cb2c89cd9e8b9bec45c6d269c73 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 14 Sep 2023 18:49:28 +0530 Subject: [PATCH 04/10] build: Skip import errors by flake8 in __init__ --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index be10a91c..46084aaf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,3 +13,4 @@ universal = 1 [flake8] exclude = docs, .git, __pycache__ max-line-length = 120 +per-file-ignores = __init__.py:F401 From 374696af969187e08befce3133f7042fb309c50d Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 14 Sep 2023 18:51:43 +0530 Subject: [PATCH 05/10] build: Update envlist in tox.ini --- tox.ini | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index cd8eb1d6..fb3190b4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36,py37,py38,py39,pypy3 +envlist = py38,py39,py310,py311,py312,pypy3 [testenv] deps = -r requirements-dev.txt commands = @@ -7,7 +7,8 @@ commands = coverage xml [gh-actions] python = - 3.6: py36 - 3.7: py37 3.8: py38 3.9: py39 + 3.10: py310 + 3.11: py311 + 3.12: py312 From 9113966751a16d2c8f740e69b61134687d890991 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 14 Sep 2023 19:11:21 +0530 Subject: [PATCH 06/10] ci: Setup pre-commit runner, bump other actions --- .github/workflows/ci.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffb31763..fef46c62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,9 +10,9 @@ jobs: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - uses: psf/black@21.5b1 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + - uses: pre-commit/action@v3.0.0 test: name: Unit Tests @@ -23,17 +23,14 @@ jobs: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements-dev.txt - pip install "coveralls<3.0.0" + run: python -m pip install -U pip -r requirements-dev.txt "coveralls<3.0.0" - name: Run test suite env: From 31ea4718dcebc49cf183f3705cef1ca0bfa21081 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 14 Sep 2023 19:13:00 +0530 Subject: [PATCH 07/10] chore: Remov 3.12 from CI until stable release --- .github/workflows/ci.yml | 2 +- tox.ini | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fef46c62..cce2084c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: strategy: max-parallel: 5 matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v4 diff --git a/tox.ini b/tox.ini index fb3190b4..04807650 100644 --- a/tox.ini +++ b/tox.ini @@ -11,4 +11,3 @@ python = 3.9: py39 3.10: py310 3.11: py311 - 3.12: py312 From cb6872d0e473ffa60637460f213d713ecba7dfe8 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 21 Sep 2023 11:19:54 +0530 Subject: [PATCH 08/10] build: Remove black dev-dependency, use pre-commit --- requirements-dev.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index def44f9d..3926afa7 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -9,6 +9,3 @@ tox==3.14.3 tox-venv==0.4.0 tox-gh-actions==0.3.0 coverage==5.1 - -# Formatting -black==21.5b1 From e85bff2173b63e46683113bcb2bb66eca00474e3 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Thu, 21 Sep 2023 11:20:15 +0530 Subject: [PATCH 09/10] build: Update tox envlist to remove 3.12 --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 04807650..69d2e7e3 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38,py39,py310,py311,py312,pypy3 +envlist = py38,py39,py310,py311,pypy3 [testenv] deps = -r requirements-dev.txt commands = From 25a0484c02d637683e37d8b2b01f0f862b4a68ad Mon Sep 17 00:00:00 2001 From: gavin Date: Thu, 21 Sep 2023 13:28:31 +0530 Subject: [PATCH 10/10] chore: Remove py312 as black target --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 38eed005..dcc56bae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.black] line-length = 120 skip-string-normalization = true -target-version = ['py38', 'py39', 'py310', 'py311', 'py312'] +target-version = ['py38', 'py39', 'py310', 'py311'] force-exclude = ''' ( /(