Skip to content

Commit

Permalink
Merge branch 'pybamm-team:develop' into scheduled-scripts-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal authored Sep 19, 2023
2 parents e098ccf + 8da245e commit e4cb2a4
Show file tree
Hide file tree
Showing 21 changed files with 447 additions and 261 deletions.
3 changes: 2 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,8 @@
"profile": "https://github.com/kratman",
"contributions": [
"doc",
"infra"
"infra",
"bug"
]
}
],
Expand Down
14 changes: 0 additions & 14 deletions .github/release_checklist.md

This file was deleted.

9 changes: 9 additions & 0 deletions .github/release_reminder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Create {{ date | date('YY.MM') }} (final or rc0) release
---
Quarterly reminder to create a -

1. pre-release if the month has just started.
2. non-pre-release if the month is about to end (**before the end of the month**).

See [Release Workflow](./release_workflow.md) for more information.
74 changes: 74 additions & 0 deletions .github/release_workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Release workflow

This file contains the workflow required to make a `PyBaMM` release on GitHub and PyPI by the maintainers.

## rc0 releases (automated)

1. The `update_version.yml` workflow will run on every 1st of January, May and September, updating incrementing the version to `YY.MMrc0` by running `scripts/update_version.py` in the following files -

- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`

These changes will be automatically pushed to a new branch `YY.MM`.

2. Create a new GitHub _pre-release_ with the tag `YY.MMrc0` from the `YY.MM` branch and a description copied from `CHANGELOG.md`.

3. This release will automatically trigger `publish_pypi.yml` and create a _pre-release_ on PyPI.

## rcX releases (manual)

If a new release candidate is required after the release of `rc0` -

1. Fix a bug in `YY.MM` (no new features should be added to `YY.MM` once `rc0` is released) and `develop` individually.

2. Run `update_version.yml` manually while using `append_to_tag` to specify the release candidate version number (`rc1`, `rc2`, ...).

3. This will increment the version to `YY.MMrcX` by running `scripts/update_version.py` in the following files -

- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`

These changes will be automatically pushed to the existing branch `YY.MM`.

4. Create a new GitHub _pre-release_ with the same tag (`YY.MMrcX`) from the `YY.MM` branch and a description copied from `CHANGELOG.md`.

5. This release will automatically trigger `publish_pypi.yml` and create a _pre-release_ on PyPI.

## Actual release (manual)

Once satisfied with the release candidates -

1. Run `update_version.yml` manually, leaving the `append_to_tag` field blank ("") for an actual release.

2. This will increment the version to `YY.MMrcX` by running `scripts/update_version.py` in the following files -

- `pybamm/version.py`
- `docs/conf.py`
- `CITATION.cff`
- `vcpkg.json`
- `docs/_static/versions.json`
- `CHANGELOG.md`

These changes will be automatically pushed to the existing branch `YY.MM`.

3. Next, a PR from `YY.MM` to `main` will be generated that should be merged once all the tests pass.

4. Create a new GitHub _release_ with the same tag from the `main` branch and a description copied from `CHANGELOG.md`.

5. This release will automatically trigger `publish_pypi.yml` and create a _release_ on PyPI.

## Other checks

Some other essential things to check throughout the release process -

- If updating our custom vcpkg registory entries [pybamm-team/sundials-vcpkg-registry](https://github.com/pybamm-team/sundials-vcpkg-registry) or [pybamm-team/casadi-vcpkg-registry](https://github.com/pybamm-team/casadi-vcpkg-registry) (used to build Windows wheels), make sure to update the baseline of the registories in vcpkg-configuration.json to the latest commit id.
- Update jax and jaxlib to the latest version in `pybamm.util` and `setup.py`, fixing any bugs that arise
- Make sure the URLs in `docs/_static/versions.json` are valid
50 changes: 0 additions & 50 deletions .github/workflows/create_release.yml

This file was deleted.

17 changes: 7 additions & 10 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Build and publish package to PyPI

on:
push:
branches: main
release:
types: [published]
workflow_dispatch:
inputs:
target:
description: 'Deployment target. Can be "pypi" or "testpypi"'
default: "pypi"
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false

jobs:
build_windows_wheels:
Expand Down Expand Up @@ -130,15 +130,12 @@ jobs:
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: 3.8

- name: Install dependencies
run: pip install wheel
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/release_reminder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Create a release reminder

on:
schedule:
# Run at 10 am UTC on days-of-month 1 and 28 in January, May, and September.
- cron: "0 10 1,28 1,5,9 *"

permissions:
contents: read
issues: write

jobs:
remind:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/release_reminder.md
68 changes: 45 additions & 23 deletions .github/workflows/update_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,73 @@ name: Update version

on:
workflow_dispatch:
inputs:
append_to_tag:
description: 'Leave blank for an actual release or "rc1", "rc2", ..., for release candidates."'
default: ""
schedule:
# Run at 10 am UTC on day-of-month 1 in January, May, and September.
- cron: "0 10 1 1,5,9 *"

jobs:
update-version:
# This workflow is only of value to PyBaMM and would always be skipped in forks
if: github.repository_owner == 'pybamm-team'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]

