@@ -960,7 +960,7 @@ def convertDataRole(self, dataRole):
960
960
return conversion
961
961
962
962
@classmethod
963
- def create_requirements_json (cls , json_path = Path .cwd ()):
963
+ def create_requirements_json (cls , model_path = Path .cwd ()):
964
964
"""
965
965
Searches the model directory for Python scripts and pickle files and determines their Python package
966
966
dependencies.
@@ -980,7 +980,7 @@ def create_requirements_json(cls, json_path=Path.cwd()):
980
980
981
981
Parameters
982
982
----------
983
- json_path : str, optional
983
+ model_path : str, optional
984
984
The path to a Python project, by default the current working directory.
985
985
986
986
Returns
@@ -995,11 +995,11 @@ def create_requirements_json(cls, json_path=Path.cwd()):
995
995
"""
996
996
997
997
pickle_packages = []
998
- pickle_files = cls .get_pickle_file (json_path )
998
+ pickle_files = cls .get_pickle_file (model_path )
999
999
for pickle_file in pickle_files :
1000
1000
pickle_packages .append (cls .get_pickle_dependencies (pickle_file ))
1001
1001
1002
- code_dependencies = cls .get_code_dependencies (json_path )
1002
+ code_dependencies = cls .get_code_dependencies (model_path )
1003
1003
1004
1004
package_list = list (pickle_packages ) + code_dependencies
1005
1005
package_list = list (set (list (flatten (package_list ))))
@@ -1027,7 +1027,7 @@ def create_requirements_json(cls, json_path=Path.cwd()):
1027
1027
"command" : f"pip install { package } =={ version } " ,
1028
1028
}
1029
1029
)
1030
- with open (Path (json_path ) / "requirements.json" , "w" ) as file :
1030
+ with open (Path (model_path ) / "requirements.json" , "w" ) as file :
1031
1031
file .write (json .dumps (json_dicts , indent = 4 ))
1032
1032
1033
1033
return json_dicts
@@ -1086,15 +1086,15 @@ def package_not_found_output(package_name, package_versions):
1086
1086
return package_and_version
1087
1087
1088
1088
@classmethod
1089
- def get_code_dependencies (cls , json_path = Path .cwd ()):
1089
+ def get_code_dependencies (cls , model_path = Path .cwd ()):
1090
1090
"""
1091
1091
Get the package dependencies for all Python scripts in the provided directory path.
1092
1092
1093
1093
Note that currently this functionality only works for .py files.
1094
1094
1095
1095
Parameters
1096
1096
----------
1097
- json_path : string, optional
1097
+ model_path : string, optional
1098
1098
File location for the output JSON file. Default is the current working directory.
1099
1099
1100
1100
Returns
@@ -1103,7 +1103,7 @@ def get_code_dependencies(cls, json_path=Path.cwd()):
1103
1103
List of found package dependencies.
1104
1104
"""
1105
1105
file_names = []
1106
- file_names .extend (sorted (Path (json_path ).glob ("*.py" )))
1106
+ file_names .extend (sorted (Path (model_path ).glob ("*.py" )))
1107
1107
1108
1108
import_info = []
1109
1109
for file in file_names :
0 commit comments