Skip to content

Commit 5003fcf

Browse files
Merge pull request #2635 from pybamm-team/develop
Make release v23.1
2 parents bb74c4e + 0c120de commit 5003fcf

File tree

301 files changed

+1467
-1054
lines changed

Some content is hidden

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

301 files changed

+1467
-1054
lines changed

.all-contributorsrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,8 @@
529529
"profile": "https://github.com/agriyakhetarpal",
530530
"contributions": [
531531
"infra",
532-
"code"
532+
"code",
533+
"doc"
533534
]
534535
},
535536
{

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Please add a line in the relevant section of [CHANGELOG.md](https://github.com/p
1414

1515
# Key checklist:
1616

17-
- [ ] No style issues: `$ flake8`
17+
- [ ] No style issues: `$ pre-commit run`
1818
- [ ] All tests pass: `$ python run-tests.py --unit`
1919
- [ ] The documentation builds: `$ cd docs` and then `$ make clean; make html`
2020

.github/workflows/benchmark_on_push.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,15 @@ jobs:
1111
uses: actions/setup-python@v4
1212
with:
1313
python-version: 3.8
14-
- name: Install asv
15-
run: pip install -U pip virtualenv asv
14+
- name: Install Linux system dependencies
15+
run: |
16+
sudo apt-get update
17+
sudo apt install gfortran gcc libopenblas-dev
18+
- name: Install python dependencies
19+
run: |
20+
python -m pip install --upgrade pip wheel setuptools virtualenv asv wget cmake casadi numpy
21+
- name: Install SuiteSparse and Sundials
22+
run: python scripts/install_KLU_Sundials.py
1623
- name: Fetch base branch
1724
run: |
1825
# This workflow also runs for merge commits
@@ -22,6 +29,7 @@ jobs:
2229
if [ $current_branch != "develop" ]; then
2330
git fetch origin develop:develop
2431
fi
32+
2533
- name: Run benchmarks
2634
run: |
2735
asv machine --machine "GitHubRunner"
@@ -30,7 +38,7 @@ jobs:
3038
HEAD_COMMIT=$(git rev-parse HEAD)
3139
echo $BASE_COMMIT | tee commits_to_compare.txt
3240
echo $HEAD_COMMIT | tee -a commits_to_compare.txt
33-
asv run HASHFILE:commits_to_compare.txt --m "GitHubRunner" --show-stderr
41+
asv run HASHFILE:commits_to_compare.txt --m "GitHubRunner" --show-stderr -v
3442
- name: Compare commits' benchmark results
3543
run: |
3644
BASE_COMMIT=$(head -1 commits_to_compare.txt)

.github/workflows/test_on_push.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636

3737
- name: Check style
3838
run: |
39-
python -m pip install "tox<4"
40-
tox -e flake8
39+
python -m pip install pre-commit
40+
pre-commit run ruff
4141
4242
build:
4343
needs: style

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ dist/
6161
coverage.xml
6262
htmlcov/
6363

64-
# black setup file seems to make Travis CI fail
65-
pyproject.toml
66-
6764
# virtual enviroment
6865
env/
6966
venv/

.pre-commit-config.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ repos:
1414
hooks:
1515
- id: black
1616

17-
- repo: https://github.com/PyCQA/flake8
18-
rev: 6.0.0
17+
- repo: https://github.com/charliermarsh/ruff-pre-commit
18+
rev: "v0.0.237"
1919
hooks:
20-
- id: flake8
20+
- id: ruff
21+
args: [--ignore=E741, --exclude=__init__.py]

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# [Unreleased](https://github.com/pybamm-team/PyBaMM/)
22

3+
# [v23.1](https://github.com/pybamm-team/PyBaMM/tree/v23.1) - 2023-01-31
4+
5+
## Features
6+
7+
- Changed linting from `flake8` to `ruff` ([#2630](https://github.com/pybamm-team/PyBaMM/pull/2630)).
8+
- Changed docs theme to pydata theme and start to improve docs in general ([#2618](https://github.com/pybamm-team/PyBaMM/pull/2618)).
9+
- New `contact resistance` option, new parameter `Contact resistance [Ohm]` and new variable `Contact overpotential [V]` ([#2598](https://github.com/pybamm-team/PyBaMM/pull/2598)).
10+
- Steps in `Experiment` can now be tagged and cycle numbers be searched based on those tags ([#2593](https://github.com/pybamm-team/PyBaMM/pull/2593)).
11+
12+
## Bug fixes
13+
14+
- Fixed a bug where the solid phase conductivity was double-corrected for tortuosity when loading parameters from a BPX file ([#2638](https://github.com/pybamm-team/PyBaMM/pull/2638)).
15+
- Changed termination from "success" to "final time" for algebraic solvers to match ODE/DAE solvers ([#2613](https://github.com/pybamm-team/PyBaMM/pull/2613)).
16+
317
# [v22.12](https://github.com/pybamm-team/PyBaMM/tree/v22.12) - 2022-12-31
418

519
## Features
@@ -12,6 +26,7 @@
1226

1327
## Bug fixes
1428

29+
- Allow models that subclass `BaseBatteryModel` to use custom options classes ([#2571](https://github.com/pybamm-team/PyBaMM/pull/2571))
1530
- Fixed bug with `EntryPoints` in Spyder IDE ([#2584](https://github.com/pybamm-team/PyBaMM/pull/2584))
1631
- Fixed electrolyte conservation when options {"surface form": "algebraic"} are used
1732
- Fixed "constant concentration" electrolyte model so that "porosity times concentration" is conserved when porosity changes ([#2529](https://github.com/pybamm-team/PyBaMM/pull/2529))

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ keywords:
2424
- "expression tree"
2525
- "python"
2626
- "symbolic differentiation"
27-
version: "22.12"
27+
version: "23.1"
2828
repository-code: "https://github.com/pybamm-team/PyBaMM"
2929
title: "Python Battery Mathematical Modelling (PyBaMM)"

CONTRIBUTING.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,18 @@ Finally, if you really, really, _really_ love developing PyBaMM, have a look at
6363

6464
PyBaMM follows the [PEP8 recommendations](https://www.python.org/dev/peps/pep-0008/) for coding style. These are very common guidelines, and community tools have been developed to check how well projects implement them. We recommend using pre-commit hooks to check your code before committing it. See [installing and using pre-commit](https://github.com/pybamm-team/PyBaMM/blob/develop/CONTRIBUTING.md#installing-and-using-pre-commit) section for more details.
6565

66-
### Flake8
66+
### Ruff
6767

68-
We use [flake8](http://flake8.pycqa.org/en/latest/) to check our PEP8 adherence. To try this on your system, navigate to the PyBaMM directory in a console and type
68+
We use [ruff](https://github.com/charliermarsh/ruff) to check our PEP8 adherence. To try this on your system, navigate to the PyBaMM directory in a console and type
6969

7070
```bash
71-
flake8
71+
python -m pip install pre-commit
72+
pre-commit run ruff
7273
```
7374

74-
Flake8 is configured inside the file `tox.ini`, under the section `[flake8]`, allowing us to ignore some errors. If you think this should be added or removed, please submit an [issue](#issues)
75+
ruff is configured inside the file `pre-commit-config.yaml`, allowing us to ignore some errors. If you think this should be added or removed, please submit an [issue](#issues)
7576

76-
When you commit your changes they will be checked against flake8 automatically (see [infrastructure](#infrastructure)).
77+
When you commit your changes they will be checked against ruff automatically (see [infrastructure](#infrastructure)).
7778

7879
### Black
7980

@@ -85,11 +86,11 @@ We use [black](https://black.readthedocs.io/en/stable/) to automatically configu
8586
black {source_file_or_directory}
8687
```
8788

88-
2. Editor: black can be [configured](https://test-black.readthedocs.io/en/latest/editor_integration.html) to automatically reformat a python script each time the script is saved in an editor.
89+
2. Editor: black can be [configured](https://test-black.readthedocs.io/en/latest/editor_integration.html) to automatically reformat a Python script each time the script is saved in an editor.
8990

9091
If you want to use black in your editor, you may need to change the max line length in your editor settings.
9192

92-
Even when code has been formatted by black, you should still make sure that it adheres to the PEP8 standard set by [Flake8](#flake8).
93+
Even when code has been formatted by black, you should still make sure that it adheres to the PEP8 standard set by [ruff](#ruff).
9394

9495
### Naming
9596

@@ -111,7 +112,7 @@ On the other hand... We _do_ want to compare several tools, to generate document
111112
1. Core PyBaMM: A minimal set, including things like NumPy, SciPy, etc. All infrastructure should run against this set of dependencies, as well as any numerical methods we implement ourselves.
112113
2. Extras: Other inference packages and their dependencies. Methods we don't want to implement ourselves, but do want to provide an interface to can have their dependencies added here.
113114
3. Documentation generating code: Everything you need to generate and work on the docs.
114-
4. Development code: Everything you need to do PyBaMM development (so all of the above packages, plus flake8 and other testing tools).
115+
4. Development code: Everything you need to do PyBaMM development (so all of the above packages, plus ruff and other testing tools).
115116

116117
Only 'core pybamm' is installed by default. The others have to be specified explicitly when running the installation command.
117118

@@ -214,7 +215,7 @@ This also means that, if you can't fix the bug yourself, it will be much easier
214215

215216
or by just commenting out all the tests you don't want to run.
216217

217-
2. Set break points, either in your IDE or using the python debugging module. To use the latter, add the following line where you want to set the break point
218+
2. Set break points, either in your IDE or using the Python debugging module. To use the latter, add the following line where you want to set the break point
218219

219220
```python
220221
import ipdb; ipdb.set_trace()
@@ -257,7 +258,7 @@ This also means that, if you can't fix the bug yourself, it will be much easier
257258

258259
You can then step through the expression tree, using the `children` attribute, to pinpoint exactly where a bug is coming from. For example, if `expression_tree.jac(y)` is failing, you can check `expression_tree.children[0].jac(y)`, then `expression_tree.children[0].children[0].jac(y)`, etc.
259260

260-
3. To isolate whether a bug is in a model, its jacobian or its simplified version, you can set the `use_jacobian` and/or `use_simplify` attributes of the model to `False` (they are both `True` by default for most models).
261+
3. To isolate whether a bug is in a model, its Jacobian or its simplified version, you can set the `use_jacobian` and/or `use_simplify` attributes of the model to `False` (they are both `True` by default for most models).
261262
4. If a model isn't giving the answer you expect, you can try comparing it to other models. For example, you can investigate parameter limits in which two models should give the same answer by setting some parameters to be small or zero. The `StandardOutputComparison` class can be used to compare some standard outputs from battery models.
262263
5. To get more information about what is going on under the hood, and hence understand what is causing the bug, you can set the [logging](https://realpython.com/python-logging/) level to `DEBUG` by adding the following line to your test or script:
263264

@@ -340,9 +341,9 @@ Adding the command
340341
pybamm.print_citations()
341342
```
342343

343-
to the end of a script will print all citations that were used by that script. This will print bibtex information to the terminal; passing a filename to `print_citations` will print the bibtex information to the specified file instead.
344+
to the end of a script will print all citations that were used by that script. This will print BibTeX information to the terminal; passing a filename to `print_citations` will print the BibTeX information to the specified file instead.
344345

345-
When you contribute code to PyBaMM, you can add your own papers that you would like to be cited if that code is used. First, add the bibtex for your paper to [CITATIONS.txt](pybamm/CITATIONS.txt). Then, add the line
346+
When you contribute code to PyBaMM, you can add your own papers that you would like to be cited if that code is used. First, add the BibTeX for your paper to [CITATIONS.txt](pybamm/CITATIONS.txt). Then, add the line
346347

347348
```python3
348349
pybamm.citations.register("your_paper_bibtex_identifier")
@@ -368,7 +369,7 @@ Note that this file must be kept in sync with the version number in [pybamm/**in
368369

369370
Each change pushed to the PyBaMM GitHub repository will trigger the test and benchmark suites to be run, using [GitHub actions](https://github.com/features/actions).
370371

371-
Tests are run for different operating systems, and for all python versions officially supported by PyBaMM. If you opened a Pull Request, feedback is directly available on the corresponding page. If all tests pass, a green tick will be displayed next to the corresponding test run. If one or more test(s) fail, a red cross will be displayed instead.
372+
Tests are run for different operating systems, and for all Python versions officially supported by PyBaMM. If you opened a Pull Request, feedback is directly available on the corresponding page. If all tests pass, a green tick will be displayed next to the corresponding test run. If one or more test(s) fail, a red cross will be displayed instead.
372373

373374
Similarly, the benchmark suite is automatically run for the most recently pushed commit. Benchmark results are compared to the results available for the latest commit on the `develop` branch. Should any significant performance regression be found, a red cross will be displayed next to the benchmark run.
374375

GOVERNANCE.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# PyBaMM Governance
2+
3+
The following contains the formal governance structure of the PyBaMM
4+
project. This document clarifies how decisions are made with respect
5+
to community interactions, including the relationship between
6+
open source development and work that may be funded by for-profit
7+
and non-profit entities.
8+
9+
## Code of Conduct
10+
11+
The PyBaMM community strongly values inclusivity and diversity. Everyone
12+
should treat others with the utmost respect. Everyone in the community
13+
must adhere to the
14+
[Code of Conduct](https://github.com/pybamm-team/PyBaMM/blob/develop/CODE-OF-CONDUCT.md) which
15+
reflects the values of our community. Violations of the code should be
16+
reported to members of the steering council, where the offenses will be
17+
handled on a case-by-case basis.
18+
19+
## Current Steering Council
20+
21+
- [Ferran Brosa Planella](https://www.brosaplanella.xyz)
22+
- [Saransh Chopra](https://saransh-cpp.github.io)
23+
- Scott Marquis
24+
- [Gregory Offer](https://www.imperial.ac.uk/people/gregory.offer)
25+
- [Valentin Sulzer](https://sites.google.com/view/valentinsulzer)
26+
27+
## Advisory Committee
28+
29+
TBA
30+
31+
# Governing Rules and Duties
32+
33+
## Steering Council
34+
35+
The Project has a Steering Council that consists of Project
36+
Contributors who have produced contributions that are substantial in
37+
quality and quantity, and sustained over at least one year. The role
38+
of the Council is to provide active leadership for the Project in
39+
making everyday decisions on technical and administrative issues,
40+
through working with and taking input from the Community.
41+
42+
During the everyday project activities, Council Members participate in
43+
all discussions, code review and other project activities as peers
44+
with all other Contributors and the Community. In these everyday
45+
activities, Council Members do not have any special power or privilege
46+
through their membership on the Council. However, it is expected that
47+
because of the quality and quantity of their contributions and their
48+
expert knowledge of the Project Software and Services that Council
49+
Members will provide useful guidance, both technical and in terms of
50+
project direction, to potentially less experienced Contributors.
51+
52+
The Steering Council and its Members play a special role in certain
53+
situations. In particular, the Council may:
54+
55+
- Make decisions about the overall scope, vision and direction of
56+
the project.
57+
- Make decisions about strategic collaborations with other
58+
organizations or individuals.
59+
- Make decisions about specific technical issues, features, bugs and
60+
pull requests. They are the primary mechanism of guiding the code
61+
review process and merging pull requests.
62+
- Make decisions about the Services that are run by the Project and
63+
manage those Services for the benefit of the Project and Community.
64+
- Make decisions when regular community discussion does not produce
65+
consensus on an issue in a reasonable time frame.
66+
67+
Steering Council decisions are taken by simple majority, with the
68+
exception of changes to the Governance Documents which follow the
69+
procedure in the section 'Changing the Governance Documents'.
70+
71+
### Steering Council membership
72+
73+
To become eligible for being a Steering Council Member, an individual
74+
must be a Project Contributor who has produced contributions that are
75+
substantial in quality and quantity, and sustained over at least one
76+
year. Potential Council Members are nominated by existing Council
77+
Members or by the Community and voted upon by the existing Council
78+
after asking if the potential Member is interested and willing to
79+
serve in that capacity.
80+
81+
When considering potential Members, the Council will look at
82+
candidates with a comprehensive view of their contributions. This will
83+
include but is not limited to code, code review, infrastructure work,
84+
mailing list and chat participation, community help/building,
85+
education and outreach, design work, etc. We deliberately do not
86+
set arbitrary quantitative metrics to avoid encouraging behavior
87+
that plays to the metrics rather than the project's overall well-being.
88+
We want to encourage a diverse array of backgrounds, viewpoints and
89+
talents in our team, which is why we explicitly do not define code as
90+
the sole metric on which Council membership will be evaluated.
91+
92+
If a Council Member becomes inactive in the project for a period of
93+
one year, they will be considered for removal from the Council. Before
94+
removal, the inactive Member will be approached by another Council
95+
member to ask if they plan on returning to active participation. If
96+
not they will be removed immediately upon a Council vote. If they plan
97+
on returning to active participation soon, they will be given a grace
98+
period of one year. If they do not return to active participation
99+
within that time period they will be removed by vote of the Council
100+
without further grace period. All former Council members can be
101+
considered for membership again at any time in the future, like any
102+
other Project Contributor. Retired Council members will be listed on
103+
the project website, acknowledging the period during which they were
104+
active in the Council.
105+
106+
The Council reserves the right to eject current Members if they are
107+
deemed to be actively harmful to the Project's well-being, and
108+
attempts at communication and conflict resolution have failed.
109+
110+
## Fiscal Decisions
111+
112+
All fiscal decisions are made by the steering council to ensure any
113+
funds are spent in a manner that furthers the mission of the Project.
114+
Fiscal decisions require majority approval by acting steering council
115+
members.
116+
117+
## Advisory Committee
118+
119+
The Project will consider setting up an Advisory Committee that works to ensure the long-term
120+
well-being of the Project. The role of the Committee will be to advise the Steering Council.
121+
122+
## Conflict of interest
123+
124+
It is expected that Steering Council and Advisory Committee Members
125+
will be employed at a wide range of companies, universities and non-profit
126+
organizations. Because of this, it is possible that Members will have
127+
conflicts of interest. Such conflicts of interest include, but are not
128+
limited to:
129+
130+
- Financial interests, such as investments, employment or contracting
131+
work, outside of the Project that may influence their work on the
132+
Project.
133+
- Access to proprietary information of their employer that could
134+
potentially leak into their work with the Project.
135+
136+
All members of the Council and Committee shall disclose any conflict of
137+
interest they may have. Members with a conflict of interest in a
138+
particular issue may participate in Council discussions on that issue,
139+
but must recuse themselves from voting on the issue.

0 commit comments

Comments
 (0)