File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -78,14 +78,19 @@ def git_checkout_commit(self):
78
78
def get_project_name (self ):
79
79
"""
80
80
Get the project name from the data requirement file.
81
+ If the file doesn't exist, use the repository name.
81
82
82
83
Returns:
83
- str: Project name.
84
+ str: Project name or repository name .
84
85
"""
85
86
data_config_dir = os .path .join (self .build_dir , 'binder' , 'data_requirement.json' )
86
- with open (data_config_dir , 'r' ) as file :
87
- data = json .load (file )
88
- self .dataset_name = data ['projectName' ]
87
+ if os .path .isfile (data_config_dir ):
88
+ with open (data_config_dir , 'r' ) as file :
89
+ data = json .load (file )
90
+ self .dataset_name = data .get ('projectName' , self .repo_name )
91
+ else :
92
+ self .cprint (f'Data requirement file not found at { data_config_dir } , using repository name' , "yellow" )
93
+ self .dataset_name = None
89
94
90
95
def repo2data_download (self ,target_directory ):
91
96
data_req_path = os .path .join (self .build_dir , 'binder' , 'data_requirement.json' )
You can’t perform that action at this time.
0 commit comments