diff --git a/.github/workflows/benchmark_on_push.yml b/.github/workflows/benchmark_on_push.yml
index 41eeb7d637..b0da71461e 100644
--- a/.github/workflows/benchmark_on_push.yml
+++ b/.github/workflows/benchmark_on_push.yml
@@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - name: Set up Python 3.8
+ - name: Set up Python 3.12
uses: actions/setup-python@v5
with:
- python-version: 3.8
+ python-version: 3.12
- name: Install Linux system dependencies
run: |
diff --git a/.github/workflows/periodic_benchmarks.yml b/.github/workflows/periodic_benchmarks.yml
index 276724d274..dd5cc39173 100644
--- a/.github/workflows/periodic_benchmarks.yml
+++ b/.github/workflows/periodic_benchmarks.yml
@@ -21,10 +21,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- - name: Set up Python 3.8
+ - name: Set up Python 3.12
uses: actions/setup-python@v5
with:
- python-version: 3.8
+ python-version: 3.12
- name: Install Linux system dependencies
run: |
@@ -58,10 +58,10 @@ jobs:
needs: benchmarks
runs-on: ubuntu-latest
steps:
- - name: Set up Python 3.8
+ - name: Set up Python 3.12
uses: actions/setup-python@v5
with:
- python-version: 3.8
+ python-version: 3.12
- name: Install asv
run: pip install asv
diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml
index bbff62201d..d1c960ec43 100644
--- a/.github/workflows/publish_pypi.yml
+++ b/.github/workflows/publish_pypi.yml
@@ -35,7 +35,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
- python-version: 3.8
+ python-version: 3.11
- name: Get number of cores on Windows
id: get_num_cores
@@ -107,7 +107,7 @@ jobs:
- uses: actions/setup-python@v5
name: Set up Python
with:
- python-version: 3.8
+ python-version: 3.11
- name: Clone pybind11 repo (no history)
run: git clone --depth 1 --branch v2.11.1 https://github.com/pybind/pybind11.git
diff --git a/.github/workflows/run_benchmarks_over_history.yml b/.github/workflows/run_benchmarks_over_history.yml
index 4f7302a4a5..c8d6892e66 100644
--- a/.github/workflows/run_benchmarks_over_history.yml
+++ b/.github/workflows/run_benchmarks_over_history.yml
@@ -23,10 +23,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - name: Set up Python 3.8
+ - name: Set up Python 3.12
uses: actions/setup-python@v5
with:
- python-version: 3.8
+ python-version: 3.12
- name: Install nox and asv
run: pip install -U pip nox asv
- name: Fetch develop branch
@@ -53,10 +53,10 @@ jobs:
needs: benchmarks
runs-on: ubuntu-latest
steps:
- - name: Set up Python 3.8
+ - name: Set up Python 3.12
uses: actions/setup-python@v5
with:
- python-version: 3.8
+ python-version: 3.12
- name: Install asv
run: pip install asv
- name: Checkout pybamm-bench repo
diff --git a/.github/workflows/run_periodic_tests.yml b/.github/workflows/run_periodic_tests.yml
index 5356d4f8ee..5b3fedd6c8 100644
--- a/.github/workflows/run_periodic_tests.yml
+++ b/.github/workflows/run_periodic_tests.yml
@@ -45,7 +45,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
- python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
# Include macOS M1 runners
include:
- os: macos-14
@@ -92,7 +92,7 @@ jobs:
if: matrix.os != 'windows-latest'
run: python -m nox -s pybamm-requires
- - name: Run unit tests for GNU/Linux with Python 3.8, 3.9, 3.10, and 3.12; and for macOS and Windows with all Python versions
+ - name: Run unit tests for GNU/Linux, macOS, and Windows with all Python versions
if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest')
run: python -m nox -s unit
@@ -136,7 +136,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml
index a9d728c6f8..b5b6ec0de4 100644
--- a/.github/workflows/test_on_push.yml
+++ b/.github/workflows/test_on_push.yml
@@ -37,7 +37,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
- python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
# We check coverage on Ubuntu with Python 3.12, so we skip unit tests for it here
exclude:
- os: ubuntu-latest
@@ -185,7 +185,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
- python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
# Include macOS M1 runners
include:
- os: macos-14
diff --git a/.github/workflows/update_version.yml b/.github/workflows/update_version.yml
index 85f85cebe8..eb62469778 100644
--- a/.github/workflows/update_version.yml
+++ b/.github/workflows/update_version.yml
@@ -44,7 +44,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
- python-version: 3.8
+ python-version: 3.12
- name: Install dependencies
run: |
diff --git a/docs/source/user_guide/installation/gnu-linux-mac.rst b/docs/source/user_guide/installation/gnu-linux-mac.rst
index 46f3d1281f..0be4b98e4c 100644
--- a/docs/source/user_guide/installation/gnu-linux-mac.rst
+++ b/docs/source/user_guide/installation/gnu-linux-mac.rst
@@ -95,10 +95,6 @@ Optional - JaxSolver
Users can install ``jax`` and ``jaxlib`` to use the Jax solver.
-.. note::
-
- The Jax solver is only supported for Python versions 3.9 through 3.12.
-
.. code:: bash
pip install "pybamm[jax]"
diff --git a/docs/source/user_guide/installation/install-from-source.rst b/docs/source/user_guide/installation/install-from-source.rst
index edcbdf79aa..827f6c2750 100644
--- a/docs/source/user_guide/installation/install-from-source.rst
+++ b/docs/source/user_guide/installation/install-from-source.rst
@@ -25,7 +25,7 @@ or download the source archive on the repository's homepage.
To install PyBaMM, you will need:
-- Python 3 (PyBaMM supports versions 3.8, 3.9, 3.10, 3.11, and 3.12)
+- Python 3 (PyBaMM supports versions 3.9, 3.10, 3.11, and 3.12)
- The Python headers file for your current Python version.
- A BLAS library (for instance `openblas `_).
- A C compiler (ex: ``gcc``).
diff --git a/docs/source/user_guide/installation/windows.rst b/docs/source/user_guide/installation/windows.rst
index d99d1f2eb2..02d9f8dd29 100644
--- a/docs/source/user_guide/installation/windows.rst
+++ b/docs/source/user_guide/installation/windows.rst
@@ -6,7 +6,7 @@ Windows
Prerequisites
-------------
-To use PyBaMM, you must have Python 3.8, 3.9, 3.10, 3.11, or 3.12 installed.
+To use PyBaMM, you must have Python 3.9, 3.10, 3.11, or 3.12 installed.
To install Python 3 download the installation files from `Python’s
website `__. Make sure to
@@ -71,10 +71,6 @@ Optional - JaxSolver
Users can install ``jax`` and ``jaxlib`` to use the Jax solver.
-.. note::
-
- The Jax solver is only supported for Python versions 3.9 through 3.12.
-
.. code:: bash
pip install "pybamm[jax]"
diff --git a/noxfile.py b/noxfile.py
index 17d466e690..c93f3d808d 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -61,10 +61,7 @@ def run_coverage(session):
"""Run the coverage tests and generate an XML report."""
set_environment_variables(PYBAMM_ENV, session=session)
session.install("coverage", silent=False)
- if sys.version_info < (3, 9):
- session.install("-e", ".[all,dev]", silent=False)
- else:
- session.install("-e", ".[all,dev,jax]", silent=False)
+ session.install("-e", ".[all,dev,jax]", silent=False)
session.run("pytest", "--cov=pybamm", "--cov-report=xml", "tests/unit")
@@ -72,10 +69,7 @@ def run_coverage(session):
def run_integration(session):
"""Run the integration tests."""
set_environment_variables(PYBAMM_ENV, session=session)
- if sys.version_info < (3, 9):
- session.install("-e", ".[all,dev]", silent=False)
- else:
- session.install("-e", ".[all,dev,jax]", silent=False)
+ session.install("-e", ".[all,dev,jax]", silent=False)
session.run("python", "run-tests.py", "--integration")
@@ -90,10 +84,7 @@ def run_doctests(session):
def run_unit(session):
"""Run the unit tests."""
set_environment_variables(PYBAMM_ENV, session=session)
- if sys.version_info < (3, 9):
- session.install("-e", ".[all,dev]", silent=False)
- else:
- session.install("-e", ".[all,dev,jax]", silent=False)
+ session.install("-e", ".[all,dev,jax]", silent=False)
session.run("python", "run-tests.py", "--unit")
@@ -129,36 +120,22 @@ def set_dev(session):
# https://bitbucket.org/pybtex-devs/pybtex/issues/169/replace-pkg_resources-with
# is fixed
session.run(python, "-m", "pip", "install", "setuptools", external=True)
- if sys.version_info < (3, 9):
- session.run(
- python,
- "-m",
- "pip",
- "install",
- "-e",
- ".[all,dev]",
- external=True,
- )
- else:
- session.run(
- python,
- "-m",
- "pip",
- "install",
- "-e",
- ".[all,dev,jax]",
- external=True,
- )
+ session.run(
+ python,
+ "-m",
+ "pip",
+ "install",
+ "-e",
+ ".[all,dev,jax]",
+ external=True,
+ )
@nox.session(name="tests")
def run_tests(session):
"""Run the unit tests and integration tests sequentially."""
set_environment_variables(PYBAMM_ENV, session=session)
- if sys.version_info < (3, 9):
- session.install("-e", ".[all,dev]", silent=False)
- else:
- session.install("-e", ".[all,dev,jax]", silent=False)
+ session.install("-e", ".[all,dev,jax]", silent=False)
session.run("python", "run-tests.py", "--all")
diff --git a/pybamm/expression_tree/concatenations.py b/pybamm/expression_tree/concatenations.py
index a25ac8e0b3..11e695425f 100644
--- a/pybamm/expression_tree/concatenations.py
+++ b/pybamm/expression_tree/concatenations.py
@@ -8,7 +8,7 @@
import numpy as np
import sympy
from scipy.sparse import issparse, vstack
-from typing import Sequence
+from collections.abc import Sequence
import pybamm
diff --git a/pybamm/expression_tree/functions.py b/pybamm/expression_tree/functions.py
index 7f43f0b7c2..6eb301a24c 100644
--- a/pybamm/expression_tree/functions.py
+++ b/pybamm/expression_tree/functions.py
@@ -6,7 +6,8 @@
import numpy as np
from scipy import special
import sympy
-from typing import Sequence, Callable
+from typing import Callable
+from collections.abc import Sequence
from typing_extensions import TypeVar
import pybamm
diff --git a/pybamm/expression_tree/interpolant.py b/pybamm/expression_tree/interpolant.py
index 16714f9db3..10881d3084 100644
--- a/pybamm/expression_tree/interpolant.py
+++ b/pybamm/expression_tree/interpolant.py
@@ -4,7 +4,7 @@
from __future__ import annotations
import numpy as np
from scipy import interpolate
-from typing import Sequence
+from collections.abc import Sequence
import numbers
import pybamm
diff --git a/pybamm/expression_tree/operations/unpack_symbols.py b/pybamm/expression_tree/operations/unpack_symbols.py
index 1933eada76..97e1d08d98 100644
--- a/pybamm/expression_tree/operations/unpack_symbols.py
+++ b/pybamm/expression_tree/operations/unpack_symbols.py
@@ -2,7 +2,8 @@
# Helper function to unpack a symbol
#
from __future__ import annotations
-from typing import TYPE_CHECKING, Sequence
+from typing import TYPE_CHECKING
+from collections.abc import Sequence
if TYPE_CHECKING: # pragma: no cover
import pybamm
diff --git a/pybamm/expression_tree/symbol.py b/pybamm/expression_tree/symbol.py
index 466e5b7be6..d50b8a6c89 100644
--- a/pybamm/expression_tree/symbol.py
+++ b/pybamm/expression_tree/symbol.py
@@ -8,7 +8,8 @@
import sympy
from scipy.sparse import csr_matrix, issparse
from functools import cached_property
-from typing import TYPE_CHECKING, Sequence, cast
+from typing import TYPE_CHECKING, cast
+from collections.abc import Sequence
import pybamm
from pybamm.util import import_optional_dependency
diff --git a/pybamm/solvers/idaklu_jax.py b/pybamm/solvers/idaklu_jax.py
index 9a5315e120..ba1c80c1c4 100644
--- a/pybamm/solvers/idaklu_jax.py
+++ b/pybamm/solvers/idaklu_jax.py
@@ -5,7 +5,6 @@
import numbers
from typing import Union
-from typing import List
from functools import lru_cache
@@ -275,7 +274,7 @@ def jax_value(
self,
t: np.ndarray = None,
inputs: Union[dict, None] = None,
- output_variables: Union[List[str], None] = None,
+ output_variables: Union[list[str], None] = None,
):
"""Helper function to compute the gradient of a jaxified expression
@@ -308,7 +307,7 @@ def jax_grad(
self,
t: np.ndarray = None,
inputs: Union[dict, None] = None,
- output_variables: Union[List[str], None] = None,
+ output_variables: Union[list[str], None] = None,
):
"""Helper function to compute the gradient of a jaxified expression
diff --git a/pybamm/type_definitions.py b/pybamm/type_definitions.py
index c3d0a56faa..376189b41a 100644
--- a/pybamm/type_definitions.py
+++ b/pybamm/type_definitions.py
@@ -1,9 +1,6 @@
-#
-# Common type definitions for PyBaMM
-#
from __future__ import annotations
-from typing import Union, List, Dict
+from typing import Union
from typing_extensions import TypeAlias
import numpy as np
import pybamm
@@ -15,6 +12,6 @@
ChildValue: TypeAlias = Union[float, np.ndarray]
ChildSymbol: TypeAlias = Union[float, np.ndarray, pybamm.Symbol]
-DomainType: TypeAlias = Union[List[str], str, None]
-AuxiliaryDomainType: TypeAlias = Union[Dict[str, str], None]
-DomainsType: TypeAlias = Union[Dict[str, Union[List[str], str]], None]
+DomainType: TypeAlias = Union[list[str], str, None]
+AuxiliaryDomainType: TypeAlias = Union[dict[str, str], None]
+DomainsType: TypeAlias = Union[dict[str, Union[list[str], str]], None]
diff --git a/pyproject.toml b/pyproject.toml
index 07b2909983..b8b1469ece 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -18,7 +18,7 @@ license = { file = "LICENSE.txt" }
description = "Python Battery Mathematical Modelling"
authors = [{name = "The PyBaMM Team", email = "pybamm@pybamm.org"}]
maintainers = [{name = "The PyBaMM Team", email = "pybamm@pybamm.org"}]
-requires-python = ">=3.8, <3.13"
+requires-python = ">=3.9, <3.13"
readme = {file = "README.md", content-type = "text/markdown"}
classifiers = [
"Development Status :: 5 - Production/Stable",
@@ -28,7 +28,6 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
- "Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
@@ -54,7 +53,6 @@ Releases = "https://github.com/pybamm-team/PyBaMM/releases"
Changelog = "https://github.com/pybamm-team/PyBaMM/blob/develop/CHANGELOG.md"
[project.optional-dependencies]
-# For the generation of documentation
docs = [
"sphinx>=6",
"sphinx_rtd_theme>=0.5",
@@ -77,7 +75,6 @@ docs = [
examples = [
"jupyter",
]
-# Plotting functionality
plot = [
"imageio>=2.3.0",
# Note: matplotlib is loaded for debug plots, but to ensure PyBaMM runs
@@ -85,7 +82,6 @@ plot = [
# outside of plot() methods.
"matplotlib>=3.6.0",
]
-# For the Citations class
cite = [
"pybtex>=0.24.0",
]
@@ -97,7 +93,6 @@ bpx = [
tqdm = [
"tqdm",
]
-# Dependencies intended for use by developers
dev = [
# For working with pre-commit hooks
"pre-commit",
diff --git a/scripts/install_KLU_Sundials.py b/scripts/install_KLU_Sundials.py
index c30a3cf3e5..6224e40776 100755
--- a/scripts/install_KLU_Sundials.py
+++ b/scripts/install_KLU_Sundials.py
@@ -1,14 +1,3 @@
-# /// pyproject
-# [run]
-# requires-python = "">=3.8, <3.13""
-# dependencies = [
-# "cmake",
-# ]
-#
-# [additional-info]
-# repository = "https://github.com/pybamm-team/PyBaMM"
-# documentation = "https://docs.pybamm.org"
-# ///
import os
import subprocess
import tarfile