Skip to content

Commit

Permalink
Merge branch 'develop' into fix_3664
Browse files Browse the repository at this point in the history
  • Loading branch information
arjxn-py committed Feb 1, 2024
2 parents 68c3494 + 705baff commit c0aeb42
Show file tree
Hide file tree
Showing 71 changed files with 863 additions and 571 deletions.
18 changes: 18 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,24 @@
"bug",
"code"
]
},
{
"login": "Akhil-Sharma30",
"name": "AKHIL SHARMA",
"avatar_url": "https://avatars.githubusercontent.com/u/68015525?v=4",
"profile": "http://akhilsharma.info",
"contributions": [
"doc"
]
},
{
"login": "HarshvirSandhu",
"name": "Harshvir Sandhu",
"avatar_url": "https://avatars.githubusercontent.com/u/75773763?v=4",
"profile": "https://github.com/HarshvirSandhu",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lychee_url_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

# cache Lychee results to avoid hitting rate limits
- name: Restore lychee cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
Expand All @@ -28,7 +28,7 @@ jobs:

# use stable version for now to avoid breaking changes
- name: Lychee URL checker
uses: lycheeverse/lychee-action@v1.9.1
uses: lycheeverse/lychee-action@v1.9.3
with:
# arguments with file types to check
args: >-
Expand Down
46 changes: 40 additions & 6 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
.\bootstrap-vcpkg.bat
- name: Cache packages installed through vcpkg on Windows
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: vckpg_binary_cache
with:
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair -w {dest_dir} {wheel}
CIBW_TEST_COMMAND: python -c "import pybamm; pybamm.IDAKLUSolver()"

- name: Build wheels on macOS
- name: Build wheels on macOS amd64
if: matrix.os == 'macos-latest'
run: pipx run cibuildwheel --output-dir wheelhouse
env:
Expand All @@ -150,11 +150,45 @@ jobs:
path: ./wheelhouse/*.whl
if-no-files-found: error

- name: Upload wheels for macOS
- name: Upload wheels for macOS amd64
uses: actions/upload-artifact@v4
if: matrix.os == 'macos-latest'
with:
name: macos_wheels
name: macos_amd64_wheels
path: ./wheelhouse/*.whl
if-no-files-found: error

build_macos_arm64_wheels:
name: Wheels (macos-arm64)
# Current runner is macOS X 14+ on GitHub-hosted runners
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Clone pybind11 repo (no history)
run: git clone --depth 1 --branch v2.11.1 https://github.com/pybind/pybind11.git

- name: Install SuiteSparse and SUNDIALS on macOS
run: |
brew install graphviz openblas libomp
brew reinstall gcc
python -m pip install cmake pipx
python scripts/install_KLU_Sundials.py
- name: Build wheels on macOS arm64
run: python -m pipx run cibuildwheel --output-dir wheelhouse
env:
CIBW_BEFORE_BUILD: python -m pip install cmake casadi setuptools wheel delocate
CIBW_REPAIR_WHEEL_COMMAND: delocate-listdeps {wheel} && delocate-wheel -v -w {dest_dir} {wheel}
CIBW_TEST_COMMAND: python -c "import pybamm; pybamm.IDAKLUSolver()"

- name: Upload wheels for macOS arm64
uses: actions/upload-artifact@v4
with:
name: macos_arm64_wheels
path: ./wheelhouse/*.whl
if-no-files-found: error

Expand Down Expand Up @@ -182,7 +216,7 @@ jobs:
# This job is only of value to PyBaMM and would always be skipped in forks
if: github.event_name != 'schedule' && github.repository == 'pybamm-team/PyBaMM'
name: Upload package to PyPI
needs: [build_macos_and_linux_wheels, build_windows_wheels, build_sdist]
needs: [build_macos_and_linux_wheels, build_macos_arm64_wheels, build_windows_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
Expand All @@ -191,7 +225,7 @@ jobs:
- name: Move all package files to files/
run: |
mkdir files
mv windows_wheels/* linux_wheels/* macos_wheels/* sdist/* files/
mv windows_wheels/* linux_wheels/* macos_amd64_wheels/* macos_arm64_wheels/* sdist/* files/
- name: Publish on PyPI
if: github.event.inputs.target == 'pypi' || github.event_name == 'release'
Expand Down
48 changes: 40 additions & 8 deletions .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,21 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
# Include macOS M1 runners
include:
- os: macos-14
python-version: "3.10"
- os: macos-14
python-version: "3.11"
- os: macos-14
python-version: "3.12"

steps:
- uses: actions/checkout@v4
- name: Check out PyBaMM repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -89,7 +101,7 @@ jobs:

- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v3.1.5

- name: Run integration tests
run: python -m nox -s integration
Expand Down Expand Up @@ -127,35 +139,47 @@ jobs:
runs-on: [self-hosted, macOS, ARM64]
env:
GITHUB_PATH: ${PYENV_ROOT/bin:$PATH}
LD_LIBRARY_PATH: $HOME/.local/lib
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Install python & create virtualenv
- name: Install Python & create virtualenv
shell: bash
run: |
eval "$(pyenv init -)"
pyenv install ${{ matrix.python-version }} -s
pyenv virtualenv ${{ matrix.python-version }} pybamm-${{ matrix.python-version }}
- name: Install dependencies & run unit tests for Windows and MacOS
- name: Install build-time dependencies & run unit tests for M-series macOS runner
shell: bash
env:
# Point scikits.odes to the correct SUNDIALS installation
SUNDIALS_INST: $HOME/.local/lib
# Homebrew environment variables
HOMEBREW_NO_INSTALL_CLEANUP: 1
NONINTERACTIVE: 1
run: |
eval "$(pyenv init -)"
pyenv activate pybamm-${{ matrix.python-version }}
python -m pip install --upgrade pip wheel setuptools nox
python -m pip install --upgrade pip nox
# Don't use Homebrew to install SUNDIALS because scikits.odes looks for
# in Homebrew folders instead, which we don't want
brew uninstall sundials --force
pip cache remove scikits.odes
python -m nox -s pybamm-requires -- --force
python -m nox -s unit
- name: Run integration tests for Windows and MacOS
- name: Run integration tests for M-series macOS runner
run: |
eval "$(pyenv init -)"
pyenv activate pybamm-${{ matrix.python-version }}
python -m nox -s integration
- name: Uninstall pyenv-virtualenv & python
- name: Uninstall pyenv-virtualenv & Python
if: always()
shell: bash
run: |
Expand All @@ -169,8 +193,16 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
# Include macOS M1 runners
include:
- os: macos-14
python-version: "3.10"
- os: macos-14
python-version: "3.11"
- os: macos-14
python-version: "3.12"
fail-fast: false
name: Test pybamm_install_odes on ${{ matrix.os }}
name: Test pybamm_install_odes (${{ matrix.os }} / Python ${{ matrix.python-version }})

steps:
- name: Check out PyBaMM repository
Expand Down
34 changes: 26 additions & 8 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ jobs:
exclude:
- os: ubuntu-latest
python-version: "3.11"
# Include macOS M1 runners
include:
- os: macos-14
python-version: "3.10"
- os: macos-14
python-version: "3.11"
- os: macos-14
python-version: "3.12"
name: Unit tests (${{ matrix.os }} / Python ${{ matrix.python-version }})

steps:
Expand All @@ -66,7 +74,7 @@ jobs:
sudo apt-get install libopenblas-dev texlive-latex-extra dvipng
- name: Install macOS system dependencies
if: matrix.os == 'macos-latest'
if: matrix.os == 'macos-latest' || matrix.os == 'macos-14'
env:
# Homebrew environment variables
HOMEBREW_NO_INSTALL_CLEANUP: 1
Expand Down Expand Up @@ -95,7 +103,7 @@ jobs:
run: python -m pip install nox

- name: Cache pybamm-requires nox environment for GNU/Linux and macOS
uses: actions/cache@v3
uses: actions/cache@v4
if: matrix.os != 'windows-latest'
with:
path: |
Expand Down Expand Up @@ -152,7 +160,7 @@ jobs:
run: python -m pip install nox

- name: Cache pybamm-requires nox environment for GNU/Linux
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
# Repository files
Expand All @@ -170,7 +178,7 @@ jobs:
run: python -m nox -s coverage

- name: Upload coverage report
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v3.1.5

run_integration_tests:
needs: style
Expand All @@ -180,6 +188,14 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
# Include macOS M1 runners
include:
- os: macos-14
python-version: "3.10"
- os: macos-14
python-version: "3.11"
- os: macos-14
python-version: "3.12"
name: Integration tests (${{ matrix.os }} / Python ${{ matrix.python-version }})

steps:
Expand All @@ -203,7 +219,7 @@ jobs:
sudo apt-get install libopenblas-dev texlive-latex-extra dvipng
- name: Install macOS system dependencies
if: matrix.os == 'macos-latest'
if: matrix.os == 'macos-latest' || matrix.os == 'macos-14'
env:
# Homebrew environment variables
HOMEBREW_NO_INSTALL_CLEANUP: 1
Expand Down Expand Up @@ -232,7 +248,7 @@ jobs:
run: python -m pip install nox

- name: Cache pybamm-requires nox environment for GNU/Linux and macOS
uses: actions/cache@v3
uses: actions/cache@v4
if: matrix.os != 'windows-latest'
with:
path: |
Expand Down Expand Up @@ -263,6 +279,8 @@ jobs:
steps:
- name: Check out PyBaMM repository
uses: actions/checkout@v4
with:
fetch-depth: 0

# Install and cache apt packages
- name: Install Linux system dependencies
Expand Down Expand Up @@ -331,7 +349,7 @@ jobs:
run: python -m pip install nox

- name: Cache pybamm-requires nox environment for GNU/Linux
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
# Repository files
Expand Down Expand Up @@ -385,7 +403,7 @@ jobs:
run: python -m pip install nox

- name: Cache pybamm-requires nox environment for GNU/Linux
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
# Repository files
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 @@ -82,7 +82,7 @@ jobs:
# create a pull request updating versions in develop
- name: Create Pull Request
id: version_pr
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v5
with:
delete-branch: true
branch-suffix: short-commit-hash
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.13"
rev: "v0.1.14"
hooks:
- id: ruff
args: [--fix, --show-fixes]
Expand Down
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# [Unreleased](https://github.com/pybamm-team/PyBaMM/)

## Features

- Added support for macOS arm64 (M-series) platforms. ([#3789](https://github.com/pybamm-team/PyBaMM/pull/3789))
- Renamed "electrode diffusivity" to "particle diffusivity" as a non-breaking change with a deprecation warning ([#3624](https://github.com/pybamm-team/PyBaMM/pull/3624))
- Add support for BPX version 0.4.0 which allows for blended electrodes and user-defined parameters in BPX([#3414](https://github.com/pybamm-team/PyBaMM/pull/3414))
- Added the ability to specify a custom solver tolerance in `get_initial_stoichiometries` and related functions ([#3714](https://github.com/pybamm-team/PyBaMM/pull/3714))

## Bug Fixes

- Updated `_steps_util.py` to throw a specific exception when drive cycle starts at t>0 ([#3756](https://github.com/pybamm-team/PyBaMM/pull/3756))
- Updated `plot_voltage_components.py` to support both `Simulation` and `Solution` objects. Added new methods in both `Simulation` and `Solution` classes for allow the syntax `simulation.plot_voltage_components` and `solution.plot_voltage_components`. Updated `test_plot_voltage_components.py` to reflect these changes ([#3723](https://github.com/pybamm-team/PyBaMM/pull/3723)).
- The SEI thickness decreased at some intervals when the 'electron-migration limited' model was used. It has been corrected ([#3622](https://github.com/pybamm-team/PyBaMM/pull/3622))

# [v24.1rc1](https://github.com/pybamm-team/PyBaMM/tree/v24.1rc1) - 2024-01-17
## Breaking changes

- Dropped support for BPX version 0.3.0 and below ([#3414](https://github.com/pybamm-team/PyBaMM/pull/3414))

# [v24.1](https://github.com/pybamm-team/PyBaMM/tree/v24.1) - 2024-01-31

## Features

Expand All @@ -23,6 +35,7 @@

## Bug fixes

- Fixed a bug that lead to a `ShapeError` when specifying "Ambient temperature [K]" as an `Interpolant` with an isothermal model ([#3761](https://github.com/pybamm-team/PyBaMM/pull/3761))
- Fixed a bug where if the first step(s) in a cycle are skipped then the cycle solution started from the model's initial conditions instead of from the last state of the previous cycle ([#3708](https://github.com/pybamm-team/PyBaMM/pull/3708))
- Fixed a bug where the lumped thermal model conflates cell volume with electrode volume ([#3707](https://github.com/pybamm-team/PyBaMM/pull/3707))
- Reverted a change to the coupled degradation example notebook that caused it to be unstable for large numbers of cycles ([#3691](https://github.com/pybamm-team/PyBaMM/pull/3691))
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ keywords:
- "expression tree"
- "python"
- "symbolic differentiation"
version: "24.1rc1"
version: "24.1"
repository-code: "https://github.com/pybamm-team/PyBaMM"
title: "Python Battery Mathematical Modelling (PyBaMM)"
Loading

0 comments on commit c0aeb42

Please sign in to comment.