Skip to content

Commit

Permalink
refactor: Improve noxfile.py
Browse files Browse the repository at this point in the history
- Installed `virtualenv` and `cmake` before other dependencies.
- Installed all and dev dependencies together using a single `pip` command to avoid redundant wheel building.
- Corrected sys.platform to maintain consistency in the code

Signed-off-by: Akhilender <[email protected]>
  • Loading branch information
akhilender-bongirwar committed Oct 6, 2023
1 parent d2b51ff commit 713da15
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,24 +118,13 @@ def run_scripts(session):
def set_dev(session):
"""Install PyBaMM in editable mode."""
set_environment_variables(PYBAMM_ENV, session=session)
envbindir = session.bin
session.install("virtualenv")
session.install("virtualenv","cmake")
session.run("virtualenv", os.fsdecode(VENV_DIR), silent=True)
python = os.fsdecode(VENV_DIR.joinpath("bin/python"))
session.run(python, "-m", "pip", "install", "-e", ".[all]", silent=False)
session.install("cmake", silent=False)
session.install("-e", ".[dev]", external=True)
if session.platform.startswith("macos") or session.platform.startswith("linux"):
session.run(python, "-m", "pip", "install", "-e", ".[all,dev]", silent=False)
if sys.platform == "linux" or sys.platform == "macos":
session.run(python, "-m", "pip", "install", ".[jax,odes]", silent=False)
if sys.platform == "linux" or sys.platform == "darwin":
session.run(
"echo",
"export",
f"LD_LIBRARY_PATH={PYBAMM_ENV['LD_LIBRARY_PATH']}",
">>",
f"{envbindir}/activate",
external=True, # silence warning about echo being an external command
)



@nox.session(name="tests")
Expand Down

0 comments on commit 713da15

Please sign in to comment.