Skip to content

Commit

Permalink
pybamm-team#3639 Fix Python CI by pre-installing setuptools
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal authored and js1tr3 committed Aug 12, 2024
1 parent 64ebc89 commit 6aaac71
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ def run_unit(session):
def run_examples(session):
"""Run the examples tests for Jupyter notebooks."""
set_environment_variables(PYBAMM_ENV, session=session)
# Temporary fix for Python 3.12 CI. TODO: remove after
# https://bitbucket.org/pybtex-devs/pybtex/issues/169/replace-pkg_resources-with
# is fixed
session.install("setuptools", silent=False)
session.install("-e", ".[all,dev]", silent=False)
notebooks_to_test = session.posargs if session.posargs else []
session.run("pytest", "--nbmake", *notebooks_to_test, external=True)
Expand All @@ -110,6 +114,10 @@ def run_examples(session):
def run_scripts(session):
"""Run the scripts tests for Python scripts."""
set_environment_variables(PYBAMM_ENV, session=session)
# Temporary fix for Python 3.12 CI. TODO: remove after
# https://bitbucket.org/pybtex-devs/pybtex/issues/169/replace-pkg_resources-with
# is fixed
session.install("setuptools", silent=False)
session.install("-e", ".[all]", silent=False)
session.run("python", "run-tests.py", "--scripts")

Expand All @@ -121,6 +129,10 @@ def set_dev(session):
session.install("virtualenv", "cmake")
session.run("virtualenv", os.fsdecode(VENV_DIR), silent=True)
python = os.fsdecode(VENV_DIR.joinpath("bin/python"))
# Temporary fix for Python 3.12 CI. TODO: remove after
# 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, 12):
session.run(
Expand Down Expand Up @@ -180,6 +192,10 @@ def build_docs(session):
"""Build the documentation and load it in a browser tab, rebuilding on changes."""
envbindir = session.bin
session.install("-e", ".[all,docs]", silent=False)
# Temporary fix for Python 3.12 CI. TODO: remove after
# https://bitbucket.org/pybtex-devs/pybtex/issues/169/replace-pkg_resources-with
# is fixed
session.install("setuptools", silent=False)
session.chdir("docs")
# Local development
if session.interactive:
Expand Down

0 comments on commit 6aaac71

Please sign in to comment.