Skip to content

Commit 92abe7e

Browse files
authored
Merge pull request #220 from pybop-team/v24.2
Make v24.3
2 parents 9e9c067 + c33f494 commit 92abe7e

File tree

118 files changed

+10456
-2524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+10456
-2524
lines changed

.all-contributorsrc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
"contributions": [
5151
"ideas",
5252
"mentoring",
53-
"review"
53+
"review",
54+
"code",
55+
"test"
5456
]
5557
},
5658
{
@@ -79,6 +81,16 @@
7981
"contributions": [
8082
"financial"
8183
]
84+
},
85+
{
86+
"login": "agriyakhetarpal",
87+
"name": "Agriya Khetarpal",
88+
"avatar_url": "https://avatars.githubusercontent.com/u/74401230?v=4",
89+
"profile": "https://github.com/agriyakhetarpal",
90+
"contributions": [
91+
"code",
92+
"infra"
93+
]
8294
}
8395
],
8496
"contributorsPerLine": 7,

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Description
2+
3+
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
4+
5+
## Issue reference
6+
Fixes # (issue-number)
7+
8+
## Review
9+
Before you mark your PR as ready for review, please ensure that you've considered the following:
10+
- Updated the [CHANGELOG.md](https://github.com/pybop-team/PyBOP/blob/develop/CHANGELOG.md) in reverse chronological order (newest at the top) with a concise description of the changes, including the PR number.
11+
- Noted any breaking changes, including details on how it might impact existing functionality.
12+
13+
## Type of change
14+
- [ ] New Feature: A non-breaking change that adds new functionality.
15+
- [ ] Optimization: A code change that improves performance.
16+
- [ ] Bug Fix: A non-breaking change that addresses an issue.
17+
- [ ] Documentation: Updates to documentation or new documentation for new features.
18+
- [ ] Refactoring: Non-functional changes that improve the codebase.
19+
- [ ] Style: Non-functional changes related to code style (formatting, naming, etc).
20+
- [ ] Testing: Additional tests to improve coverage or confirm functionality.
21+
- [ ] Other: (Insert description of change)
22+
23+
# Key checklist:
24+
25+
- [ ] No style issues: `$ pre-commit run` (or `$ nox -s pre-commit`) (see [CONTRIBUTING.md](https://github.com/pybop-team/PyBOP/blob/develop/CONTRIBUTING.md#installing-and-using-pre-commit) for how to set this up to run automatically when committing locally, in just two lines of code)
26+
- [ ] All unit tests pass: `$ nox -s tests`
27+
- [ ] The documentation builds: `$ nox -s docs`
28+
29+
You can run integration tests, unit tests, and doctests together at once, using `$ nox -s quick`.
30+
31+
## Further checks:
32+
- [ ] Code is well-commented, especially in complex or unclear areas.
33+
- [ ] Added tests that prove my fix is effective or that my feature works.
34+
- [ ] Checked that coverage remains or improves, and added tests if necessary to maintain or increase coverage.
35+
36+
Thank you for contributing to our project! Your efforts help us to deliver great software.

.github/release_workflow.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Release Workflow
2+
3+
This document outlines the release workflow for publishing to PyPI and TestPyPI using GitHub Actions.
4+
5+
## Creating a New Release
6+
7+
To create a new release, follow these steps:
8+
9+
1. **Prepare the Release:**
10+
- Create a new branch for the release (i.e. `v24.XX`) from `develop`.
11+
- Increment the following;
12+
- The version number in the `pyproject.toml` file following CalVer versioning.
13+
- The`CHANGELOG.md` version with the changes for the new version.
14+
- Open a PR to the `main` branch. Once the PR is merged, proceed to the next step.
15+
16+
2. **Tag the Release:**
17+
- Create a new Git tag for the release. For a full release, use a tag like `v24.2`. For a release candidate, use a tag like `v24.2rc.1`.
18+
- Push the tag to the remote repository: `git push origin <tag_name>`.
19+
20+
3. **Create a GitHub Release:**
21+
- Go to the "Releases" section of on GitHub.
22+
- Click "Draft a new release."
23+
- Enter the tag you created in the "Tag version" field.
24+
- Fill in the release title and description. Add any major changes and link to the `CHANGELOG.md` for a list of total changes.
25+
- If it's a pre-release (release candidate), check the "This is a pre-release" checkbox.
26+
- Click "Publish release" to create the release.
27+
28+
4. **Monitor the Workflow:**
29+
- Go to the "Actions" tab of your repository to monitor the workflow's progress.
30+
- The workflow will build the distribution packages and then publish them to PyPI or TestPyPI, depending on whether the release is a full release or a pre-release.
31+
32+
5. **Verify the Release:**
33+
- Check PyPI or TestPyPI to ensure that your package is available and has been updated to the new version.
34+
- Test installing the package using `pip` to ensure everything works as expected.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Initial Source: pybop-team/PyBop
2+
3+
# This workflow periodically runs the benchmarks suite in benchmarks/
4+
# using asv and publish the results, effectively updating
5+
# the display website hosted in the pybop-bench repo
6+
7+
# Steps:
8+
# - Benchmark all commits since the last one that was benchmarked
9+
# - Push results to pybop-bench repo
10+
# - Publish website
11+
name: Benchmarks
12+
on:
13+
# Everyday at 12 pm UTC
14+
schedule:
15+
- cron: "0 12 * * *"
16+
# Make it possible to trigger the
17+
# workflow manually
18+
workflow_dispatch:
19+
20+
jobs:
21+
benchmarks:
22+
runs-on: [self-hosted, macOS, ARM64]
23+
if: github.repository == 'pybop-team/PyBOP'
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Install python & create virtualenv
28+
shell: bash
29+
run: |
30+
eval "$(pyenv init -)"
31+
pyenv install 3.12 -s
32+
pyenv virtualenv 3.12 pybop-312-bench
33+
34+
- name: Install dependencies & run benchmarks
35+
shell: bash
36+
run: |
37+
eval "$(pyenv init -)"
38+
pyenv activate pybop-312-bench
39+
python -m pip install -e .[all,dev]
40+
python -m pip install asv[virtualenv]
41+
python -m asv machine --machine "SelfHostedRunner"
42+
python -m asv run --machine "SelfHostedRunner" NEW --show-stderr -v
43+
44+
- name: Upload results as artifact
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: asv_periodic_results
48+
path: results
49+
50+
- name: Uninstall pyenv-virtualenv & python
51+
if: always()
52+
shell: bash
53+
run: |
54+
eval "$(pyenv init -)"
55+
pyenv activate pybop-312-bench
56+
pyenv uninstall -f $( python --version )
57+
58+
publish-results:
59+
name: Push and publish results
60+
needs: benchmarks
61+
runs-on: ubuntu-latest
62+
if: github.repository == 'pybop-team/PyBOP'
63+
steps:
64+
- name: Set up Python 3.12
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version: 3.12
68+
69+
- name: Install asv
70+
run: pip install asv
71+
72+
- name: Checkout pybop-bench repo
73+
uses: actions/checkout@v4
74+
with:
75+
repository: pybop-team/pybop-bench
76+
token: ${{ secrets.PUSH_BENCH_TOKEN }}
77+
78+
- name: Download results artifact
79+
uses: actions/download-artifact@v4
80+
with:
81+
name: asv_periodic_results
82+
path: new_results
83+
84+
- name: Copy new results and push to pybop-bench repo
85+
env:
86+
PUSH_BENCH_EMAIL: ${{ secrets.PUSH_BENCH_EMAIL }}
87+
PUSH_BENCH_NAME: ${{ secrets.PUSH_BENCH_NAME }}
88+
run: |
89+
cp -vr new_results/* results
90+
git config --global user.email "$PUSH_BENCH_EMAIL"
91+
git config --global user.name "$PUSH_BENCH_NAME"
92+
git add results
93+
git commit -am "Add new benchmark results"
94+
git push
95+
96+
- name: Publish results
97+
run: |
98+
asv publish
99+
git fetch origin gh-pages:gh-pages
100+
asv gh-pages

.github/workflows/release-action.yaml renamed to .github/workflows/release_action.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ jobs:
1515
- name: Set up Python
1616
uses: actions/setup-python@v4
1717
with:
18-
python-version: "3.8"
18+
python-version: "3.12"
1919
- name: Install pypa/build
2020
run: >-
2121
python3 -m
2222
pip install
2323
build
2424
--user
2525
- name: Build a binary wheel and a source tarball
26-
run: python3 -m build
26+
run: python -m build
2727
- name: Store the distribution packages
2828
uses: actions/upload-artifact@v3
2929
with:
@@ -35,9 +35,8 @@ jobs:
3535
Publish Python 🐍 distribution 📦 to PyPI
3636
if: >
3737
startsWith(github.ref, 'refs/tags/') &&
38-
!contains(github.ref, 'rc')
39-
needs:
40-
- build
38+
!contains(github.ref, 'rc') && github.repository == github.event.repository
39+
needs: build
4140
runs-on: ubuntu-latest
4241
environment:
4342
name: pypi
@@ -91,7 +90,7 @@ jobs:
9190
9291
publish-to-testpypi:
9392
name: Publish Python 🐍 distribution 📦 to TestPyPI
94-
if: contains(github.ref, 'rc') # only publish to TestPyPI for rc tags
93+
if: contains(github.ref, 'rc') && github.repository == github.event.repository # only publish to TestPyPI for rc tags
9594
needs:
9695
- build
9796
runs-on: ubuntu-latest

.github/workflows/scheduled_tests.yaml

Lines changed: 79 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,65 +6,125 @@ on:
66
branches:
77
- main
88

9-
# runs every day at 09:00 UTC
9+
# runs every day at 09:00 and 15:00 UTC
1010
schedule:
1111
- cron: '0 9 * * *'
12+
- cron: '0 15 * * *'
13+
14+
# Check noxfile.py for associated environment variables
15+
env:
16+
PYBOP_SCHEDULED: 1
1217

1318
jobs:
19+
# Dynamically create a matrix of OS, Python, and PyBaMM versions
20+
create_pybamm_matrix:
21+
name: Dynamically create GitHub Actions matrix
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Check out PyBOP repository
25+
uses: actions/checkout@v4
26+
with:
27+
sparse-checkout-cone-mode: false
28+
sparse-checkout: |
29+
scripts/ci/build_matrix.sh
30+
31+
- name: Run script to create matrix
32+
id: set-matrix
33+
run: |
34+
echo "matrix=$(bash scripts/ci/build_matrix.sh)" >> "$GITHUB_OUTPUT"
35+
outputs:
36+
pybop_matrix: ${{ steps.set-matrix.outputs.matrix }}
37+
38+
# filter the matrix to only include the macOS-latest entries
39+
filter_pybamm_matrix:
40+
name: Filter the matrix for macOS-latest entries
41+
needs: [create_pybamm_matrix]
42+
runs-on: ubuntu-latest
43+
outputs:
44+
filtered_pybop_matrix: ${{ steps.set-matrix.outputs.matrix }}
45+
steps:
46+
- name: Filter pybop matrix
47+
id: set-matrix
48+
run: |
49+
import json
50+
import os
51+
52+
# Get the matrix
53+
matrix_json = '${{ needs.create_pybamm_matrix.outputs.pybop_matrix }}'
54+
matrix = json.loads(matrix_json)
55+
56+
# Filter the matrix for macOS-latest entries only
57+
filtered_entries = [entry for entry in matrix['include'] if entry['os'] == 'macos-latest']
58+
filtered_matrix = {'include': filtered_entries}
59+
60+
# Set the output variable for other jobs to use
61+
output_file = os.environ['GITHUB_OUTPUT']
62+
with open(output_file, "a", encoding="utf-8") as output_stream:
63+
output_stream.write(f"matrix={json.dumps(filtered_matrix)}\n")
64+
shell: python
65+
1466
build:
67+
needs: [create_pybamm_matrix, filter_pybamm_matrix]
68+
name: Build (${{ matrix.os }}, Python ${{ matrix.python_version }}, PyBaMM ${{ matrix.pybamm_version }})
1569
runs-on: ${{ matrix.os }}
1670
strategy:
1771
fail-fast: false
18-
matrix:
19-
os: [ubuntu-latest, windows-latest, macos-latest]
20-
python-version: ["3.8", "3.9", "3.10", "3.11"]
72+
matrix: ${{fromJson(needs.create_pybamm_matrix.outputs.pybop_matrix)}}
73+
env:
74+
PYBAMM_VERSION: ${{ matrix.pybamm_version }}
2175

2276
steps:
2377
- uses: actions/checkout@v4
24-
- name: Set up Python ${{ matrix.python-version }}
78+
- name: Set up Python ${{ matrix.python_version }}
2579
uses: actions/setup-python@v4
2680
with:
27-
python-version: ${{ matrix.python-version }}
81+
python-version: ${{ matrix.python_version }}
82+
2883
- name: Install dependencies
2984
run: |
3085
python -m pip install --upgrade pip nox
86+
3187
- name: Unit tests with nox
32-
run: |
33-
python -m nox -s unit
34-
python -m nox -s notebooks
88+
run: python -m nox -s coverage
3589

36-
#M-series Mac Mini
90+
- name: Run notebooks with nox
91+
run: python -m nox -s notebooks
92+
93+
# M-series Mac Mini
3794
build-apple-mseries:
95+
needs: [filter_pybamm_matrix]
96+
name: Build (MacOS M-series, Python ${{ matrix.python_version }}, PyBaMM ${{ matrix.pybamm_version }})
3897
runs-on: [self-hosted, macOS, ARM64]
98+
if: github.repository == 'pybop-team/PyBOP'
3999
env:
40100
GITHUB_PATH: ${PYENV_ROOT/bin:$PATH}
101+
PYBAMM_VERSION: ${{ matrix.pybamm_version }}
41102
strategy:
42103
fail-fast: false
43-
matrix:
44-
python-version: ["3.10"]
104+
matrix: ${{fromJson(needs.filter_pybamm_matrix.outputs.filtered_pybop_matrix)}}
45105

46106
steps:
47107
- uses: actions/checkout@v4
48108
- name: Install python & create virtualenv
49109
shell: bash
50110
run: |
51111
eval "$(pyenv init -)"
52-
pyenv install ${{ matrix.python-version }} -s
53-
pyenv virtualenv ${{ matrix.python-version }} pybop-${{ matrix.python-version }}
112+
pyenv install ${{ matrix.python_version }} -s
113+
pyenv virtualenv ${{ matrix.python_version }} pybop-${{ matrix.python_version }}-${{ matrix.pybamm_version }}
54114
55-
- name: Install dependencies & run unit tests
115+
- name: Install dependencies & run unit + notebook tests
56116
shell: bash
57117
run: |
58118
eval "$(pyenv init -)"
59-
pyenv activate pybop-${{ matrix.python-version }}
60-
python -m pip install --upgrade pip wheel setuptools nox
61-
python -m nox -s unit
119+
pyenv activate pybop-${{ matrix.python_version }}-${{ matrix.pybamm_version }}
120+
python -m pip install --upgrade pip nox
121+
python -m nox -s coverage
62122
python -m nox -s notebooks
63123
64124
- name: Uninstall pyenv-virtualenv & python
65125
if: always()
66126
shell: bash
67127
run: |
68128
eval "$(pyenv init -)"
69-
pyenv activate pybop-${{ matrix.python-version }}
129+
pyenv activate pybop-${{ matrix.python_version }}-${{ matrix.pybamm_version }}
70130
pyenv uninstall -f $( python --version )

0 commit comments

Comments
 (0)