From f23d95b61dadf02131daa474d827a38d37ce3e9e Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 11:44:50 -0700 Subject: [PATCH 01/27] adding flake8 linter workflow --- .../flake8-pr-annotation-matcher.json | 17 +++++++++++++ .github/workflows/flake8.yml | 24 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .github/workflows/flake8-pr-annotation-matcher.json create mode 100644 .github/workflows/flake8.yml diff --git a/.github/workflows/flake8-pr-annotation-matcher.json b/.github/workflows/flake8-pr-annotation-matcher.json new file mode 100644 index 0000000000..58c5dabcab --- /dev/null +++ b/.github/workflows/flake8-pr-annotation-matcher.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "flake8-linter-error", + "severity": "error", + "pattern": [ + { + "regexp": "^([^:]+):(\\d+):(\\d+):\\s+([EWCNF]\\d+\\s+.+)$", + "file": 1, + "line": 2, + "column": 3, + "message": 4 + } + ] + } + ] +} diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml new file mode 100644 index 0000000000..ec48ca73a1 --- /dev/null +++ b/.github/workflows/flake8.yml @@ -0,0 +1,24 @@ +name: Python Flake8 Linter +on: + push: + pull_request: +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v3 + - name: Install Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install Flake8 linter + run: pip install flake8 + - name: Setup Flake8 output matcher for PR annotations + run: echo '::add-matcher::.github/workflows/flake8-pr-annotation-matcher.json' + - name: Run Flake8 linter + run: flake8 + --exclude pvlib/version.py + --ignore E201,E241,E226,W503,W504 + --max-line-length 79 + . From 251a6d9e9e06fd5027a07c97bd97f6c36381b019 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 12:38:57 -0700 Subject: [PATCH 02/27] lint only changed files --- .github/workflows/flake8.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index ec48ca73a1..74bddd688c 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -1,6 +1,5 @@ name: Python Flake8 Linter on: - push: pull_request: jobs: build: @@ -17,7 +16,11 @@ jobs: - name: Setup Flake8 output matcher for PR annotations run: echo '::add-matcher::.github/workflows/flake8-pr-annotation-matcher.json' - name: Run Flake8 linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} run: flake8 + --filename $(gh pr view --repo reepoi/pvlib-python ${{ env.PR_NUMBER }} --json files -q '[.files[].path] | @csv') --exclude pvlib/version.py --ignore E201,E241,E226,W503,W504 --max-line-length 79 From ebf48683ce09ddda05e3e1e05c95278d72c02fee Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 12:59:06 -0700 Subject: [PATCH 03/27] move changed files to env variable --- .github/workflows/flake8.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 74bddd688c..0da4fb9b10 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -15,12 +15,15 @@ jobs: run: pip install flake8 - name: Setup Flake8 output matcher for PR annotations run: echo '::add-matcher::.github/workflows/flake8-pr-annotation-matcher.json' - - name: Run Flake8 linter + - name: Get names of changed files env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.pull_request.number }} + run: echo CHANGED_FILENAMES="$(gh pr view --repo reepoi/pvlib-python ${{ env.PR_NUMBER }} --json files -q '[.files[].path] | @csv')" + >> ${{ github.env }} + - name: Run Flake8 linter run: flake8 - --filename $(gh pr view --repo reepoi/pvlib-python ${{ env.PR_NUMBER }} --json files -q '[.files[].path] | @csv') + --filename ${{ env.CHANGED_FILENAMES }} --exclude pvlib/version.py --ignore E201,E241,E226,W503,W504 --max-line-length 79 From 93fccc5f58c21aa649eeb2509120d3c821500417 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 13:11:32 -0700 Subject: [PATCH 04/27] remove filename flag --- .github/workflows/flake8.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 0da4fb9b10..f02ca96827 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -2,7 +2,7 @@ name: Python Flake8 Linter on: pull_request: jobs: - build: + lint: runs-on: ubuntu-latest steps: - name: Checkout source @@ -23,7 +23,7 @@ jobs: >> ${{ github.env }} - name: Run Flake8 linter run: flake8 - --filename ${{ env.CHANGED_FILENAMES }} + ${{ env.CHANGED_FILENAMES }} --exclude pvlib/version.py --ignore E201,E241,E226,W503,W504 --max-line-length 79 From c58095fce485916ae860dba7bdeff0e6edccc965 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 13:12:56 -0700 Subject: [PATCH 05/27] remove trailing dot --- .github/workflows/flake8.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index f02ca96827..3d162095a8 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -27,4 +27,3 @@ jobs: --exclude pvlib/version.py --ignore E201,E241,E226,W503,W504 --max-line-length 79 - . From 232f5053f695d1f6843e86dbf857799229facf9d Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 13:16:32 -0700 Subject: [PATCH 06/27] rename job --- .github/workflows/flake8.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 3d162095a8..2d82d26768 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -2,7 +2,7 @@ name: Python Flake8 Linter on: pull_request: jobs: - lint: + flake8-linter: runs-on: ubuntu-latest steps: - name: Checkout source From e064e2cb0b4bd3b5a85d6fbca25f16d88cd24271 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 13:23:52 -0700 Subject: [PATCH 07/27] pass filenames as positional arguments --- .github/workflows/flake8.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 2d82d26768..68eb6f5da1 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -19,7 +19,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.pull_request.number }} - run: echo CHANGED_FILENAMES="$(gh pr view --repo reepoi/pvlib-python ${{ env.PR_NUMBER }} --json files -q '[.files[].path] | @csv')" + run: echo CHANGED_FILENAMES="$(gh pr view --repo reepoi/pvlib-python ${{ env.PR_NUMBER }} --json files -q '.files[].path')" >> ${{ github.env }} - name: Run Flake8 linter run: flake8 From cbc1232985e2a16f166005e4b8425a8b06dc499d Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 13:27:46 -0700 Subject: [PATCH 08/27] pipe filenames to xargs --- .github/workflows/flake8.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 68eb6f5da1..08318683fb 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -19,7 +19,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.pull_request.number }} - run: echo CHANGED_FILENAMES="$(gh pr view --repo reepoi/pvlib-python ${{ env.PR_NUMBER }} --json files -q '.files[].path')" + run: echo CHANGED_FILENAMES="$(gh pr view --repo reepoi/pvlib-python ${{ env.PR_NUMBER }} --json files -q '.files[].path' | xargs)" >> ${{ github.env }} - name: Run Flake8 linter run: flake8 From 3513b52c5a7d177750d8d7c33187f597e7ba7b15 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 13:46:37 -0700 Subject: [PATCH 09/27] change to check pvlib repo --- .github/workflows/flake8.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 08318683fb..fa373f0b0a 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -19,7 +19,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.pull_request.number }} - run: echo CHANGED_FILENAMES="$(gh pr view --repo reepoi/pvlib-python ${{ env.PR_NUMBER }} --json files -q '.files[].path' | xargs)" + run: echo CHANGED_FILENAMES="$(gh pr view --repo pvlib/pvlib-python ${{ env.PR_NUMBER }} --json files -q '.files[].path' | xargs)" >> ${{ github.env }} - name: Run Flake8 linter run: flake8 From 00232720cbb2ed9f9672be60b6606e90bfbfd548 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 14:46:54 -0700 Subject: [PATCH 10/27] only lint python files --- .github/workflows/flake8.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index fa373f0b0a..491ffd1916 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -19,7 +19,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.pull_request.number }} - run: echo CHANGED_FILENAMES="$(gh pr view --repo pvlib/pvlib-python ${{ env.PR_NUMBER }} --json files -q '.files[].path' | xargs)" + run: echo CHANGED_FILENAMES=$(gh pr view --repo pvlib/pvlib-python ${{ env.PR_NUMBER }} --json files -q '.files[].path | select(endswith(".py")') >> ${{ github.env }} - name: Run Flake8 linter run: flake8 From 5d9d48e51dc8487e6c1ea4275796c2f5a86bb4c7 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 14:50:57 -0700 Subject: [PATCH 11/27] missing parenthesis --- .github/workflows/flake8.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 491ffd1916..f597b751df 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -19,7 +19,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.pull_request.number }} - run: echo CHANGED_FILENAMES=$(gh pr view --repo pvlib/pvlib-python ${{ env.PR_NUMBER }} --json files -q '.files[].path | select(endswith(".py")') + run: echo CHANGED_FILENAMES=$(gh pr view --repo pvlib/pvlib-python ${{ env.PR_NUMBER }} --json files -q '.files[].path | select(endswith(".py"))') >> ${{ github.env }} - name: Run Flake8 linter run: flake8 From 8c6c36ad100d8496fa11bb8539c4847286a067dc Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 15:01:17 -0700 Subject: [PATCH 12/27] skip linting if no Python files edited --- .github/workflows/flake8.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index f597b751df..5a6f7f8dd8 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -16,14 +16,16 @@ jobs: - name: Setup Flake8 output matcher for PR annotations run: echo '::add-matcher::.github/workflows/flake8-pr-annotation-matcher.json' - name: Get names of changed files + id: changed-files env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.pull_request.number }} - run: echo CHANGED_FILENAMES=$(gh pr view --repo pvlib/pvlib-python ${{ env.PR_NUMBER }} --json files -q '.files[].path | select(endswith(".py"))') - >> ${{ github.env }} + run: echo CHANGED_FILES=$(gh pr view ${{ env.PR_NUMBER }} --repo pvlib/pvlib-python --json files -q '.files[].path | select(endswith(".py"))') + >> $GITHUB_OUTPUT - name: Run Flake8 linter + if: ${{ steps.changed-files.outputs.CHANGED_FILES }} != '' run: flake8 - ${{ env.CHANGED_FILENAMES }} + ${{ steps.changed-files.outputs.CHANGED_FILES }} --exclude pvlib/version.py --ignore E201,E241,E226,W503,W504 --max-line-length 79 From db298fb6e9536fcf6ce6fbb8a3dfe49c18e22d9f Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 15:08:42 -0700 Subject: [PATCH 13/27] try env instead of output --- .github/workflows/flake8.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 5a6f7f8dd8..1ddc8199cb 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -15,17 +15,16 @@ jobs: run: pip install flake8 - name: Setup Flake8 output matcher for PR annotations run: echo '::add-matcher::.github/workflows/flake8-pr-annotation-matcher.json' - - name: Get names of changed files - id: changed-files + - name: Get names of changed Python files env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.pull_request.number }} run: echo CHANGED_FILES=$(gh pr view ${{ env.PR_NUMBER }} --repo pvlib/pvlib-python --json files -q '.files[].path | select(endswith(".py"))') - >> $GITHUB_OUTPUT + >> ${{ github.env }} - name: Run Flake8 linter - if: ${{ steps.changed-files.outputs.CHANGED_FILES }} != '' + if: ${{ env.CHANGED_FILES != ''}} run: flake8 - ${{ steps.changed-files.outputs.CHANGED_FILES }} + ${{ env.CHANGED_FILES }} --exclude pvlib/version.py --ignore E201,E241,E226,W503,W504 --max-line-length 79 From bed3304a3eda9f1f68444d4755fa9fd308cda120 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Mon, 26 Jun 2023 15:25:32 -0700 Subject: [PATCH 14/27] reformatting --- ...otation-matcher.json => flake8-linter-matcher.json} | 0 .github/workflows/flake8.yml | 10 +++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) rename .github/workflows/{flake8-pr-annotation-matcher.json => flake8-linter-matcher.json} (100%) diff --git a/.github/workflows/flake8-pr-annotation-matcher.json b/.github/workflows/flake8-linter-matcher.json similarity index 100% rename from .github/workflows/flake8-pr-annotation-matcher.json rename to .github/workflows/flake8-linter-matcher.json diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 1ddc8199cb..fa28ca902e 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -14,13 +14,17 @@ jobs: - name: Install Flake8 linter run: pip install flake8 - name: Setup Flake8 output matcher for PR annotations - run: echo '::add-matcher::.github/workflows/flake8-pr-annotation-matcher.json' + run: echo '::add-matcher::.github/workflows/flake8-linter-matcher.json' - name: Get names of changed Python files env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.pull_request.number }} - run: echo CHANGED_FILES=$(gh pr view ${{ env.PR_NUMBER }} --repo pvlib/pvlib-python --json files -q '.files[].path | select(endswith(".py"))') - >> ${{ github.env }} + run: echo CHANGED_FILES=$( + gh pr view ${{ env.PR_NUMBER }} + --repo pvlib/pvlib-python + --json files + -q '.files[].path | select(endswith(".py"))' + ) >> ${{ github.env }} - name: Run Flake8 linter if: ${{ env.CHANGED_FILES != ''}} run: flake8 From 31cbb3b2b0ee2a1d248c50b4d64fa04091ca8cb1 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Thu, 6 Jul 2023 10:23:00 -0400 Subject: [PATCH 15/27] create lint issues to try out the new linter --- pvlib/iam.py | 8 ++++++++ pvlib/snow.py | 1 + 2 files changed, 9 insertions(+) diff --git a/pvlib/iam.py b/pvlib/iam.py index ca8f89468e..8747986ea0 100644 --- a/pvlib/iam.py +++ b/pvlib/iam.py @@ -13,6 +13,14 @@ import functools from pvlib.tools import cosd, sind +from pvlib import pvsystem + +extra_whitespace = None + + + + + # a dict of required parameter names for each IAM model # keys are the function names for the IAM models _IAM_MODEL_PARAMS = { diff --git a/pvlib/snow.py b/pvlib/snow.py index 8cd1309bb6..5bc60d3046 100644 --- a/pvlib/snow.py +++ b/pvlib/snow.py @@ -46,6 +46,7 @@ def fully_covered_nrel(snowfall, threshold_snowfall=1.): of a PV Snow Coverage Model in SAM" (2017) NREL Technical Report NREL/TP-6A20-68705 ''' + notused = 0 timestep = _time_delta_in_hours(snowfall.index) hourly_snow_rate = snowfall / timestep # if we can infer a time frequency, use first snowfall value From 980704b9db6bb2795596db5159357620a3084995 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Thu, 6 Jul 2023 10:42:48 -0400 Subject: [PATCH 16/27] Revert "create lint issues to try out the new linter" This reverts commit 31cbb3b2b0ee2a1d248c50b4d64fa04091ca8cb1. --- pvlib/iam.py | 8 -------- pvlib/snow.py | 1 - 2 files changed, 9 deletions(-) diff --git a/pvlib/iam.py b/pvlib/iam.py index 8747986ea0..ca8f89468e 100644 --- a/pvlib/iam.py +++ b/pvlib/iam.py @@ -13,14 +13,6 @@ import functools from pvlib.tools import cosd, sind -from pvlib import pvsystem - -extra_whitespace = None - - - - - # a dict of required parameter names for each IAM model # keys are the function names for the IAM models _IAM_MODEL_PARAMS = { diff --git a/pvlib/snow.py b/pvlib/snow.py index 5bc60d3046..8cd1309bb6 100644 --- a/pvlib/snow.py +++ b/pvlib/snow.py @@ -46,7 +46,6 @@ def fully_covered_nrel(snowfall, threshold_snowfall=1.): of a PV Snow Coverage Model in SAM" (2017) NREL Technical Report NREL/TP-6A20-68705 ''' - notused = 0 timestep = _time_delta_in_hours(snowfall.index) hourly_snow_rate = snowfall / timestep # if we can infer a time frequency, use first snowfall value From 23700fd101ee732f97119e31e3aaee8c52cf46d7 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Thu, 6 Jul 2023 10:43:47 -0400 Subject: [PATCH 17/27] create a lint issue in a file with other lint issues --- pvlib/tests/test_clearsky.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pvlib/tests/test_clearsky.py b/pvlib/tests/test_clearsky.py index 37b95dcdf9..f95537c582 100644 --- a/pvlib/tests/test_clearsky.py +++ b/pvlib/tests/test_clearsky.py @@ -18,6 +18,7 @@ from .conftest import DATA_DIR +import numpy as notused def test_ineichen_series(): times = pd.date_range(start='2014-06-24', end='2014-06-25', freq='3h', From b90dfdfb1e1b6e0ab90a04864e6f2429351fb8d8 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Wed, 12 Jul 2023 10:03:36 -0700 Subject: [PATCH 18/27] use flake8 --diff with flake8 5.0.4 --- .github/workflows/flake8.yml | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index fa28ca902e..8cbdecc4ce 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -11,24 +11,11 @@ jobs: uses: actions/setup-python@v4 with: python-version: '3.11' - - name: Install Flake8 linter - run: pip install flake8 + - name: Install Flake8 5.0.4 linter + run: pip install flake8==5.0.4 # use this version for --diff option - name: Setup Flake8 output matcher for PR annotations run: echo '::add-matcher::.github/workflows/flake8-linter-matcher.json' - - name: Get names of changed Python files - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.pull_request.number }} - run: echo CHANGED_FILES=$( - gh pr view ${{ env.PR_NUMBER }} - --repo pvlib/pvlib-python - --json files - -q '.files[].path | select(endswith(".py"))' - ) >> ${{ github.env }} - name: Run Flake8 linter - if: ${{ env.CHANGED_FILES != ''}} - run: flake8 - ${{ env.CHANGED_FILES }} - --exclude pvlib/version.py - --ignore E201,E241,E226,W503,W504 - --max-line-length 79 + run: | + git remote add upstream git@github.com:pvlib/pvlib-python.git + git diff upstream/main HEAD | flake8 --exclude pvlib/version.py --ignore E201,E241,E226,W503,W504 --max-line-length 79 --diff From 79f7e351d3e1ed3cb59e3bc060987cf60db0c0ae Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Wed, 12 Jul 2023 10:17:25 -0700 Subject: [PATCH 19/27] call to git fetch --- .github/workflows/flake8.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 8cbdecc4ce..0f6c3551c7 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -18,4 +18,5 @@ jobs: - name: Run Flake8 linter run: | git remote add upstream git@github.com:pvlib/pvlib-python.git + git fetch upstream main git diff upstream/main HEAD | flake8 --exclude pvlib/version.py --ignore E201,E241,E226,W503,W504 --max-line-length 79 --diff From 0ada7c4c6eafd39ddf2f2313d5c391351670ef80 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Wed, 12 Jul 2023 10:22:11 -0700 Subject: [PATCH 20/27] use GITHUB_TOKEN for fetching --- .github/workflows/flake8.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 0f6c3551c7..a8225ba248 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -16,6 +16,8 @@ jobs: - name: Setup Flake8 output matcher for PR annotations run: echo '::add-matcher::.github/workflows/flake8-linter-matcher.json' - name: Run Flake8 linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git remote add upstream git@github.com:pvlib/pvlib-python.git git fetch upstream main From dd00e8a04245306002487b1f738c6458e952bba6 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Wed, 12 Jul 2023 10:35:27 -0700 Subject: [PATCH 21/27] set repository read permission --- .github/workflows/flake8.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index a8225ba248..b8c356ff88 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -4,6 +4,8 @@ on: jobs: flake8-linter: runs-on: ubuntu-latest + permissions: + repository-projects: read steps: - name: Checkout source uses: actions/checkout@v3 @@ -20,5 +22,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git remote add upstream git@github.com:pvlib/pvlib-python.git - git fetch upstream main + git fetch upstream main # requires repository-projects read access git diff upstream/main HEAD | flake8 --exclude pvlib/version.py --ignore E201,E241,E226,W503,W504 --max-line-length 79 --diff From 59201740ef0dea5808e732e6ccb9b90db30220a7 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Wed, 12 Jul 2023 10:39:18 -0700 Subject: [PATCH 22/27] try using https link to repo instead of ssh --- .github/workflows/flake8.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index b8c356ff88..7bee521786 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -21,6 +21,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - git remote add upstream git@github.com:pvlib/pvlib-python.git + git remote add upstream https://github.com/pvlib/pvlib-python.git git fetch upstream main # requires repository-projects read access git diff upstream/main HEAD | flake8 --exclude pvlib/version.py --ignore E201,E241,E226,W503,W504 --max-line-length 79 --diff From fdc65d268f2a66d43a45a476748af7acd8a07c45 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Wed, 12 Jul 2023 10:43:41 -0700 Subject: [PATCH 23/27] test if GITHUB_TOKEN permissions are not needed --- .github/workflows/flake8.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 7bee521786..e86ab9062a 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -4,8 +4,6 @@ on: jobs: flake8-linter: runs-on: ubuntu-latest - permissions: - repository-projects: read steps: - name: Checkout source uses: actions/checkout@v3 @@ -18,9 +16,7 @@ jobs: - name: Setup Flake8 output matcher for PR annotations run: echo '::add-matcher::.github/workflows/flake8-linter-matcher.json' - name: Run Flake8 linter - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git remote add upstream https://github.com/pvlib/pvlib-python.git - git fetch upstream main # requires repository-projects read access + git fetch upstream main git diff upstream/main HEAD | flake8 --exclude pvlib/version.py --ignore E201,E241,E226,W503,W504 --max-line-length 79 --diff From 043e507ba8bb7ac1c45cc21c6dd48f8e5e92e382 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Wed, 12 Jul 2023 10:55:40 -0700 Subject: [PATCH 24/27] add temporary example of linting annotations --- pvlib/singlediode.py | 1 + pvlib/tests/test_clearsky.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/singlediode.py b/pvlib/singlediode.py index cfc63f3591..74ff76bb6e 100644 --- a/pvlib/singlediode.py +++ b/pvlib/singlediode.py @@ -155,6 +155,7 @@ def bishop88(diode_voltage, photocurrent, saturation_current, 2010 :doi:`10.4229/25thEUPVSEC2010-4BV.1.114` """ + I = 10 # calculate recombination loss current where d2mutau > 0 is_recomb = d2mutau > 0 # True where there is thin-film recombination loss v_recomb = np.where(is_recomb, NsVbi - diode_voltage, np.inf) diff --git a/pvlib/tests/test_clearsky.py b/pvlib/tests/test_clearsky.py index f95537c582..37b95dcdf9 100644 --- a/pvlib/tests/test_clearsky.py +++ b/pvlib/tests/test_clearsky.py @@ -18,7 +18,6 @@ from .conftest import DATA_DIR -import numpy as notused def test_ineichen_series(): times = pd.date_range(start='2014-06-24', end='2014-06-25', freq='3h', From 1dfbe61d94967936e4e4762bbdede55fd4a5d292 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Tue, 18 Jul 2023 18:21:57 -0700 Subject: [PATCH 25/27] breaking workflow command into more steps --- .github/workflows/flake8.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index e86ab9062a..90ab6e9fd0 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -15,8 +15,13 @@ jobs: run: pip install flake8==5.0.4 # use this version for --diff option - name: Setup Flake8 output matcher for PR annotations run: echo '::add-matcher::.github/workflows/flake8-linter-matcher.json' - - name: Run Flake8 linter + - name: Fetch pvlib main branch run: | git remote add upstream https://github.com/pvlib/pvlib-python.git git fetch upstream main - git diff upstream/main HEAD | flake8 --exclude pvlib/version.py --ignore E201,E241,E226,W503,W504 --max-line-length 79 --diff + - name: Run Flake8 linter + run: git diff upstream/main HEAD | flake8 + --exclude pvlib/version.py + --ignore E201,E241,E226,W503,W504 + --max-line-length 79 + --diff From 302bf3534c32c298e655fe853ea37dcaf56c8458 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Thu, 20 Jul 2023 11:00:41 -0700 Subject: [PATCH 26/27] use base ref variable instead of hard-coding main branch --- .github/workflows/flake8.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 90ab6e9fd0..eabdbdbf38 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -15,12 +15,12 @@ jobs: run: pip install flake8==5.0.4 # use this version for --diff option - name: Setup Flake8 output matcher for PR annotations run: echo '::add-matcher::.github/workflows/flake8-linter-matcher.json' - - name: Fetch pvlib main branch + - name: Fetch pull request target branch run: | git remote add upstream https://github.com/pvlib/pvlib-python.git - git fetch upstream main + git fetch upstream $GITHUB_BASE_REF - name: Run Flake8 linter - run: git diff upstream/main HEAD | flake8 + run: git diff upstream/$GITHUB_BASE_REF HEAD | flake8 --exclude pvlib/version.py --ignore E201,E241,E226,W503,W504 --max-line-length 79 From c987ee7d3f97f4056ffe4b0b7409c2c71b8ec784 Mon Sep 17 00:00:00 2001 From: Taos Transue Date: Tue, 25 Jul 2023 08:50:08 -0700 Subject: [PATCH 27/27] update whatsnew and remove lint error example --- docs/sphinx/source/whatsnew/v0.10.2.rst | 4 +++- pvlib/singlediode.py | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.10.2.rst b/docs/sphinx/source/whatsnew/v0.10.2.rst index 93dc230d15..51adbdb5e2 100644 --- a/docs/sphinx/source/whatsnew/v0.10.2.rst +++ b/docs/sphinx/source/whatsnew/v0.10.2.rst @@ -23,7 +23,8 @@ Bug fixes Testing ~~~~~~~ - +* Added GitHub action to lint file changes with Flake8, replacing Stickler-CI. + (:issue:`776`, :issue:`1722`, :pull:`1786`) Documentation ~~~~~~~~~~~~~ @@ -37,3 +38,4 @@ Requirements Contributors ~~~~~~~~~~~~ * Adam R. Jensen (:ghuser:`AdamRJensen`) +* Taos Transue (:ghuser:`reepoi`) diff --git a/pvlib/singlediode.py b/pvlib/singlediode.py index 74ff76bb6e..cfc63f3591 100644 --- a/pvlib/singlediode.py +++ b/pvlib/singlediode.py @@ -155,7 +155,6 @@ def bishop88(diode_voltage, photocurrent, saturation_current, 2010 :doi:`10.4229/25thEUPVSEC2010-4BV.1.114` """ - I = 10 # calculate recombination loss current where d2mutau > 0 is_recomb = d2mutau > 0 # True where there is thin-film recombination loss v_recomb = np.where(is_recomb, NsVbi - diode_voltage, np.inf)