steps:
- name: Get current date for the first release candidate
if: github.event_name == 'schedule'
run: |
echo "VERSION=$(date +'v%y.%-m')rc0" >> $GITHUB_ENV
echo "NON_RC_VERSION=$(date +'v%y.%-m')" >> $GITHUB_ENV
- name: Get current date for a manual release
if: github.event_name == 'workflow_dispatch'
run: |
echo "VERSION=$(date +'v%y.%-m')${{ github.event.inputs.append_to_tag }}" >> $GITHUB_ENV
echo "NON_RC_VERSION=$(date +'v%y.%-m')" >> $GITHUB_ENV
- uses: actions/checkout@v4
if: github.event_name == 'schedule'
with:
ref: 'develop'

- uses: actions/checkout@v4
if: github.event_name == 'workflow_dispatch'
with:
ref: '${{ env.NON_RC_VERSION }}'

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: 3.8

- name: Install dependencies
run: |
pip install wheel
pip install --editable .
- name: Get current date
run: echo "VERSION=$(date +'v%y.%-m')" >> $GITHUB_ENV
pip install --editable ".[all]"
- name: Update version
run: python scripts/update_version.py

- name: Create Pull Request
id: version_pr
uses: peter-evans/create-pull-request@v5
- uses: EndBug/add-and-commit@v9
if: github.event_name == 'schedule'
with:
delete-branch: true
branch-suffix: short-commit-hash
commit-message: Update version to ${{ env.VERSION }}
title: Update to ${{ env.VERSION }}
body: |
- [x] Update to ${{ env.VERSION }}
- [ ] Check the [release checklist](https://github.com/pybamm-team/PyBaMM/blob/develop/.github/release_checklist.md)
- name: Make a PR from develop to main
message: 'Bump to ${{ env.VERSION }}'
new_branch: '${{ env.NON_RC_VERSION }}'

- uses: EndBug/add-and-commit@v9
if: github.event_name == 'workflow_dispatch'
with:
message: 'Bump to ${{ env.VERSION }}'

- name: Make a PR from ${{ env.NON_RC_VERSION }} to main
if: github.event_name == 'workflow_dispatch' && !startsWith(github.event.inputs.append_to_tag, 'rc')
uses: repo-sync/pull-request@v2
with:
source_branch: '${{ env.NON_RC_VERSION }}'
destination_branch: "main"
pr_title: "Make release ${{ env.VERSION }}"
pr_body: "**DO NOT MERGE UNTIL #${{ steps.version_pr.outputs.pull-request-number }} IS MERGED.**<br><br>Make release ${{ env.VERSION }}"
pr_title: "Make release ${{ env.NON_RC_VERSION }}"
pr_body: "**Check the [release workflow](https://github.com/pybamm-team/PyBaMM/blob/develop/.github/release_workflow.md)**"
github_token: ${{ secrets.GITHUB_TOKEN }}
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.0.288"
rev: "v0.0.290"
hooks:
- id: ruff
args: [--fix, --ignore=E741, --exclude=__init__.py]
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Fixed a bug that caused incorrect results of “{Domain} electrode thickness change [m]” due to the absence of dimension for the variable `electrode_thickness_change`([#3329](https://github.com/pybamm-team/PyBaMM/pull/3329)).
- Fixed a bug that occured in `check_ys_are_not_too_large` when trying to reference `y-slice` where the referenced variable was not a `pybamm.StateVector` ([#3313](https://github.com/pybamm-team/PyBaMM/pull/3313)
- Fixed a bug with `_Heaviside._evaluate_for_shape` which meant some expressions involving heaviside function and subtractions did not work ([#3306](https://github.com/pybamm-team/PyBaMM/pull/3306))
- Fixed bug causing incorrect activation energies using `create_from_bpx()` ([#3242](https://github.com/pybamm-team/PyBaMM/pull/3242))
- The `OneDimensionalX` thermal model has been updated to account for edge/tab cooling and account for the current collector volumetric heat capacity. It now gives the correct behaviour compared with a lumped model with the correct total heat transfer coefficient and surface area for cooling. ([#3042](https://github.com/pybamm-team/PyBaMM/pull/3042))
- Fixed a bug where the "basic" lithium-ion models gave incorrect results when using nonlinear particle diffusivity ([#3207](https://github.com/pybamm-team/PyBaMM/pull/3207))
- Particle size distributions now work with SPMe and NewmanTobias models ([#3207](https://github.com/pybamm-team/PyBaMM/pull/3207))
Expand All @@ -22,12 +23,15 @@
- Error generated when invalid parameter values are passed ([#3132](https://github.com/pybamm-team/PyBaMM/pull/3132))
- Parameters in `Prada2013` have been updated to better match those given in the paper, which is a 2.3 Ah cell, instead of the mix-and-match with the 1.1 Ah cell from Lain2019 ([#3096](https://github.com/pybamm-team/PyBaMM/pull/3096))

## Optimizations

- Improved how steps are processed in simulations to reduce memory usage ([#3261](https://github.com/pybamm-team/PyBaMM/pull/3261))

## Breaking changes

- The class `pybamm.thermal.OneDimensionalX` has been moved to `pybamm.thermal.pouch_cell.OneDimensionalX` to reflect the fact that the model formulation implicitly assumes a pouch cell geometry ([#3257](https://github.com/pybamm-team/PyBaMM/pull/3257))
- The "lumped" thermal option now always used the parameters "Cell cooling surface area [m2]", "Cell volume [m3]" and "Total heat transfer coefficient [W.m-2.K-1]" to compute the cell cooling regardless of the chosen "cell geometry" option. The user must now specify the correct values for these parameters instead of them being calculated based on e.g. a pouch cell. An `OptionWarning` is raised to let users know to update their parameters ([#3257](https://github.com/pybamm-team/PyBaMM/pull/3257))
- Numpy functions now work with PyBaMM symbols (e.g. `np.exp(pybamm.Symbol("a"))` returns `pybamm.Exp(pybamm.Symbol("a"))`). This means that parameter functions can be specified using numpy functions instead of pybamm functions. Additionally, combining numpy arrays with pybamm objects now works (the numpy array is converted to a pybamm array) ([#3205](https://github.com/pybamm-team/PyBaMM/pull/3205))
- Added option to use an empirical hysteresis model for the diffusivity and exchange-current density ([#3194](https://github.com/pybamm-team/PyBaMM/pull/3194))
- Double-layer capacity can now be provided as a function of temperature ([#3174](https://github.com/pybamm-team/PyBaMM/pull/3174))
- `pybamm_install_jax` is deprecated. It is now replaced with `pip install pybamm[jax]` ([#3163](https://github.com/pybamm-team/PyBaMM/pull/3163))
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[![code style](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-62-orange.svg)](#-contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-63-orange.svg)](#-contributors)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

</div>
Expand Down Expand Up @@ -264,7 +264,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tommaull"><img src="https://avatars.githubusercontent.com/u/101814207?v=4?s=100" width="100px;" alt="Tom Maull"/><br /><sub><b>Tom Maull</b></sub></a><br /><a href="https://github.com/pybamm-team/PyBaMM/commits?author=tommaull" title="Code">💻</a> <a href="https://github.com/pybamm-team/PyBaMM/commits?author=tommaull" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ejfdickinson"><img src="https://avatars.githubusercontent.com/u/116663050?v=4?s=100" width="100px;" alt="ejfdickinson"/><br /><sub><b>ejfdickinson</b></sub></a><br /><a href="#ideas-ejfdickinson" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/pybamm-team/PyBaMM/issues?q=author%3Aejfdickinson" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bobonice"><img src="https://avatars.githubusercontent.com/u/22030806?v=4?s=100" width="100px;" alt="bobonice"/><br /><sub><b>bobonice</b></sub></a><br /><a href="https://github.com/pybamm-team/PyBaMM/issues?q=author%3Abobonice" title="Bug reports">🐛</a> <a href="https://github.com/pybamm-team/PyBaMM/commits?author=bobonice" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kratman"><img src="https://avatars.githubusercontent.com/u/10170302?v=4?s=100" width="100px;" alt="Eric G. Kratz"/><br /><sub><b>Eric G. Kratz</b></sub></a><br /><a href="https://github.com/pybamm-team/PyBaMM/commits?author=kratman" title="Documentation">📖</a> <a href="#infra-kratman" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kratman"><img src="https://avatars.githubusercontent.com/u/10170302?v=4?s=100" width="100px;" alt="Eric G. Kratz"/><br /><sub><b>Eric G. Kratz</b></sub></a><br /><a href="https://github.com/pybamm-team/PyBaMM/commits?author=kratman" title="Documentation">📖</a> <a href="#infra-kratman" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/pybamm-team/PyBaMM/issues?q=author%3Akratman" title="Bug reports">🐛</a></td>
</tr>
</tbody>
</table>
Expand Down
Loading

0 comments on commit e4cb2a4

Please sign in to comment.