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 bd03c58109..7bce4b6a8e 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 @@ -104,7 +104,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 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 781ee82cdb..228834d93d 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 @@ -91,7 +91,7 @@ jobs: if: matrix.os == 'ubuntu-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 @@ -135,7 +135,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 b50cb50b53..de6dca9c88 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 @@ -183,7 +183,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 95e2e6555f..7d4cb4d15f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -130,26 +130,15 @@ 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") diff --git a/pybamm/expression_tree/concatenations.py b/pybamm/expression_tree/concatenations.py index ce47fc60a8..1a33c68e07 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/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 d32ffe46bc..f4ddb7f1f6 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 9929a250a2..14d2a47fd4 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