Skip to content

Commit

Permalink
Merge pull request pybamm-team#3501 from agriyakhetarpal/fix-macos-gf…
Browse files Browse the repository at this point in the history
…ortran-issue

Fix `pipx` + `nox` + `pip` dependency resolution bug in macOS workflows
  • Loading branch information
Saransh-cpp authored Nov 17, 2023
2 parents 2c17416 + 0755c35 commit e0aaaf2
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 72 deletions.
34 changes: 13 additions & 21 deletions .github/workflows/run_periodic_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,62 +66,54 @@ jobs:
sudo apt install gfortran gcc libopenblas-dev graphviz pandoc
sudo apt install texlive-full
# Added fixes to homebrew installs:
# rm -f /usr/local/bin/2to3
# (see https://github.com/actions/virtual-environments/issues/2322)
- name: Install MacOS system dependencies
- name: Install macOS system dependencies
if: matrix.os == 'macos-latest'
run: |
rm -f /usr/local/bin/2to3*
rm -f /usr/local/bin/idle3*
rm -f /usr/local/bin/pydoc3*
rm -f /usr/local/bin/python3*
brew update
brew install graphviz
brew install openblas
run:
brew install graphviz openblas
brew reinstall gcc

- name: Install Windows system dependencies
if: matrix.os == 'windows-latest'
run: choco install graphviz --version=2.38.0.20190211

- name: Install standard Python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install --upgrade pip wheel setuptools nox
- name: Install SuiteSparse and SUNDIALS on GNU/Linux
if: matrix.os == 'ubuntu-latest'
run: pipx run nox -s pybamm-requires
run: python -m nox -s pybamm-requires

- name: Run unit tests for GNU/Linux with Python 3.8, 3.9, and 3.10, and for macOS and Windows with all Python versions
if: (matrix.os == 'ubuntu-latest' && matrix.python-version != 3.11) || (matrix.os != 'ubuntu-latest')
run: pipx run nox -s unit
run: python -m nox -s unit

- name: Run unit tests for GNU/Linux with Python 3.11 and generate coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
run: pipx run nox -s coverage
run: python -m nox -s coverage

- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
uses: codecov/[email protected]

- name: Run integration tests
run: pipx run nox -s integration
run: python -m nox -s integration

- name: Install docs dependencies and run doctests
if: matrix.os == 'ubuntu-latest'
run: pipx run nox -s doctests
run: python -m nox -s doctests

- name: Check if the documentation can be built
if: matrix.os == 'ubuntu-latest'
run: pipx run nox -s docs
run: python -m nox -s docs

- name: Install dev dependencies and run example tests
if: matrix.os == 'ubuntu-latest'
run: pipx run nox -s examples
run: python -m nox -s examples

- name: Run example scripts tests
if: matrix.os == 'ubuntu-latest'
run: pipx run nox -s scripts
run: python -m nox -s scripts

#M-series Mac Mini
build-apple-mseries:
Expand Down
54 changes: 23 additions & 31 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ jobs:
NONINTERACTIVE: 1
run: |
brew analytics off
brew update
brew install graphviz openblas
- name: Install Windows system dependencies
Expand All @@ -90,10 +89,9 @@ jobs:
cache: 'pip'
cache-dependency-path: setup.py

- name: Install PyBaMM dependencies
- name: Install standard Python dependencies
run: |
pip install --upgrade pip wheel setuptools
pip install -e .[all,docs]
pip install --upgrade pip wheel setuptools nox
- name: Cache pybamm-requires nox environment for GNU/Linux
uses: actions/cache@v3
Expand All @@ -111,10 +109,10 @@ jobs:

- name: Install SuiteSparse and SUNDIALS on GNU/Linux
if: matrix.os == 'ubuntu-latest'
run: pipx run nox -s pybamm-requires
run: python -m nox -s pybamm-requires

- name: Run unit tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
run: pipx run nox -s unit
run: python -m nox -s unit

# Runs only on Ubuntu with Python 3.11
check_coverage:
Expand Down Expand Up @@ -150,10 +148,9 @@ jobs:
cache: 'pip'
cache-dependency-path: setup.py

- name: Install PyBaMM dependencies
- name: Install standard Python dependencies
run: |
pip install --upgrade pip wheel setuptools nox
pip install -e .[all,docs]
- name: Cache pybamm-requires nox environment for GNU/Linux
uses: actions/cache@v3
Expand All @@ -169,10 +166,10 @@ jobs:
key: nox-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/install_KLU_Sundials.py') }}

- name: Install SuiteSparse and SUNDIALS on GNU/Linux
run: pipx run nox -s pybamm-requires
run: python -m nox -s pybamm-requires

- name: Run unit tests for Ubuntu with Python 3.11 and generate coverage report
run: pipx run nox -s coverage
run: python -m nox -s coverage

- name: Upload coverage report
uses: codecov/[email protected]
Expand Down Expand Up @@ -218,7 +215,6 @@ jobs:
NONINTERACTIVE: 1
run: |
brew analytics off
brew update
brew install graphviz openblas
- name: Install Windows system dependencies
Expand All @@ -233,10 +229,9 @@ jobs:
cache: 'pip'
cache-dependency-path: setup.py

