Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
DrSOKane committed Mar 18, 2024
2 parents 6d9b13a + 39cff38 commit 9140525
Show file tree
Hide file tree
Showing 127 changed files with 1,724 additions and 2,106 deletions.
2 changes: 1 addition & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"files": [
"README.md"
"all_contributors.md"
],
"imageSize": 100,
"commit": false,
Expand Down
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ a63e49ece0f9336d1f5c2562f7459e555c6e6693
ff6d81c01331c7d269303b4a8321d9881bdf98fa
# migrated to ruff-format - https://github.com/pybamm-team/PyBaMM/pull/3655
60ebd4148059a95428a496f4f55c1175ead362d3
# implemented cleaner string formatting via f-strings - https://github.com/pybamm-team/PyBaMM/pull/3890
f395819d1c874071b7e76e32ec4f0bbe42462b48
1 change: 0 additions & 1 deletion .github/workflows/benchmark_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Run benchmarks on push
on:
push:
branches: [main, develop]
pull_request:

concurrency:
# Cancel intermediate builds always
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lychee_url_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
--exclude-path ./scripts/update_version.py
--exclude-path asv.conf.json
--exclude-path docs/conf.py
--exclude-path all_contributors.md
'./**/*.rst'
'./**/*.md'
'./**/*.py'
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/need_reply_remove.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Remove needs-reply label

on:
schedule:
- cron: '0 3 * * 1'
issue_comment:
types:
- created
Expand All @@ -11,7 +13,8 @@ jobs:
if: |
github.event.comment.author_association != 'OWNER' &&
github.event.comment.author_association != 'COLLABORATOR' &&
github.repository_owner == 'pybamm-team'
github.repository_owner == 'pybamm-team' &&
github.event_name != 'pull_request'
steps:
- name: Remove needs-reply label
uses: octokit/request-action@v2.x
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/periodic_benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# - Publish website
name: Benchmarks
on:
# Everyday at 3 am UTC
# Every day at 3 am UTC
schedule:
- cron: "0 3 * * *"
# Make it possible to trigger the
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches:
- main

# Run everyday at 3 am UTC
# Run every day at 3 am UTC
schedule:
- cron: "0 3 * * *"

Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.4.1
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
if: matrix.os == 'ubuntu-latest'
with:
packages: gfortran gcc graphviz pandoc
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.4.1
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
with:
packages: gfortran gcc graphviz pandoc
execute_install_scripts: true
Expand Down Expand Up @@ -208,7 +208,7 @@ jobs:

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.4.1
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
if: matrix.os == 'ubuntu-latest'
with:
packages: gfortran gcc graphviz pandoc
Expand Down Expand Up @@ -279,7 +279,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
name: Doctests (ubuntu-latest / Python 3.12)
name: Doctests (ubuntu-latest / Python 3.11)

steps:
- name: Check out PyBaMM repository
Expand All @@ -289,7 +289,7 @@ jobs:

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.4.1
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
with:
packages: graphviz pandoc
execute_install_scripts: true
Expand All @@ -301,20 +301,20 @@ jobs:
sudo dot -c
sudo apt-get install texlive-latex-extra dvipng
- name: Set up Python 3.12
- name: Set up Python 3.11
id: setup-python
uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: 3.11
cache: 'pip'

- name: Install nox
run: python -m pip install nox

- name: Install docs dependencies and run doctests for GNU/Linux with Python 3.12
- name: Install docs dependencies and run doctests for GNU/Linux with Python 3.11
run: python -m nox -s doctests

- name: Check if the documentation can be built for GNU/Linux with Python 3.12
- name: Check if the documentation can be built for GNU/Linux with Python 3.11
run: python -m nox -s docs

# Runs only on Ubuntu with Python 3.12
Expand All @@ -331,7 +331,7 @@ jobs:

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.4.1
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
with:
packages: gfortran gcc graphviz pandoc
execute_install_scripts: true
Expand Down Expand Up @@ -386,7 +386,7 @@ jobs:

# Install and cache apt packages
- name: Install Linux system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.4.1
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
with:
packages: gfortran gcc graphviz
execute_install_scripts: true
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.2.2"
rev: "v0.3.2"
hooks:
- id: ruff
args: [--fix, --show-fixes]
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
- 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))

## Optimizations

- Sped up initialization of a `ProcessedVariable` by making the internal `xarray.DataArray` initialization lazy (only gets created if interpolation is needed) ([#3862](https://github.com/pybamm-team/PyBaMM/pull/3862))

## Breaking changes

- Renamed "have_optional_dependency" to "import_optional_dependency" ([#3866](https://github.com/pybamm-team/PyBaMM/pull/3866))
- Integrated the `[latexify]` extra into the core PyBaMM package, deprecating the `pybamm[latexify]` set of optional dependencies. SymPy is now a required dependency and will be installed upon installing PyBaMM ([#3848](https://github.com/pybamm-team/PyBaMM/pull/3848))
- Renamed "testing" argument for plots to "show_plot" and flipped its meaning (show_plot=True is now the default and shows the plot) ([#3842](https://github.com/pybamm-team/PyBaMM/pull/3842))
- Dropped support for BPX version 0.3.0 and below ([#3414](https://github.com/pybamm-team/PyBaMM/pull/3414))

Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,21 @@ Only 'core pybamm' is installed by default. The others have to be specified expl

PyBaMM utilizes optional dependencies to allow users to choose which additional libraries they want to use. Managing these optional dependencies and their imports is essential to provide flexibility to PyBaMM users.

PyBaMM provides a utility function `have_optional_dependency`, to check for the availability of optional dependencies within methods. This function can be used to conditionally import optional dependencies only if they are available. Here's how to use it:
PyBaMM provides a utility function `import_optional_dependency`, to check for the availability of optional dependencies within methods. This function can be used to conditionally import optional dependencies only if they are available. Here's how to use it:

Optional dependencies should never be imported at the module level, but always inside methods. For example:

```
def use_pybtex(x,y,z):
pybtex = have_optional_dependency("pybtex")
pybtex = import_optional_dependency("pybtex")
...
```

While importing a specific module instead of an entire package/library:

```python
def use_parse_file(x, y, z):
parse_file = have_optional_dependency("pybtex.database", "parse_file")
parse_file = import_optional_dependency("pybtex.database", "parse_file")
...
```

Expand All @@ -143,7 +143,7 @@ class TestUtil(TestCase):
pybamm.function_using_pybtex(x, y, z)

# Test that the function works when pybtex is available
sys.modules["pybtex"] = pybamm.util.have_optional_dependency("pybtex")
sys.modules["pybtex"] = pybamm.util.import_optional_dependency("pybtex")
pybamm.function_using_pybtex(x, y, z)
```

Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ graft pybamm
include CITATION.cff
prune tests

exclude CHANGELOG.md CODE-OF-CONDUCT.md CONTRIBUTING.md CMakeLists.txt
exclude CHANGELOG.md CODE-OF-CONDUCT.md CONTRIBUTING.md CMakeLists.txt all_contributors.md

global-exclude __pycache__ *.py[cod] .venv
Loading

0 comments on commit 9140525

Please sign in to comment.