diff --git a/milabench/pack.py b/milabench/pack.py index dea5ac0d6..8bde3fa21 100644 --- a/milabench/pack.py +++ b/milabench/pack.py @@ -27,6 +27,28 @@ class defines good default behavior. ) +def is_editable_install(): + import subprocess + import json + + try: + output = subprocess.check_output(["pip", "list", "-e", "--format", "json"]) + editable_package = json.loads(output) + + for p in editable_package: + if p["name"] == "milabench": + return True + return False + except: + return False + + +def install_benchmate(pack): + milabench = os.path.dirname(__file__) + benchmate = os.path.join(milabench, "..", "benchmate") + pack.pip_install("-e", benchmate) + + class PackageCore: def __init__(self, config): self.pack_path = XPath(config["definition"]) @@ -94,7 +116,7 @@ def __init__(self, config, core=None): self.config = config self.phase = None self.processes = [] - + def copy(self, config): return type(self)(config=merge(self.config, config)) @@ -351,6 +373,10 @@ async def install(self): milabench in the venv, and then calling this method. """ assert self.phase == "install" + + if is_editable_install(): + install_benchmate(self) + for reqs in self.requirements_files(self.config.get("install_variant", None)): if reqs.exists(): await self.pip_install("-r", reqs) diff --git a/pyproject.toml b/pyproject.toml index b812c9a45..005328948 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,7 @@ license = "MIT" [tool.poetry.dependencies] voir = {git = "https://github.com/breuleux/voir", branch = "master"} +benchmate = {path = "benchmate", develop = false} python = ">=3.8,<4.0" giving = "^0.4.0" ptera = "^1.2.0"