- name: Install PyBaMM dependencies
- name: Install standard Python dependencies
run: |
pip install --upgrade pip wheel setuptools
pip install -e .[all,docs]
pip install --upgrade pip wheel setuptools nox
- name: Cache pybamm-requires nox environment for GNU/Linux
uses: actions/cache@v3
Expand All @@ -254,10 +249,10 @@ jobs:

- name: Install SuiteSparse and SUNDIALS on GNU/Linux
if: matrix.os == 'ubuntu-latest'
run: pipx run nox -s pybamm-requires
run: python -m nox -s pybamm-requires

- name: Run integration tests for ${{ matrix.os }} with Python ${{ matrix.python-version }}
run: pipx run nox -s integration
run: python -m nox -s integration

# Runs only on Ubuntu with Python 3.11. Skips IDAKLU module compilation
# for speedups, which is already tested in other jobs.
Expand Down Expand Up @@ -294,16 +289,15 @@ jobs:
cache: 'pip'
cache-dependency-path: setup.py

- name: Install PyBaMM dependencies
- name: Install standard Python dependencies
run: |
pip install --upgrade pip wheel setuptools
pip install -e .[all,docs]
pip install --upgrade pip wheel setuptools nox
- name: Install docs dependencies and run doctests for GNU/Linux with Python 3.11
run: pipx run nox -s doctests
run: python -m nox -s doctests

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

# Runs only on Ubuntu with Python 3.11
run_example_tests:
Expand Down Expand Up @@ -339,10 +333,9 @@ jobs:
cache: 'pip'
cache-dependency-path: setup.py

- name: Install PyBaMM dependencies
- name: Install standard Python dependencies
run: |
pip install --upgrade pip wheel setuptools
pip install -e .[all,docs]
pip install --upgrade pip wheel setuptools nox
- name: Cache pybamm-requires nox environment for GNU/Linux
uses: actions/cache@v3
Expand All @@ -358,10 +351,10 @@ jobs:
key: nox-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/install_KLU_Sundials.py') }}

- name: Install SuiteSparse and SUNDIALS on GNU/Linux
run: pipx run nox -s pybamm-requires
run: python -m nox -s pybamm-requires

- name: Install dev dependencies and run example tests for GNU/Linux with Python 3.11
run: pipx run nox -s examples
run: python -m nox -s examples

# Runs only on Ubuntu with Python 3.11
run_scripts_tests:
Expand Down Expand Up @@ -397,10 +390,9 @@ jobs:
cache: 'pip'
cache-dependency-path: setup.py

- name: Install PyBaMM dependencies
- name: Install standard Python dependencies
run: |
pip install --upgrade pip wheel setuptools
pip install -e .[all,docs]
pip install --upgrade pip wheel setuptools nox
- name: Cache pybamm-requires nox environment for GNU/Linux
uses: actions/cache@v3
Expand All @@ -416,7 +408,7 @@ jobs:
key: nox-pybamm-requires-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/install_KLU_Sundials.py') }}

- name: Install SuiteSparse and SUNDIALS on GNU/Linux
run: pipx run nox -s pybamm-requires
run: python -m nox -s pybamm-requires

- name: Install dev dependencies and run example scripts tests for GNU/Linux with Python 3.11
run: pipx run nox -s scripts
run: python -m nox -s scripts
32 changes: 12 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ def compile_KLU():
],
# List of dependencies
install_requires=[
"numpy>=1.16",
"scipy>=1.3",
"casadi>=3.6.0",
"xarray",
"anytree>=2.4.3",
"numpy>=1.23.5",
"scipy>=1.9.3",
"casadi>=3.6.3",
"xarray>=2022.6.0",
"anytree>=2.12.0",
],
extras_require={
"docs": [
Expand All @@ -231,18 +231,18 @@ def compile_KLU():
"jupyter", # For example notebooks
],
"plot": [
"imageio>=2.9.0",
"imageio>=2.32.0",
# Note: Matplotlib is loaded for debug plots, but to ensure pybamm runs
# on systems without an attached display, it should never be imported
# outside of plot() methods.
# Should not be imported
"matplotlib>=2.0",
"matplotlib>=3.6.0",
],
"cite": [
"pybtex>=0.24.0",
],
"latexify": [
"sympy>=1.8",
"sympy>=1.12",
],
"bpx": [
"bpx",
Expand All @@ -263,25 +263,17 @@ def compile_KLU():
"nbmake",
],
"pandas": [
"pandas>=0.24",
"pandas>=1.5.0",
],
"jax": [
"jax==0.4.8",
"jaxlib==0.4.7",
],
"odes": ["scikits.odes"],
"all": [
"anytree>=2.4.3",
"autograd>=1.2",
"pandas>=0.24",
"scikit-fem>=0.2.0",
"imageio>=2.9.0",
"pybtex>=0.24.0",
"sympy>=1.8",
"bpx",
"tqdm",
"matplotlib>=2.0",
"jupyter",
"autograd>=1.6.2",
"scikit-fem>=8.1.0",
"pybamm[examples,plot,cite,latexify,bpx,tqdm,pandas]"
],
},
entry_points={
Expand Down

0 comments on commit e0aaaf2

Please sign in to comment.