Skip to content

Commit

Permalink
While activating experimental OpenFL commands, install depedencies as…
Browse files Browse the repository at this point in the history
… well.

Signed-off-by: Parth Mandaliya <parthx.mandaliya@intel.com>
  • Loading branch information
ParthM-GitHub committed Sep 28, 2023
1 parent 3609303 commit 1154962
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions experimental-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
metaflow==2.7.15
23 changes: 20 additions & 3 deletions openfl/interface/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,41 @@
# SPDX-License-Identifier: Apache-2.0
"""Experimental CLI."""

import os
from pathlib import Path

from logging import getLogger
from click import group
from click import pass_context

logger = getLogger(__name__)


@group()
@pass_context
def experimental(context):
"""Manage Experimental Environment."""
context.obj["group"] = "experimental"


@experimental.command(name="activate")
def activate():
"""Activate experimental environment."""
settings = Path("~").expanduser().joinpath(
".openfl", "experimental").resolve()
".openfl").resolve()
settings.mkdir(parents=False, exist_ok=True)
settings = settings.joinpath("experimental").resolve()

from subprocess import check_call
from sys import executable

rf = Path('experimental-requirements.txt').resolve()

if rf.is_file():
check_call(
[executable, '-m', 'pip', 'install', '-r', rf],
shell=False
)
else:
logger.warning(f"Requirements file {rf} not found.")

with open(settings, "w") as f:
f.write("experimental")

0 comments on commit 1154962

Please sign in to comment.