Skip to content

Commit

Permalink
Jax windows restrictions (pybamm-team#3955)
Browse files Browse the repository at this point in the history
* Fix coverage

* Remove windows Jax restrictions

* style: pre-commit fixes

* Update MacOS instructions

* Update docs/source/user_guide/installation/install-from-source.rst

* Apply suggestions from code review

* Apply suggestions from code review

* Apply suggestions from code review

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Agriya Khetarpal <[email protected]>
  • Loading branch information
3 people authored Apr 2, 2024
1 parent 78b7d25 commit 31527b7
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 52 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
- name: Install SuiteSparse and SUNDIALS on macOS
if: matrix.os == 'macos-12'
run: |
brew install graphviz openblas libomp
brew install graphviz libomp
brew reinstall gcc
python -m pip install cmake wget
python scripts/install_KLU_Sundials.py
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:

- name: Install SuiteSparse and SUNDIALS on macOS
run: |
brew install graphviz openblas libomp
brew install graphviz libomp
brew reinstall gcc
python -m pip install cmake pipx
python scripts/install_KLU_Sundials.py
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 @@ -77,7 +77,7 @@ jobs:
if: matrix.os == 'macos-12' || matrix.os == 'macos-14'
run: |
brew analytics off
brew install graphviz openblas libomp
brew install graphviz libomp
brew reinstall gcc
- name: Install Windows system dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
# sometimes gfortran cannot be found, so reinstall gcc just to be sure
run: |
brew analytics off
brew install graphviz openblas libomp
brew install graphviz libomp
brew reinstall gcc
- name: Install Windows system dependencies
Expand Down Expand Up @@ -226,7 +226,7 @@ jobs:
# sometimes gfortran cannot be found, so reinstall gcc just to be sure
run: |
brew analytics off
brew install graphviz openblas libomp
brew install graphviz libomp
brew reinstall gcc
- name: Install Windows system dependencies
Expand Down
2 changes: 1 addition & 1 deletion docs/source/user_guide/installation/gnu-linux-mac.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To use PyBaMM, you must have Python 3.8, 3.9, 3.10, 3.11, or 3.12 installed.

.. code:: bash
brew install python3
brew install python
Install PyBaMM
Expand Down
69 changes: 23 additions & 46 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,21 @@ def run_coverage(session):
"""Run the coverage tests and generate an XML report."""
set_environment_variables(PYBAMM_ENV, session=session)
session.install("coverage", silent=False)
if sys.platform != "win32":
session.install("-e", ".[all,dev,jax]", silent=False)
if sys.version_info < (3, 9):
session.install("-e", ".[all,dev]", silent=False)
else:
if sys.version_info < (3, 9):
session.install("-e", ".[all,dev]", silent=False)
else:
session.install("-e", ".[all,dev,jax]", silent=False)
session.install("-e", ".[all,dev,jax]", silent=False)
session.run("pytest", "--cov=pybamm", "--cov-report=xml", "tests/unit")


@nox.session(name="integration")
def run_integration(session):
"""Run the integration tests."""
set_environment_variables(PYBAMM_ENV, session=session)
if sys.platform != "win32":
session.install("-e", ".[all,dev,jax]", silent=False)
if sys.version_info < (3, 9):
session.install("-e", ".[all,dev]", silent=False)
else:
if sys.version_info < (3, 9):
session.install("-e", ".[all,dev]", silent=False)
else:
session.install("-e", ".[all,dev,jax]", silent=False)
session.install("-e", ".[all,dev,jax]", silent=False)
session.run("python", "run-tests.py", "--integration")


Expand All @@ -96,13 +90,10 @@ def run_doctests(session):
def run_unit(session):
"""Run the unit tests."""
set_environment_variables(PYBAMM_ENV, session=session)
if sys.platform != "win32":
session.install("-e", ".[all,dev,jax]", silent=False)
if sys.version_info < (3, 9):
session.install("-e", ".[all,dev]", silent=False)
else:
if sys.version_info < (3, 9):
session.install("-e", ".[all,dev]", silent=False)
else:
session.install("-e", ".[all,dev,jax]", silent=False)
session.install("-e", ".[all,dev,jax]", silent=False)
session.run("python", "run-tests.py", "--unit")


Expand Down Expand Up @@ -138,50 +129,36 @@ def set_dev(session):
# https://bitbucket.org/pybtex-devs/pybtex/issues/169/replace-pkg_resources-with
# is fixed
session.run(python, "-m", "pip", "install", "setuptools", external=True)
if sys.platform == "linux":
if sys.version_info < (3, 9):
session.run(
python,
"-m",
"pip",
"install",
"-e",
".[all,dev,jax]",
".[all,dev]",
external=True,
)
else:
if sys.version_info < (3, 9):
session.run(
python,
"-m",
"pip",
"install",
"-e",
".[all,dev]",
external=True,
)
else:
session.run(
python,
"-m",
"pip",
"install",
"-e",
".[all,dev,jax]",
external=True,
)
session.run(
python,
"-m",
"pip",
"install",
"-e",
".[all,dev,jax]",
external=True,
)


@nox.session(name="tests")
def run_tests(session):
"""Run the unit tests and integration tests sequentially."""
set_environment_variables(PYBAMM_ENV, session=session)
if sys.platform != "win32":
session.install("-e", ".[all,dev,jax]", silent=False)
if sys.version_info < (3, 9):
session.install("-e", ".[all,dev]", silent=False)
else:
if sys.version_info < (3, 9):
session.install("-e", ".[all,dev]", silent=False)
else:
session.install("-e", ".[all,dev,jax]", silent=False)
session.install("-e", ".[all,dev,jax]", silent=False)
session.run("python", "run-tests.py", "--all")


Expand Down

0 comments on commit 31527b7

Please sign in to comment.