Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: SdgJlbl <sarah.diot-girard@owkin.com>
  • Loading branch information
SdgJlbl committed Jun 9, 2023
1 parent 6c3e591 commit ac28eb7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
31 changes: 19 additions & 12 deletions substrafl/remote/register/manage_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,28 +187,35 @@ def compile_requirements(dependency_list: List[str], *, operation_dir: Path, sub

requirements = ""
for dependency in dependency_list:
if dependency.__str__().endswith(".whl"):
if os.name == "nt": # windows
dependency = dependency.__str__().replace("/", "\\")
if str(dependency).endswith(".whl"):
if isinstance(dependency, Path):
# the following is necessary for pip-compile to run on Windows
dependency = "/".join(dependency.parts)
requirements += f"file:{dependency}\n"
else:
requirements += f"{dependency}\n"

requirements_in.write_text(requirements)
print(requirements)
command = [
sys.executable,
"-m",
"piptools",
"compile",
"--resolver=backtracking",
str(requirements_in),
]
try:
subprocess.run(
[
sys.executable,
"-m",
"piptools",
"compile",
"--resolver=backtracking",
requirements_in,
],
command,
cwd=operation_dir,
check=True,
capture_output=True,
text=True,
)
except subprocess.CalledProcessError as e:
raise InvalidDependenciesError from e
print(e.stdout)
print(e.stderr)
raise InvalidDependenciesError(
f"Error in command {' '.join(command)}\nstdout: {e.stdout}\nstderr: {e.stderr}"
) from e
2 changes: 1 addition & 1 deletion tests/dependency/test_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def train(
utils.wait(client, train_task)

@pytest.mark.docker_only
@patch("substrafl.remote.register.register.local_lib_wheels", MagicMock(return_value="INSTALL IN EDITABLE MODE"))
@patch("substrafl.remote.register.register.local_lib_wheels", MagicMock(return_value=["INSTALL IN EDITABLE MODE"]))
def test_force_editable_mode(
self,
monkeypatch,
Expand Down

0 comments on commit ac28eb7

Please sign in to comment.