4545 f"{ LF } "
4646)
4747
48+
4849@dataclass (frozen = True )
4950class SetupInfo :
5051 module_root : str
@@ -70,7 +71,6 @@ def init_codeflash() -> None:
7071 did_add_new_key = prompt_api_key ()
7172
7273 if should_modify_pyproject_toml ():
73-
7474 setup_info : SetupInfo = collect_setup_info ()
7575
7676 configure_pyproject_toml (setup_info )
@@ -83,7 +83,6 @@ def init_codeflash() -> None:
8383 if "setup_info" in locals ():
8484 module_string = f" you selected ({ setup_info .module_root } )"
8585
86-
8786 click .echo (
8887 f"{ LF } "
8988 f"⚡️ Codeflash is now set up! You can now run:{ LF } "
@@ -125,11 +124,13 @@ def ask_run_end_to_end_test(args: Namespace) -> None:
125124 bubble_sort_path , bubble_sort_test_path = create_bubble_sort_file_and_test (args )
126125 run_end_to_end_test (args , bubble_sort_path , bubble_sort_test_path )
127126
127+
128128def should_modify_pyproject_toml () -> bool :
129129 """Check if the current directory contains a valid pyproject.toml file with codeflash config
130130 If it does, ask the user if they want to re-configure it.
131131 """
132132 from rich .prompt import Confirm
133+
133134 pyproject_toml_path = Path .cwd () / "pyproject.toml"
134135 if not pyproject_toml_path .exists ():
135136 return True
@@ -144,7 +145,9 @@ def should_modify_pyproject_toml() -> bool:
144145 return True
145146
146147 create_toml = Confirm .ask (
147- "✅ A valid Codeflash config already exists in this project. Do you want to re-configure it?" , default = False , show_default = True
148+ "✅ A valid Codeflash config already exists in this project. Do you want to re-configure it?" ,
149+ default = False ,
150+ show_default = True ,
148151 )
149152 return create_toml
150153
@@ -160,7 +163,18 @@ def collect_setup_info() -> SetupInfo:
160163 # Check for the existence of pyproject.toml or setup.py
161164 project_name = check_for_toml_or_setup_file ()
162165
163- ignore_subdirs = ["venv" , "node_modules" , "dist" , "build" , "build_temp" , "build_scripts" , "env" , "logs" , "tmp" , "__pycache__" ]
166+ ignore_subdirs = [
167+ "venv" ,
168+ "node_modules" ,
169+ "dist" ,
170+ "build" ,
171+ "build_temp" ,
172+ "build_scripts" ,
173+ "env" ,
174+ "logs" ,
175+ "tmp" ,
176+ "__pycache__" ,
177+ ]
164178 valid_subdirs = [
165179 d for d in next (os .walk ("." ))[1 ] if not d .startswith ("." ) and not d .startswith ("__" ) and d not in ignore_subdirs
166180 ]
@@ -262,13 +276,13 @@ def collect_setup_info() -> SetupInfo:
262276 benchmarks_options .append (create_benchmarks_option )
263277 benchmarks_options .append (custom_dir_option )
264278
265-
266279 benchmarks_answer = inquirer_wrapper (
267280 inquirer .list_input ,
268281 message = "Where are your performance benchmarks located? (benchmarks must be a sub directory of your tests root directory)" ,
269282 choices = benchmarks_options ,
270283 default = (
271- default_benchmarks_subdir if default_benchmarks_subdir in benchmarks_options else benchmarks_options [0 ]),
284+ default_benchmarks_subdir if default_benchmarks_subdir in benchmarks_options else benchmarks_options [0 ]
285+ ),
272286 )
273287
274288 if benchmarks_answer == create_benchmarks_option :
@@ -304,7 +318,6 @@ def collect_setup_info() -> SetupInfo:
304318 # carousel=True,
305319 # )
306320
307-
308321 formatter = inquirer_wrapper (
309322 inquirer .list_input ,
310323 message = "Which code formatter do you use?" ,
@@ -340,7 +353,7 @@ def collect_setup_info() -> SetupInfo:
340353 return SetupInfo (
341354 module_root = str (module_root ),
342355 tests_root = str (tests_root ),
343- benchmarks_root = str (benchmarks_root ) if benchmarks_root else None ,
356+ benchmarks_root = str (benchmarks_root ) if benchmarks_root else None ,
344357 test_framework = cast (str , test_framework ),
345358 ignore_paths = ignore_paths ,
346359 formatter = cast (str , formatter ),
@@ -499,19 +512,22 @@ def install_github_actions(override_formatter_check: bool = False) -> None:
499512 return
500513 workflows_path .mkdir (parents = True , exist_ok = True )
501514 from importlib .resources import files
515+
502516 benchmark_mode = False
503517 if "benchmarks_root" in config :
504518 benchmark_mode = inquirer_wrapper (
505519 inquirer .confirm ,
506520 message = "⚡️It looks like you've configured a benchmarks_root in your config. Would you like to run the Github action in benchmark mode? "
507- " This will show the impact of Codeflash's suggested optimizations on your benchmarks" ,
521+ " This will show the impact of Codeflash's suggested optimizations on your benchmarks" ,
508522 default = True ,
509523 )
510524
511525 optimize_yml_content = (
512526 files ("codeflash" ).joinpath ("cli_cmds" , "workflows" , "codeflash-optimize.yaml" ).read_text (encoding = "utf-8" )
513527 )
514- materialized_optimize_yml_content = customize_codeflash_yaml_content (optimize_yml_content , config , git_root , benchmark_mode )
528+ materialized_optimize_yml_content = customize_codeflash_yaml_content (
529+ optimize_yml_content , config , git_root , benchmark_mode
530+ )
515531 with optimize_yaml_path .open ("w" , encoding = "utf8" ) as optimize_yml_file :
516532 optimize_yml_file .write (materialized_optimize_yml_content )
517533 click .echo (f"{ LF } ✅ Created GitHub action workflow at { optimize_yaml_path } { LF } " )
@@ -607,7 +623,7 @@ def get_dependency_manager_installation_string(dep_manager: DependencyManager) -
607623 python_version_string = f"'{ py_version .major } .{ py_version .minor } '"
608624 if dep_manager == DependencyManager .UV :
609625 return """name: 🐍 Setup UV
610- uses: astral-sh/setup-uv@v4
626+ uses: astral-sh/setup-uv@v6
611627 with:
612628 enable-cache: true"""
613629 return f"""name: 🐍 Set up Python
0 commit comments