Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4888cde
Add fleximod_test workflow.
samsrabin Feb 14, 2025
25c3f97
Update FATES URL.
samsrabin Feb 14, 2025
d7131a8
Add pylint workflow
samsrabin Feb 14, 2025
efbf914
Name fix in fleximod_test workflow.
samsrabin Feb 14, 2025
4062112
Add versions of python for pylint testing.
samsrabin Feb 14, 2025
b5b858f
Disable fail-fast for pylint workflow.
samsrabin Feb 14, 2025
9d64aac
Remove --check from pylint testing.
samsrabin Feb 14, 2025
b1209ea
Add black_multi_python workflow.
samsrabin Feb 14, 2025
dbd1091
Fix --config path for multi-python black check.
samsrabin Feb 14, 2025
eb36db7
Add Python 3.7.9 to black_multi_python workflow.
samsrabin Feb 14, 2025
e18bc6c
Print diffs in black_multi_python workflow,
samsrabin Feb 14, 2025
ff25076
Add job to black_multi_python that works like black.yml.
samsrabin Feb 14, 2025
21a6bf2
Replace non-working black-check-multi-python job.
samsrabin Feb 14, 2025
a963237
Move multi-python capability into old black.yml.
samsrabin Feb 14, 2025
bbe82e0
Add --diff to black check workflow.
samsrabin Feb 14, 2025
ed7711d
Add python 3.7 to pylint workflow.
samsrabin Feb 14, 2025
f652136
Change that to 3.7.9.
samsrabin Feb 14, 2025
2fb9ca8
Try bumping pylint workflow setup-python version to fix 3.7.9.
samsrabin Feb 14, 2025
fc9cfc5
Move 3.7.9 pylint check to ubuntu-20.04
samsrabin Feb 14, 2025
67f4ab4
Pylint workflow now fails on complaints.
samsrabin Feb 14, 2025
5f86c93
pip install requirements in pylint workflow.
samsrabin Feb 14, 2025
6c81aeb
pylint workflow > 3.7.9 now ignores warning about useless option for …
samsrabin Feb 14, 2025
c7b8270
Lock pylint to version in ctsm_pylib.
samsrabin Feb 14, 2025
1ad6909
Restrict pylint workflow to Python versions that work.
samsrabin Feb 14, 2025
a9c847d
Restrict running of black and pylint workflows.
samsrabin Feb 14, 2025
dd49240
Merge tag 'ctsm5.3.040' into add-github-workflows-20250214
samsrabin Apr 16, 2025
83eedd4
Add miniconda test Workflow.
samsrabin Apr 16, 2025
86935ac
Convert black GH Workflow to use ctsm_pylib.
samsrabin Apr 16, 2025
0073dc3
Delete miniconda Workflow.
samsrabin Apr 16, 2025
781aade
Delete a comment in python/conda_env_ctsm_py.txt.
samsrabin Apr 16, 2025
4cff8fb
Try an actual YML file instead.
samsrabin Apr 17, 2025
6712fe6
Black workflow now checks conda-forge first.
samsrabin Apr 17, 2025
83eb8a4
Fix call of "make black" in Workflow.
samsrabin Apr 17, 2025
7d45c8c
Fix that call again.
samsrabin Apr 17, 2025
3b5c8aa
Replace conda env txt files with yml files.
samsrabin Apr 17, 2025
ad50fc3
Update pylint Workflow to use ctsm_pylib.
samsrabin Apr 17, 2025
576d469
Fix name in ctsm_pylib_3_7_9 yml file.
samsrabin Apr 17, 2025
e637692
Combine black and pylint Workflows.
samsrabin Apr 17, 2025
2b5a781
Delete requirements.txt.
samsrabin Apr 17, 2025
2c2c01d
lint_and_format.yml: Fix handling of failed pylint check.
samsrabin Apr 18, 2025
834fdd8
Merge remote-tracking branch 'upstream/b4b-dev' into add-github-workf…
samsrabin Apr 19, 2025
8d39cb4
Rename Python formatting workflow.
samsrabin Apr 21, 2025
757b1e6
py_env_create: Return $option to environment creation.
samsrabin Apr 21, 2025
441a095
formatting_python.yml: Delete outdated, unneeded paths.
samsrabin Apr 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions .github/workflows/black.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/fleximod_test.yaml
Original file line number Diff line number Diff line change
@@ -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"]
Comment thread
samsrabin marked this conversation as resolved.
steps:
- id: checkout-CTSM
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
Comment thread
samsrabin marked this conversation as resolved.
- id: check-cleanliness
run: |
echo
echo "Checking if git fleximod matches expected externals"
Comment thread
samsrabin marked this conversation as resolved.
echo
git diff --exit-code
44 changes: 44 additions & 0 deletions .github/workflows/formatting_python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Check Python formatting

