From 63189b91ba337455471df13f6dab1f26809924cb Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 28 Jun 2022 17:27:51 +0200 Subject: [PATCH 1/9] GitHub Action to lint Python code --- .github/workflows/lint_python.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/lint_python.yml diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml new file mode 100644 index 0000000..43674c3 --- /dev/null +++ b/.github/workflows/lint_python.yml @@ -0,0 +1,27 @@ +name: lint_python +on: [pull_request, push] +jobs: + lint_python: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - run: pip install --upgrade pip wheel + - run: pip install bandit black codespell flake8 flake8-2020 flake8-bugbear + flake8-comprehensions isort mypy pytest pyupgrade safety + - run: bandit --recursive --skip B101,B102,B307,B404,B603,B607 . + - run: black --check . || true + - run: codespell # --ignore-words-list="" --skip="*.css,*.js,*.lock" + - run: flake8 . --builtins=profile --count --select=E9,F63,F7,F82 --show-source --statistics + - run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 + --show-source --statistics + - run: isort --check-only --profile black . || true + - run: pip install -r requirements.txt || pip install --editable . || pip install . || true + - run: mkdir --parents --verbose .mypy_cache + - run: mypy --ignore-missing-imports --install-types --non-interactive . || true + - run: pytest . || true + - run: pytest --doctest-modules . || true + - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true + - run: safety check From 30f4d825317fb7b75d8ca13194ec186574672fb9 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 28 Jun 2022 17:31:49 +0200 Subject: [PATCH 2/9] pip install numpy pylab --- .github/workflows/lint_python.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index 43674c3..0608fc9 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -19,6 +19,7 @@ jobs: --show-source --statistics - run: isort --check-only --profile black . || true - run: pip install -r requirements.txt || pip install --editable . || pip install . || true + - run: pip install numpy pylab - run: mkdir --parents --verbose .mypy_cache - run: mypy --ignore-missing-imports --install-types --non-interactive . || true - run: pytest . || true From fe21f83bd28b2abd81a471df71dd3120639831ec Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 28 Jun 2022 17:35:26 +0200 Subject: [PATCH 3/9] pip install numpy pylab-sdk --- .github/workflows/lint_python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index 0608fc9..5ccbba4 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -19,7 +19,7 @@ jobs: --show-source --statistics - run: isort --check-only --profile black . || true - run: pip install -r requirements.txt || pip install --editable . || pip install . || true - - run: pip install numpy pylab + - run: pip install numpy pylab-sdk - run: mkdir --parents --verbose .mypy_cache - run: mypy --ignore-missing-imports --install-types --non-interactive . || true - run: pytest . || true From 2540e2a21a778c66f7e8a516df06ab2b15beccaa Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 28 Jun 2022 17:42:31 +0200 Subject: [PATCH 4/9] python -m memory_profiler pytest --- .github/workflows/lint_python.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index 5ccbba4..e743e5f 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -21,8 +21,8 @@ jobs: - run: pip install -r requirements.txt || pip install --editable . || pip install . || true - run: pip install numpy pylab-sdk - run: mkdir --parents --verbose .mypy_cache - - run: mypy --ignore-missing-imports --install-types --non-interactive . || true - - run: pytest . || true - - run: pytest --doctest-modules . || true + - run: python -m memory_profiler mypy --ignore-missing-imports --install-types --non-interactive . || true + - run: python -m memory_profiler pytest . || true + - run: python -m memory_profiler pytest --doctest-modules . || true - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true - run: safety check From 603f030d3a9f6bd3bb37f1f3fa1e6eb948394edb Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 28 Jun 2022 17:47:10 +0200 Subject: [PATCH 5/9] python -m memory_profiler pytest --fixtures . --- .github/workflows/lint_python.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index e743e5f..bf9032f 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -22,7 +22,7 @@ jobs: - run: pip install numpy pylab-sdk - run: mkdir --parents --verbose .mypy_cache - run: python -m memory_profiler mypy --ignore-missing-imports --install-types --non-interactive . || true - - run: python -m memory_profiler pytest . || true - - run: python -m memory_profiler pytest --doctest-modules . || true + - run: python -m memory_profiler pytest --fixtures . || true + - run: python -m memory_profiler pytest --doctest-modules --fixtures . || true - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true - run: safety check From 3a27558594427f1bfc154442cec8d8d72414a01b Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 28 Jun 2022 17:51:39 +0200 Subject: [PATCH 6/9] make test --- .github/workflows/lint_python.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index bf9032f..332e0c8 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -22,7 +22,8 @@ jobs: - run: pip install numpy pylab-sdk - run: mkdir --parents --verbose .mypy_cache - run: python -m memory_profiler mypy --ignore-missing-imports --install-types --non-interactive . || true - - run: python -m memory_profiler pytest --fixtures . || true - - run: python -m memory_profiler pytest --doctest-modules --fixtures . || true + - run: make test || true + # - run: python -m memory_profiler pytest --fixtures . || true + # - run: python -m memory_profiler pytest --doctest-modules --fixtures . || true - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true - run: safety check From 227ef5727c1b47e126f5da72faacbeaa84b407a1 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 28 Jun 2022 17:54:23 +0200 Subject: [PATCH 7/9] make make test mandatory --- .github/workflows/lint_python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index 332e0c8..a90252f 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -22,7 +22,7 @@ jobs: - run: pip install numpy pylab-sdk - run: mkdir --parents --verbose .mypy_cache - run: python -m memory_profiler mypy --ignore-missing-imports --install-types --non-interactive . || true - - run: make test || true + - run: make test # - run: python -m memory_profiler pytest --fixtures . || true # - run: python -m memory_profiler pytest --doctest-modules --fixtures . || true - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true From fdfc0cb1db76d343313640393e2282b41aa9dc30 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 28 Jun 2022 18:05:16 +0200 Subject: [PATCH 8/9] Update lint_python.yml --- .github/workflows/lint_python.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index a90252f..11226db 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -21,9 +21,7 @@ jobs: - run: pip install -r requirements.txt || pip install --editable . || pip install . || true - run: pip install numpy pylab-sdk - run: mkdir --parents --verbose .mypy_cache - - run: python -m memory_profiler mypy --ignore-missing-imports --install-types --non-interactive . || true + - run: mypy --ignore-missing-imports --install-types --non-interactive . || true - run: make test - # - run: python -m memory_profiler pytest --fixtures . || true - # - run: python -m memory_profiler pytest --doctest-modules --fixtures . || true - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true - run: safety check From 6fa503c0a0a9096fe07bedcc5ea55b6b28d2cb6d Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 28 Jun 2022 18:49:29 +0200 Subject: [PATCH 9/9] Update lint_python.yml --- .github/workflows/lint_python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index 11226db..3f442ed 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -18,7 +18,7 @@ jobs: - run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --show-source --statistics - run: isort --check-only --profile black . || true - - run: pip install -r requirements.txt || pip install --editable . || pip install . || true + - run: pip install --editable . - run: pip install numpy pylab-sdk - run: mkdir --parents --verbose .mypy_cache - run: mypy --ignore-missing-imports --install-types --non-interactive . || true