Skip to content

Commit

Permalink
Remove support for python 3.8 (pybamm-team#3961)
Browse files Browse the repository at this point in the history
* Remove python 3.8

* More nox fixes

* style: pre-commit fixes

* Pre-commit

* Pre-commit fixes

* Changing Jax version

* Temporary fix

* Remove notes

* Apply suggestions from code review

Co-authored-by: Agriya Khetarpal <[email protected]>

* Update .github/workflows/update_version.yml

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Agriya Khetarpal <[email protected]>
  • Loading branch information
3 people authored and js1tr3 committed Aug 12, 2024
1 parent 3a7d7c6 commit 6cdf966
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 78 deletions.
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.12
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.12

- 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.12
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.12

- 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.12
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.12

- 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

- name: Get number of cores on Windows
id: get_num_cores
Expand Down Expand Up @@ -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
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.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
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.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
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 @@ -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

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

- 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
29 changes: 9 additions & 20 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
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/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]
7 changes: 1 addition & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ license = { file = "LICENSE.txt" }
description = "Python Battery Mathematical Modelling"
authors = [{name = "The PyBaMM Team", email = "[email protected]"}]
maintainers = [{name = "The PyBaMM Team", email = "[email protected]"}]
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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -77,15 +75,13 @@ docs = [
examples = [
"jupyter",
]
# Plotting functionality
plot = [
"imageio>=2.3.0",
# Note: matplotlib is loaded for debug plots, but to ensure PyBaMM runs
# on systems without an attached display, it should never be imported
# outside of plot() methods.
"matplotlib>=3.6.0",
]
# For the Citations class
cite = [
"pybtex>=0.24.0",
]
Expand All @@ -97,7 +93,6 @@ bpx = [
tqdm = [
"tqdm",
]
# Dependencies intended for use by developers
dev = [
# For working with pre-commit hooks
"pre-commit",
Expand Down
11 changes: 0 additions & 11 deletions scripts/install_KLU_Sundials.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 6cdf966

Please sign in to comment.