From 31527b7961cbab470f153cdd76b16fea5a28a0d6 Mon Sep 17 00:00:00 2001 From: "Eric G. Kratz" Date: Tue, 2 Apr 2024 04:02:44 -0400 Subject: [PATCH] Jax windows restrictions (#3955) * 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 <74401230+agriyakhetarpal@users.noreply.github.com> --- .github/workflows/publish_pypi.yml | 4 +- .github/workflows/run_periodic_tests.yml | 2 +- .github/workflows/test_on_push.yml | 4 +- .../user_guide/installation/gnu-linux-mac.rst | 2 +- noxfile.py | 69 +++++++------------ 5 files changed, 29 insertions(+), 52 deletions(-) diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index 2970b1b07f..bbff62201d 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -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 @@ -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 diff --git a/.github/workflows/run_periodic_tests.yml b/.github/workflows/run_periodic_tests.yml index 58a231a4cd..5356d4f8ee 100644 --- a/.github/workflows/run_periodic_tests.yml +++ b/.github/workflows/run_periodic_tests.yml @@ -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 diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 30d71b7f78..a9d728c6f8 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -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 @@ -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 diff --git a/docs/source/user_guide/installation/gnu-linux-mac.rst b/docs/source/user_guide/installation/gnu-linux-mac.rst index 806576938f..46f3d1281f 100644 --- a/docs/source/user_guide/installation/gnu-linux-mac.rst +++ b/docs/source/user_guide/installation/gnu-linux-mac.rst @@ -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 diff --git a/noxfile.py b/noxfile.py index f93c88b954..17d466e690 100644 --- a/noxfile.py +++ b/noxfile.py @@ -61,13 +61,10 @@ 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") @@ -75,13 +72,10 @@ def run_coverage(session): 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") @@ -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") @@ -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")