From 8b2a6550d43e7cd9533c12d317235c88324ea36e Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Tue, 20 Feb 2024 11:56:56 +0000 Subject: [PATCH 1/9] bump upper python version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 38bf5f1c6..43928f488 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ readme = "README.md" license = { file = "LICENSE" } # https://pypi.org/classifiers/ classifiers = [] -requires-python = ">=3.8, <3.12" +requires-python = ">=3.8, <3.13" dependencies = [ "pybamm>=23.5", "numpy>=1.16", From 55f3768cdea6187fcbf2e90fac6dbe509269a6c3 Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Tue, 20 Feb 2024 12:01:42 +0000 Subject: [PATCH 2/9] updt test_on_push workflow for 3.12 --- .github/workflows/test_on_push.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_on_push.yaml b/.github/workflows/test_on_push.yaml index a55219bbb..c46662973 100644 --- a/.github/workflows/test_on_push.yaml +++ b/.github/workflows/test_on_push.yaml @@ -35,7 +35,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] exclude: # We run the coverage tests on Ubuntu with Python 3.11 - os: ubuntu-latest python-version: "3.11" @@ -45,6 +45,8 @@ jobs: python-version: "3.10" - os: macos-14 python-version: "3.11" + - os: macos-14 + python-version: "3.12" steps: - uses: actions/checkout@v4 From dc9effed82fc96280bef22e2ac36c936e46cb298 Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Tue, 20 Feb 2024 12:56:07 +0000 Subject: [PATCH 3/9] Updts python matrix for scheduled tests --- scripts/ci/build_matrix.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/build_matrix.sh b/scripts/ci/build_matrix.sh index 49b13d54e..6ef0f6c1f 100644 --- a/scripts/ci/build_matrix.sh +++ b/scripts/ci/build_matrix.sh @@ -9,7 +9,7 @@ # To update the matrix, the variables below can be modified as needed. -python_version=("3.8" "3.9" "3.10" "3.11") +python_version=("3.8" "3.9" "3.10" "3.11" "3.12") os=("ubuntu-latest" "windows-latest" "macos-latest") # This command fetches the last three PyBaMM versions excluding release candidates from PyPI pybamm_version=($(curl -s https://pypi.org/pypi/pybamm/json | jq -r '.releases | keys[]' | grep -v rc | tail -n 3 | awk '{print "\"" $1 "\"" }' | paste -sd " " -)) From 7e8fd4c95eaad2b6dc5b0dc7f0df5d4d912dbec1 Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Tue, 20 Feb 2024 14:04:26 +0000 Subject: [PATCH 4/9] Updt. matrix generation for incompatible pybamm/python versions --- README.md | 2 +- scripts/ci/build_matrix.sh | 28 ++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) mode change 100644 => 100755 scripts/ci/build_matrix.sh diff --git a/README.md b/README.md index 3a3e4881b..b3c9cd324 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ pip install -e "path/to/pybop" To check whether PyBOP has been installed correctly, run one of the examples in the following section. For a development installation, please refer to the [contributing guide](https://github.com/pybop-team/PyBOP/blob/develop/CONTRIBUTING.md#Installation). ### Prerequisites -To use and/or contribute to PyBOP, first install Python (3.8-3.11). On a Debian-based distribution, this looks like: +To use and/or contribute to PyBOP, first install Python (3.8 — 3.12). On a Debian-based distribution, this looks like: ```bash sudo apt update diff --git a/scripts/ci/build_matrix.sh b/scripts/ci/build_matrix.sh old mode 100644 new mode 100755 index 6ef0f6c1f..3ddbae00a --- a/scripts/ci/build_matrix.sh +++ b/scripts/ci/build_matrix.sh @@ -12,22 +12,38 @@ python_version=("3.8" "3.9" "3.10" "3.11" "3.12") os=("ubuntu-latest" "windows-latest" "macos-latest") # This command fetches the last three PyBaMM versions excluding release candidates from PyPI -pybamm_version=($(curl -s https://pypi.org/pypi/pybamm/json | jq -r '.releases | keys[]' | grep -v rc | tail -n 3 | awk '{print "\"" $1 "\"" }' | paste -sd " " -)) +pybamm_version=($(curl -s https://pypi.org/pypi/pybamm/json | jq -r '.releases | keys[]' | grep -v rc | tail -n 3 | paste -sd " " -)) # open dict json='{ "include": [ ' +# Function to check if a PyBaMM version is compatible with a Python version +is_compatible() { + local pybamm_ver="$1" + local py_ver="$2" + + # Compatibility check + if [[ "$pybamm_ver" == "23.5" && "$py_ver" == "3.12" ]]; then + return 1 # Incompatible + elif [[ "$pybamm_ver" == "23.9" && "$py_ver" == "3.12" ]]; then + return 1 # Incompatible + fi + + return 0 # Compatible +} # loop through each combination of variables to generate matrix components for py_ver in "${python_version[@]}"; do for os_type in "${os[@]}"; do for pybamm_ver in "${pybamm_version[@]}"; do - json+='{ - "os": "'$os_type'", - "python_version": "'$py_ver'", - "pybamm_version": '$pybamm_ver' - },' + if is_compatible "$pybamm_ver" "$py_ver"; then + json+='{ + "os": "'$os_type'", + "python_version": "'$py_ver'", + "pybamm_version": "'$pybamm_ver'" + },' + fi done done done From e03cbb51d82e11e578486f2798c9994f920b5aae Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Tue, 20 Feb 2024 14:20:55 +0000 Subject: [PATCH 5/9] updt workflow order to ensure self-hosted runner starts in parallel --- .github/workflows/scheduled_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scheduled_tests.yaml b/.github/workflows/scheduled_tests.yaml index 8bba7a4c2..8e026c3e8 100644 --- a/.github/workflows/scheduled_tests.yaml +++ b/.github/workflows/scheduled_tests.yaml @@ -63,7 +63,7 @@ jobs: shell: python build: - needs: [create_pybamm_matrix] + needs: [create_pybamm_matrix, filter_pybamm_matrix] # Ensure that both matrices are created before running the build job name: Build (${{ matrix.os }}, Python ${{ matrix.python_version }}, PyBaMM ${{ matrix.pybamm_version }}) runs-on: ${{ matrix.os }} strategy: From bab2872025c0bbfba20252997b1c3a0b955ab43c Mon Sep 17 00:00:00 2001 From: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> Date: Tue, 20 Feb 2024 21:31:54 +0000 Subject: [PATCH 6/9] Update .github/workflows/scheduled_tests.yaml Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> --- .github/workflows/scheduled_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scheduled_tests.yaml b/.github/workflows/scheduled_tests.yaml index 8e026c3e8..ded312c2f 100644 --- a/.github/workflows/scheduled_tests.yaml +++ b/.github/workflows/scheduled_tests.yaml @@ -63,7 +63,7 @@ jobs: shell: python build: - needs: [create_pybamm_matrix, filter_pybamm_matrix] # Ensure that both matrices are created before running the build job + needs: [filter_pybamm_matrix] name: Build (${{ matrix.os }}, Python ${{ matrix.python_version }}, PyBaMM ${{ matrix.pybamm_version }}) runs-on: ${{ matrix.os }} strategy: From 98cbe4a1a4d70ceccb88020711498f24874386a2 Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Tue, 20 Feb 2024 21:55:30 +0000 Subject: [PATCH 7/9] Updt to filter with jq --- scripts/ci/build_matrix.sh | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/scripts/ci/build_matrix.sh b/scripts/ci/build_matrix.sh index 3ddbae00a..23e437df6 100755 --- a/scripts/ci/build_matrix.sh +++ b/scripts/ci/build_matrix.sh @@ -18,32 +18,16 @@ pybamm_version=($(curl -s https://pypi.org/pypi/pybamm/json | jq -r '.releases | json='{ "include": [ ' -# Function to check if a PyBaMM version is compatible with a Python version -is_compatible() { - local pybamm_ver="$1" - local py_ver="$2" - - # Compatibility check - if [[ "$pybamm_ver" == "23.5" && "$py_ver" == "3.12" ]]; then - return 1 # Incompatible - elif [[ "$pybamm_ver" == "23.9" && "$py_ver" == "3.12" ]]; then - return 1 # Incompatible - fi - - return 0 # Compatible -} # loop through each combination of variables to generate matrix components for py_ver in "${python_version[@]}"; do for os_type in "${os[@]}"; do for pybamm_ver in "${pybamm_version[@]}"; do - if is_compatible "$pybamm_ver" "$py_ver"; then json+='{ "os": "'$os_type'", "python_version": "'$py_ver'", "pybamm_version": "'$pybamm_ver'" },' - fi done done done @@ -56,4 +40,5 @@ json+=' ] }' -echo "$json" | jq -c . +# Filter out incompatible combinations +echo "$json" | jq -c 'del(.include[] | select(.pybamm_version == "23.5" and .python_version == "3.12"))' From a104554378c442a6349b5900b13eafd3c25df235 Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Wed, 21 Feb 2024 08:30:30 +0000 Subject: [PATCH 8/9] revert build trigger, requires create_matrix for matrix, filter_matrix for timing --- .github/workflows/scheduled_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scheduled_tests.yaml b/.github/workflows/scheduled_tests.yaml index ded312c2f..0ed549f0d 100644 --- a/.github/workflows/scheduled_tests.yaml +++ b/.github/workflows/scheduled_tests.yaml @@ -63,7 +63,7 @@ jobs: shell: python build: - needs: [filter_pybamm_matrix] + needs: [create_pybamm_matrix, filter_pybamm_matrix] name: Build (${{ matrix.os }}, Python ${{ matrix.python_version }}, PyBaMM ${{ matrix.pybamm_version }}) runs-on: ${{ matrix.os }} strategy: From d8071f249d4a1d0e5f063972dd1ce84fc59261a0 Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Wed, 21 Feb 2024 08:57:59 +0000 Subject: [PATCH 9/9] Add 23.9 / 3.12 to filter --- scripts/ci/build_matrix.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/ci/build_matrix.sh b/scripts/ci/build_matrix.sh index 23e437df6..5e580303d 100755 --- a/scripts/ci/build_matrix.sh +++ b/scripts/ci/build_matrix.sh @@ -23,11 +23,11 @@ json='{ for py_ver in "${python_version[@]}"; do for os_type in "${os[@]}"; do for pybamm_ver in "${pybamm_version[@]}"; do - json+='{ - "os": "'$os_type'", - "python_version": "'$py_ver'", - "pybamm_version": "'$pybamm_ver'" - },' + json+='{ + "os": "'$os_type'", + "python_version": "'$py_ver'", + "pybamm_version": "'$pybamm_ver'" + },' done done done @@ -41,4 +41,7 @@ json+=' }' # Filter out incompatible combinations -echo "$json" | jq -c 'del(.include[] | select(.pybamm_version == "23.5" and .python_version == "3.12"))' +json=$(echo "$json" | jq -c 'del(.include[] | select(.pybamm_version == "23.5" and .python_version == "3.12"))') +json=$(echo "$json" | jq -c 'del(.include[] | select(.pybamm_version == "23.9" and .python_version == "3.12"))') + +echo "$json" | jq -c .