Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3.12 #209

Merged
merged 9 commits into from
Feb 21, 2024
2 changes: 1 addition & 1 deletion .github/workflows/scheduled_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
BradyPlanden marked this conversation as resolved.
Show resolved Hide resolved
name: Build (${{ matrix.os }}, Python ${{ matrix.python_version }}, PyBaMM ${{ matrix.pybamm_version }})
runs-on: ${{ matrix.os }}
strategy:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
30 changes: 23 additions & 7 deletions scripts/ci/build_matrix.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,41 @@

# 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 " " -))
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
}
BradyPlanden marked this conversation as resolved.
Show resolved Hide resolved

# 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
Expand Down
Loading