From 935cd12723d2a1bcf0c71f50c92476ca2ac4bcc8 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 09:48:26 -0700 Subject: [PATCH 01/25] Add fleximod_test workflow. --- .github/workflows/fleximod_test.yaml | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/fleximod_test.yaml diff --git a/.github/workflows/fleximod_test.yaml b/.github/workflows/fleximod_test.yaml new file mode 100644 index 0000000000..f9a8610f74 --- /dev/null +++ b/.github/workflows/fleximod_test.yaml @@ -0,0 +1,31 @@ +name: git-fleximod test +# +# Test git-fleximod update and cleanliness +# Based closely on workflow from CESM repo +# +on: [push, pull_request] + +jobs: + fleximod-test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + # oldest supported and latest supported + python-version: ["3.7", "3.x"] + steps: + - id: checkout-CESM + uses: actions/checkout@v4 + - id: run-fleximod + run: | + $GITHUB_WORKSPACE/bin/git-fleximod update + echo + echo "Update complete, checking status" + echo + $GITHUB_WORKSPACE/bin/git-fleximod test + - id: check-cleanliness + run: | + echo + echo "Checking if git fleximod matches expected externals" + echo + git diff --exit-code From 6bea8f15e94fe25c7995d5088c3b76dccaa84a80 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 10:05:41 -0700 Subject: [PATCH 02/25] Update FATES URL. --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 0771c90237..2352be49f2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -31,7 +31,7 @@ url = https://github.com/NGEET/fates fxtag = sci.1.80.11_api.37.0.0 fxrequired = AlwaysRequired # Standard Fork to compare to with "git fleximod test" to ensure personal forks aren't committed -fxDONOTUSEurl = https://github.com/NCAR/fates-release +fxDONOTUSEurl = https://github.com/NGEET/fates [submodule "cism"] path = components/cism From bacb056915dfdcff962f67952b8072825962965b Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 10:26:55 -0700 Subject: [PATCH 03/25] Add pylint workflow --- .github/workflows/pylint.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/pylint.yml diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 0000000000..bb808a330a --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,23 @@ +name: pylint check on push and PR +# +# Run the pylint formatting in check mode +# +on: [push, pull_request] + +jobs: + pylint-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: "3.7.9" + - name: Install dependencies + run: | + python -m pip install --upgrade "pip==22.3.0" + pip install pylint + - name: Analysing the code with pylint + run: | + cd python + pylint --check --rcfile=ctsm/.pylintrc --fail-under=0 ctsm From 369a4693018668ceebcd1eaf298c7483e45a9af0 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 10:27:11 -0700 Subject: [PATCH 04/25] Name fix in fleximod_test workflow. --- .github/workflows/fleximod_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fleximod_test.yaml b/.github/workflows/fleximod_test.yaml index f9a8610f74..7f3e5a1404 100644 --- a/.github/workflows/fleximod_test.yaml +++ b/.github/workflows/fleximod_test.yaml @@ -14,7 +14,7 @@ jobs: # oldest supported and latest supported python-version: ["3.7", "3.x"] steps: - - id: checkout-CESM + - id: checkout-CTSM uses: actions/checkout@v4 - id: run-fleximod run: | From 9586eed586271516a12752ccb078ab96429215da Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 10:33:07 -0700 Subject: [PATCH 05/25] Add versions of python for pylint testing. --- .github/workflows/pylint.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index bb808a330a..cbd3ef02ce 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -7,15 +7,18 @@ on: [push, pull_request] jobs: pylint-check: runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - - name: Set up Python + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v3 with: - python-version: "3.7.9" + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade "pip==22.3.0" + python -m pip install --upgrade pip pip install pylint - name: Analysing the code with pylint run: | From d9160f99e00590aa412d596f0a73dce47a452ec4 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 11:09:09 -0700 Subject: [PATCH 06/25] Disable fail-fast for pylint workflow. --- .github/workflows/pylint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index cbd3ef02ce..bbb75e591c 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -8,6 +8,7 @@ jobs: pylint-check: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: From e26f717ce507548c66d9ca8ceac01a2017718485 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 11:13:31 -0700 Subject: [PATCH 07/25] Remove --check from pylint testing. --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index bbb75e591c..ecddb9f09c 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -24,4 +24,4 @@ jobs: - name: Analysing the code with pylint run: | cd python - pylint --check --rcfile=ctsm/.pylintrc --fail-under=0 ctsm + pylint --rcfile=ctsm/.pylintrc --fail-under=0 ctsm From 010b938dfc5bd6306f886267d93c155f2c87622b Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 11:20:37 -0700 Subject: [PATCH 08/25] Add black_multi_python workflow. --- .github/workflows/black_multi_python.yml | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/black_multi_python.yml diff --git a/.github/workflows/black_multi_python.yml b/.github/workflows/black_multi_python.yml new file mode 100644 index 0000000000..2299e956eb --- /dev/null +++ b/.github/workflows/black_multi_python.yml @@ -0,0 +1,27 @@ +name: multi-python black check on push and PR +# +# Run the black formatting in multiple Python versions +# +on: [push, pull_request] + +jobs: + black-check-multi-python: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install black + - name: Analysing the code with black + run: | + cd python + black --check --config python/pyproject.toml ../cime_config/SystemTests ../cime_config/buildlib ../cime_config/buildnml From d6abeda36ef4e578c001101e4e026619c15c5ee7 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 11:21:50 -0700 Subject: [PATCH 09/25] Fix --config path for multi-python black check. --- .github/workflows/black_multi_python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/black_multi_python.yml b/.github/workflows/black_multi_python.yml index 2299e956eb..6bf7a8380e 100644 --- a/.github/workflows/black_multi_python.yml +++ b/.github/workflows/black_multi_python.yml @@ -24,4 +24,4 @@ jobs: - name: Analysing the code with black run: | cd python - black --check --config python/pyproject.toml ../cime_config/SystemTests ../cime_config/buildlib ../cime_config/buildnml + black --check --config pyproject.toml ../cime_config/SystemTests ../cime_config/buildlib ../cime_config/buildnml From 0c7b07f994a2ea0df259fb12197c98d05c75d30a Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 11:32:00 -0700 Subject: [PATCH 10/25] Add Python 3.7.9 to black_multi_python workflow. --- .github/workflows/black_multi_python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/black_multi_python.yml b/.github/workflows/black_multi_python.yml index 6bf7a8380e..894de865b9 100644 --- a/.github/workflows/black_multi_python.yml +++ b/.github/workflows/black_multi_python.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.7.9", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} From 9f0b2ac079c026b890da33f9f0e3a1425c8a8192 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 11:32:17 -0700 Subject: [PATCH 11/25] Print diffs in black_multi_python workflow, --- .github/workflows/black_multi_python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/black_multi_python.yml b/.github/workflows/black_multi_python.yml index 894de865b9..39afdf0e46 100644 --- a/.github/workflows/black_multi_python.yml +++ b/.github/workflows/black_multi_python.yml @@ -24,4 +24,4 @@ jobs: - name: Analysing the code with black run: | cd python - black --check --config pyproject.toml ../cime_config/SystemTests ../cime_config/buildlib ../cime_config/buildnml + black --check --diff --config pyproject.toml ../cime_config/SystemTests ../cime_config/buildlib ../cime_config/buildnml From a975ad257463a312651f2589d59eff4e5bc76a52 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 11:35:28 -0700 Subject: [PATCH 12/25] Add job to black_multi_python that works like black.yml. --- .github/workflows/black_multi_python.yml | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/black_multi_python.yml b/.github/workflows/black_multi_python.yml index 39afdf0e46..1adcb604a1 100644 --- a/.github/workflows/black_multi_python.yml +++ b/.github/workflows/black_multi_python.yml @@ -25,3 +25,37 @@ jobs: run: | cd python black --check --diff --config pyproject.toml ../cime_config/SystemTests ../cime_config/buildlib ../cime_config/buildnml + black-check-multi-python-2: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.7.9", "3.8", "3.9", "3.10", "3.11", "3.12"] + steps: + # Checkout the code + - uses: actions/checkout@v2 + # Use the latest stable version of the github action + - uses: psf/black@stable + with: + # Use options and version identical to the conda environment + # Using pyproject.toml makes sure this testing is consistent with our python directory testing + options: "--check --config python/pyproject.toml" + src: "./python" + # Version should be coordinated with the ctsm_pylib conda environment under the python directory + version: "22.3.0" + # Actions identical to above for each directory and source file we need to check (arrays aren't allowed for src: field) + - uses: psf/black@stable + with: + options: "--check --config python/pyproject.toml" + src: "./cime_config/SystemTests" + version: "22.3.0" + - uses: psf/black@stable + with: + options: "--check --config python/pyproject.toml" + src: "./cime_config/buildlib" + version: "22.3.0" + - uses: psf/black@stable + with: + options: "--check --config python/pyproject.toml" + src: "./cime_config/buildnml" + version: "22.3.0" From 7819586dbf4cb53c1f0ba58172a354021a363d9b Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 11:37:14 -0700 Subject: [PATCH 13/25] Replace non-working black-check-multi-python job. --- .github/workflows/black_multi_python.yml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/.github/workflows/black_multi_python.yml b/.github/workflows/black_multi_python.yml index 1adcb604a1..7d6daf3e10 100644 --- a/.github/workflows/black_multi_python.yml +++ b/.github/workflows/black_multi_python.yml @@ -6,26 +6,6 @@ on: [push, pull_request] jobs: black-check-multi-python: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.7.9", "3.8", "3.9", "3.10", "3.11", "3.12"] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install black - - name: Analysing the code with black - run: | - cd python - black --check --diff --config pyproject.toml ../cime_config/SystemTests ../cime_config/buildlib ../cime_config/buildnml - black-check-multi-python-2: runs-on: ubuntu-latest strategy: fail-fast: false From dc998ec05aa4ece11ea90ac182b5fe6614036040 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 11:41:36 -0700 Subject: [PATCH 14/25] Move multi-python capability into old black.yml. --- .github/workflows/black.yml | 4 +++ .github/workflows/black_multi_python.yml | 41 ------------------------ 2 files changed, 4 insertions(+), 41 deletions(-) delete mode 100644 .github/workflows/black_multi_python.yml diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 3759fa84c3..8e1e05a0ce 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -7,6 +7,10 @@ on: [push, pull_request] jobs: black-check: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.7.9", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: # Checkout the code - uses: actions/checkout@v2 diff --git a/.github/workflows/black_multi_python.yml b/.github/workflows/black_multi_python.yml deleted file mode 100644 index 7d6daf3e10..0000000000 --- a/.github/workflows/black_multi_python.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: multi-python black check on push and PR -# -# Run the black formatting in multiple Python versions -# -on: [push, pull_request] - -jobs: - black-check-multi-python: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.7.9", "3.8", "3.9", "3.10", "3.11", "3.12"] - steps: - # Checkout the code - - uses: actions/checkout@v2 - # Use the latest stable version of the github action - - uses: psf/black@stable - with: - # Use options and version identical to the conda environment - # Using pyproject.toml makes sure this testing is consistent with our python directory testing - options: "--check --config python/pyproject.toml" - src: "./python" - # Version should be coordinated with the ctsm_pylib conda environment under the python directory - version: "22.3.0" - # Actions identical to above for each directory and source file we need to check (arrays aren't allowed for src: field) - - uses: psf/black@stable - with: - options: "--check --config python/pyproject.toml" - src: "./cime_config/SystemTests" - version: "22.3.0" - - uses: psf/black@stable - with: - options: "--check --config python/pyproject.toml" - src: "./cime_config/buildlib" - version: "22.3.0" - - uses: psf/black@stable - with: - options: "--check --config python/pyproject.toml" - src: "./cime_config/buildnml" - version: "22.3.0" From ab04d8f761b2eb75516f605e60d9fd94cad38aa7 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 11:53:08 -0700 Subject: [PATCH 15/25] Add --diff to black check workflow. --- .github/workflows/black.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 8e1e05a0ce..c8aaf780d5 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -19,23 +19,23 @@ jobs: with: # Use options and version identical to the conda environment # Using pyproject.toml makes sure this testing is consistent with our python directory testing - options: "--check --config python/pyproject.toml" + options: "--check --diff --config python/pyproject.toml" src: "./python" # Version should be coordinated with the ctsm_pylib conda environment under the python directory version: "22.3.0" # Actions identical to above for each directory and source file we need to check (arrays aren't allowed for src: field) - uses: psf/black@stable with: - options: "--check --config python/pyproject.toml" + options: "--check --diff --config python/pyproject.toml" src: "./cime_config/SystemTests" version: "22.3.0" - uses: psf/black@stable with: - options: "--check --config python/pyproject.toml" + options: "--check --diff --config python/pyproject.toml" src: "./cime_config/buildlib" version: "22.3.0" - uses: psf/black@stable with: - options: "--check --config python/pyproject.toml" + options: "--check --diff --config python/pyproject.toml" src: "./cime_config/buildnml" version: "22.3.0" From 47ad185ce914f8b9a6b8cf2f7dd73e95344a0c99 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 11:55:32 -0700 Subject: [PATCH 16/25] Add python 3.7 to pylint workflow. --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index ecddb9f09c..9c458e5a6a 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} From 8969088e9060997f4dbfcf884442ab2761a2614a Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 11:58:16 -0700 Subject: [PATCH 17/25] Change that to 3.7.9. --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 9c458e5a6a..e22b8cabcf 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.7.9", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} From ae6c5b2253269207a7d1e68794c94f2c6f3489ef Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 13:30:21 -0700 Subject: [PATCH 18/25] Try bumping pylint workflow setup-python version to fix 3.7.9. --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index e22b8cabcf..77b6d6f271 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies From 60d4d9869f0827239bfc01c57a015866d954ab02 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 13:34:56 -0700 Subject: [PATCH 19/25] Move 3.7.9 pylint check to ubuntu-20.04 --- .github/workflows/pylint.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 77b6d6f271..d067b1b2cc 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -5,12 +5,32 @@ name: pylint check on push and PR on: [push, pull_request] jobs: + pylint-check-old: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + python-version: ["3.7.9"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pylint + - name: Analysing the code with pylint + run: | + cd python + pylint --rcfile=ctsm/.pylintrc --fail-under=0 ctsm pylint-check: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - python-version: ["3.7.9", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} From 665e64271868121fa2314fd72b0530971eac7055 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 13:43:59 -0700 Subject: [PATCH 20/25] Pylint workflow now fails on complaints. --- .github/workflows/pylint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index d067b1b2cc..439d89a583 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -24,7 +24,7 @@ jobs: - name: Analysing the code with pylint run: | cd python - pylint --rcfile=ctsm/.pylintrc --fail-under=0 ctsm + pylint --rcfile=ctsm/.pylintrc ctsm pylint-check: runs-on: ubuntu-latest strategy: @@ -44,4 +44,4 @@ jobs: - name: Analysing the code with pylint run: | cd python - pylint --rcfile=ctsm/.pylintrc --fail-under=0 ctsm + pylint --rcfile=ctsm/.pylintrc ctsm From b5752fac04335b7f1fc8a6cc95f35f6fb68e785c Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 13:49:48 -0700 Subject: [PATCH 21/25] pip install requirements in pylint workflow. --- .github/workflows/pylint.yml | 4 ++-- python/requirements.txt | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 439d89a583..9491b885a0 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -20,7 +20,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pylint + pip install -r python/requirements.txt - name: Analysing the code with pylint run: | cd python @@ -40,7 +40,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pylint + pip install -r python/requirements.txt - name: Analysing the code with pylint run: | cd python diff --git a/python/requirements.txt b/python/requirements.txt index 1343e7edb4..18029185b9 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -1,4 +1,14 @@ -Requirements for testing: - -- If using python < 3.3, requires the mock library (this is available in - the standard library in python 3.3+) +pandas +tqdm +scipy +netcdf4 +requests +packaging +numpy +xarray +xesmf +numba +pylint +black +cartopy +matplotlib From 5408f74a7a74d3e64c06be1ee6646b195112ed91 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 14:11:23 -0700 Subject: [PATCH 22/25] pylint workflow > 3.7.9 now ignores warning about useless option for disable. --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 9491b885a0..6a064ef27e 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -44,4 +44,4 @@ jobs: - name: Analysing the code with pylint run: | cd python - pylint --rcfile=ctsm/.pylintrc ctsm + pylint --disable=R0022 --rcfile=ctsm/.pylintrc ctsm From c520d31d2c57ee631f70849d8a1bf0903a2d6d91 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 14:15:44 -0700 Subject: [PATCH 23/25] Lock pylint to version in ctsm_pylib. --- python/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/requirements.txt b/python/requirements.txt index 18029185b9..a3ec8ed98a 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -8,7 +8,7 @@ numpy xarray xesmf numba -pylint +pylint==2.8.3 black cartopy matplotlib From 097e2b3c136524d52d6847da0501bae44cb57c64 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 14:23:30 -0700 Subject: [PATCH 24/25] Restrict pylint workflow to Python versions that work. --- .github/workflows/pylint.yml | 46 ++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 6a064ef27e..df58bfca60 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -5,32 +5,36 @@ name: pylint check on push and PR on: [push, pull_request] jobs: - pylint-check-old: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - python-version: ["3.7.9"] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r python/requirements.txt - - name: Analysing the code with pylint - run: | - cd python - pylint --rcfile=ctsm/.pylintrc ctsm + # Disabled pylint-check-old because 3.7.9 requires netCDF to be manually installed first +# pylint-check-old: +# runs-on: ubuntu-20.04 +# strategy: +# fail-fast: false +# matrix: +# python-version: ["3.7.9"] +# steps: +# - uses: actions/checkout@v4 +# - name: Set up Python ${{ matrix.python-version }} +# uses: actions/setup-python@v5 +# with: +# python-version: ${{ matrix.python-version }} +# - name: Install dependencies +# run: | +# python -m pip install --upgrade pip +# pip install -r python/requirements.txt +# - name: Analysing the code with pylint +# run: | +# cd python +# pylint --rcfile=ctsm/.pylintrc ctsm pylint-check: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + # Python 3.8 fails because GEOS C headers aren't installed + # Our pylint (2.8.3) is incompatible with Python > 3.10 + # python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} From bcb398d59e0ef1c25ccb55007362c3d53cd12288 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 14 Feb 2025 14:29:13 -0700 Subject: [PATCH 25/25] Restrict running of black and pylint workflows. --- .github/workflows/black.yml | 16 +++++++++++++++- .github/workflows/pylint.yml | 14 ++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index c8aaf780d5..92efa6143f 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -2,7 +2,21 @@ name: black check on push and PR # # Run the python formatting in check mode # -on: [push, pull_request] +on: + push: + paths: + - 'python/**' + - 'cime_config/SystemTests/**' + - 'cime_config/buildlib/**' + - 'cime_config/buildnml/**' + - '.github/workflows/black.yml' + pull_request: + paths: + - 'python/**' + - 'cime_config/SystemTests/**' + - 'cime_config/buildlib/**' + - 'cime_config/buildnml/**' + - '.github/workflows/black.yml' jobs: black-check: diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index df58bfca60..13a348e884 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -1,8 +1,18 @@ name: pylint check on push and PR # -# Run the pylint formatting in check mode +# Run the pylint formatting # -on: [push, pull_request] +on: + push: + paths: + - 'python/ctsm/**' + - 'python/requirements.txt' + - '.github/workflows/pylint.yml' + pull_request: + paths: + - 'python/ctsm/**' + - 'python/requirements.txt' + - '.github/workflows/pylint.yml' jobs: # Disabled pylint-check-old because 3.7.9 requires netCDF to be manually installed first