@@ -48,6 +48,12 @@ def build_parser() -> argparse.ArgumentParser:
4848 help = "Path to the neptune backend repository. If not specified, it will be auto-detected." ,
4949 default = None ,
5050 )
51+ parser .add_argument (
52+ "--no-update-api-spec" ,
53+ action = "store_true" ,
54+ help = "Do not fetch new API spec files from Neptune repo." ,
55+ default = False ,
56+ )
5157 parser .add_argument (
5258 "--update" ,
5359 action = "store_true" ,
@@ -140,14 +146,17 @@ def main() -> None:
140146 # Project root
141147 project_root = find_project_root ()
142148
143- # Neptune repo path
144- if args .neptune_repo_path is None :
145- args .neptune_repo_path = find_neptune_repo (project_root )
146- elif not is_neptune_repo (args .neptune_repo_path ):
147- raise RuntimeError (
148- f"The specified neptune repo path { args .neptune_repo_path } is not a valid neptune backend repository."
149- )
150- print_err (f"Using neptune backend repository at: { rel (args .neptune_repo_path )} " )
149+ update_api_spec = not args .no_update_api_spec
150+
151+ if update_api_spec :
152+ # Neptune repo path
153+ if args .neptune_repo_path is None :
154+ args .neptune_repo_path = find_neptune_repo (project_root )
155+ elif not is_neptune_repo (args .neptune_repo_path ):
156+ raise RuntimeError (
157+ f"The specified neptune repo path { args .neptune_repo_path } is not a valid neptune backend repository."
158+ )
159+ print_err (f"Using neptune backend repository at: { rel (args .neptune_repo_path )} " )
151160
152161 # Target and backup dirs
153162 rand_bit = int (random () * 1e4 )
@@ -174,12 +183,16 @@ def main() -> None:
174183 apispec_dir .mkdir ()
175184 generated_py_dir .mkdir ()
176185
177- print_err (f"Copying proto directories and swagger files to: { rel (apispec_dir )} " )
178- copy_swagger_files (
179- neptune_repo_path = args .neptune_repo_path ,
180- target_dir = apispec_dir ,
181- verbose = args .verbose ,
182- )
186+ if update_api_spec :
187+ print_err (f"Copying proto directories and swagger files to: { rel (apispec_dir )} " )
188+ copy_swagger_files (
189+ neptune_repo_path = args .neptune_repo_path ,
190+ target_dir = apispec_dir ,
191+ verbose = args .verbose ,
192+ )
193+ else :
194+ print_err (f"Using proto directories and swagger from: { rel (target_apispec )} " )
195+ shutil .copytree (target_apispec , apispec_dir , dirs_exist_ok = True )
183196
184197 print_err (f"Generating OpenAPI clients in: { rel (generated_py_dir )} " )
185198 run_in_docker (
0 commit comments