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

Remove support for python 3.8 #3961

Merged
merged 13 commits into from
Apr 3, 2024
4 changes: 2 additions & 2 deletions .github/workflows/benchmark_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.11
kratman marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11
kratman marked this conversation as resolved.
Show resolved Hide resolved

- name: Install Linux system dependencies
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/periodic_benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8
- name: Set up Python 3.11
kratman marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11
kratman marked this conversation as resolved.
Show resolved Hide resolved

- name: Install Linux system dependencies
run: |
Expand Down Expand Up @@ -58,10 +58,10 @@ jobs:
needs: benchmarks
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.8
- name: Set up Python 3.11
kratman marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11
kratman marked this conversation as resolved.
Show resolved Hide resolved

- name: Install asv
run: pip install asv
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11
kratman marked this conversation as resolved.
Show resolved Hide resolved

- name: Get number of cores on Windows
id: get_num_cores
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
- uses: actions/setup-python@v5
name: Set up Python
with:
python-version: 3.8
python-version: 3.11
kratman marked this conversation as resolved.
Show resolved Hide resolved

- name: Clone pybind11 repo (no history)
run: git clone --depth 1 --branch v2.11.1 https://github.com/pybind/pybind11.git
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/run_benchmarks_over_history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.11
kratman marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11
kratman marked this conversation as resolved.
Show resolved Hide resolved
- name: Install nox and asv
run: pip install -U pip nox asv
- name: Fetch develop branch
Expand All @@ -53,10 +53,10 @@ jobs:
needs: benchmarks
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.8
- name: Set up Python 3.11
kratman marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11
kratman marked this conversation as resolved.
Show resolved Hide resolved
- name: Install asv
run: pip install asv
- name: Checkout pybamm-bench repo
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
kratman marked this conversation as resolved.
Show resolved Hide resolved
run: python -m nox -s unit

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11
kratman marked this conversation as resolved.
Show resolved Hide resolved

- name: Install dependencies
run: |
Expand Down
4 changes: 0 additions & 4 deletions docs/source/user_guide/installation/gnu-linux-mac.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.openblas.net/>`_).
- A C compiler (ex: ``gcc``).
Expand Down
6 changes: 1 addition & 5 deletions docs/source/user_guide/installation/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.python.org/downloads/windows/>`__. Make sure to
Expand Down Expand Up @@ -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]"
Expand Down
49 changes: 13 additions & 36 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,15 @@ 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")


@nox.session(name="integration")
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")


Expand All @@ -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")


Expand Down Expand Up @@ -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")


Expand Down
2 changes: 1 addition & 1 deletion pybamm/expression_tree/concatenations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion pybamm/expression_tree/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pybamm/expression_tree/interpolant.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pybamm/expression_tree/operations/unpack_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pybamm/expression_tree/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions pybamm/solvers/idaklu_jax.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import numbers

from typing import Union
from typing import List

from functools import lru_cache

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
11 changes: 4 additions & 7 deletions pybamm/type_definitions.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]
Loading
Loading