on:
push:
paths:
- 'python/**'
- 'cime_config/SystemTests/**'
- 'cime_config/buildlib/**'
- 'cime_config/buildnml/**'
pull_request:
paths:
- 'python/**'
- 'cime_config/SystemTests/**'
- 'cime_config/buildlib/**'
- 'cime_config/buildnml/**'

jobs:
lint-and-format-check:
runs-on: ubuntu-latest
steps:
# Checkout the code
- uses: actions/checkout@v4

# Set up the conda environment
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: ctsm_pylib
environment-file: python/conda_env_ctsm_py.yml
channels: conda-forge
auto-activate-base: false

# Run pylint check
- name: Run pylint
run: |
cd python
conda run -n ctsm_pylib make lint
Comment thread
samsrabin marked this conversation as resolved.

# Run black check
- name: Run black
# Run this step even if previous step(s) failed
if: success() || failure()
run: |
cd python
conda run -n ctsm_pylib make black
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ url = https://github.com/NGEET/fates
fxtag = sci.1.82.3_api.39.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
Comment thread
samsrabin marked this conversation as resolved.
Comment thread
samsrabin marked this conversation as resolved.

[submodule "cism"]
path = components/cism
Expand Down
23 changes: 6 additions & 17 deletions py_env_create
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ cd "${SCRIPT_DIR}"
condadir="${SCRIPT_DIR}/python"
default_new_env_name=ctsm_pylib
default_old_env_name=ctsm_pylib_3_7_9
default_condafile="${condadir}/conda_env_ctsm_py.txt"
default_condafile_old="${condadir}/conda_env_ctsm_py_old_3.7.9.txt"
default_condafile="${condadir}/conda_env_ctsm_py.yml"
default_condafile_old="${condadir}/conda_env_ctsm_py_old_3.7.9.yml"

condafile="${default_condafile}"
quiet=""
Expand Down Expand Up @@ -228,26 +228,15 @@ if [[ ${conda_env_does_exist} -gt 0 ]]; then
fi

#
# Create the environment
#
echo "Create $new_env_name"
if [[ "${quiet}" == "--quiet" ]]; then
(set -x; ${condamamba} create ${yes} --name $new_env_name ${quiet} 1>/dev/null)
else
(set -x; ${condamamba} create ${yes} --name $new_env_name ${verbose})
fi

#
# Install the environment
# Create and install the environment
#
echo "Installing $new_env_name; this can take a few minutes."
cmd=""
if [[ "${quiet}" == "--quiet" ]]; then
# -q/--quiet option not available on Derecho
(set -x; ${condamamba} install ${yes} --channel conda-forge --name $new_env_name --file $condafile $option ${quiet} 1>/dev/null)
(set -x; ${condamamba} env create ${yes} --file "${condafile}" --name $new_env_name ${quiet} $option 1>/dev/null)
else
(set -x; ${condamamba} install ${yes} --channel conda-forge --name $new_env_name --file $condafile $option ${verbose})
(set -x; ${condamamba} env create ${yes} --file "${condafile}" --name $new_env_name $option ${verbose})
fi

#
# Report on success
#
Expand Down
27 changes: 0 additions & 27 deletions python/conda_env_ctsm_py.txt

This file was deleted.

22 changes: 22 additions & 0 deletions python/conda_env_ctsm_py.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file is used by py_env_create to install the latest version of the ctsm_pylib conda environment.
name: ctsm_pylib
channels:
- conda-forge
- defaults
dependencies:
- python=3.13.2
- xarray=2025.1.2
- tqdm=4.67.1
- scipy=1.15.2
- netcdf4=1.7.2
- requests=2.32.3
- xesmf=0.8.8
- numba=0.61.0
- pylint=3.3.4
- black=25.1.0
- cartopy=0.24.0
- matplotlib=3.10.1

# Used in ctsm_postprocessing repo
- pytest=8.3.5
- coverage=7.8.0
19 changes: 0 additions & 19 deletions python/conda_env_ctsm_py_old_3.7.9.txt

This file was deleted.

24 changes: 24 additions & 0 deletions python/conda_env_ctsm_py_old_3.7.9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is used by py_env_create to install the previous version of the ctsm_pylib environment,
# which used Python 3.7.9. Doing so is only useful for running CTSM python tools in repos from
# before the new ctsm_pylib version (with Python 3.13.2) was introduced.
#
name: ctsm_pylib_3_7_9
channels:
- conda-forge
- defaults
dependencies:
- python=3.7.9
- pandas=1.3.5
- tqdm=4.67.1
- scipy=1.7.3
- netcdf4=1.6.0
- requests=2.32.2
- packaging=21.3
- numpy=1.19.5
- xarray=0.17.0
- xesmf=0.7.0
- numba=0.55.2
- pylint=2.8.3
- black=22.3.0
- cartopy=0.20.2
- matplotlib=3.3.2