Skip to content

Commit 245cb7b

Browse files
committed
copy xai_components from site packages by default
1 parent e1ac546 commit 245cb7b

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

xircuits/handlers/request_submodule.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ def get_submodule_config(user_query):
3232

3333
def request_submodule_library(component_library_query):
3434

35-
submodule_config = Path(os.getcwd()) / ".xircuits" / ".gitmodules"
36-
3735
# ensure syntax is as xai_components/xai_library_name
3836
if "xai" not in component_library_query:
3937
component_library_query = "xai_" + component_library_query

xircuits/start_xircuits.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
from urllib import request
66
import os
77
import argparse
8-
8+
import pkg_resources
9+
import shutil
910
from .handlers.request_folder import request_folder
1011
from .handlers.request_submodule import get_submodule_config, request_submodule_library
1112

1213
def init_xircuits():
1314

14-
import pkg_resources
15-
import shutil
15+
1616
path = ".xircuits"
1717
config_path = pkg_resources.resource_filename('xircuits', '.xircuits')
1818
shutil.copytree(config_path, path)
@@ -60,7 +60,7 @@ def download_submodule_library():
6060
def main():
6161

6262
parser = argparse.ArgumentParser()
63-
parser.add_argument('--branch', nargs='?', default="master", help='pull files from a xircuits branch')
63+
parser.add_argument('--branch', nargs='?', help='pull files from a xircuits branch')
6464

6565
parsed, extra_args = parser.parse_known_args()
6666

@@ -76,7 +76,12 @@ def main():
7676
if not component_library_path.exists():
7777
val = input("Xircuits Component Library is not found. Would you like to load it in the current path (Y/N)? ")
7878
if val.lower() == ("y" or "yes"):
79-
request_folder("xai_components", branch=args.branch)
79+
if args.branch is None:
80+
xai_component_path = pkg_resources.resource_filename('xai_components', '')
81+
shutil.copytree(xai_component_path, "xai_components")
82+
83+
else:
84+
request_folder("xai_components", branch=args.branch)
8085

8186
# handler for extra jupyterlab launch options
8287
if extra_args:

0 commit comments

Comments
 (0)