From b16135338932ba848e4f41648f5471f81c9f3427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Rod=C3=A9s-Guirao?= Date: Tue, 26 Nov 2024 10:40:04 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20shorter=20version=20for=20path-to-f?= =?UTF-8?q?ile=20in=20snapshot=20(#3620)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ shorter version for path-to-file in snapshot * shorter argument name for manual inputs --- .../{{cookiecutter.short_name}}.py | 2 +- apps/wizard/etl_steps/snapshot.py | 4 ++-- etl/scripts/archive/run_all_snapshots/run_all_snapshots.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/wizard/etl_steps/cookiecutter/snapshot/{{cookiecutter.namespace}}/{{cookiecutter.snapshot_version}}/{{cookiecutter.short_name}}.py b/apps/wizard/etl_steps/cookiecutter/snapshot/{{cookiecutter.namespace}}/{{cookiecutter.snapshot_version}}/{{cookiecutter.short_name}}.py index 68268eaf79a..0f07ecb9c03 100644 --- a/apps/wizard/etl_steps/cookiecutter/snapshot/{{cookiecutter.namespace}}/{{cookiecutter.snapshot_version}}/{{cookiecutter.short_name}}.py +++ b/apps/wizard/etl_steps/cookiecutter/snapshot/{{cookiecutter.namespace}}/{{cookiecutter.snapshot_version}}/{{cookiecutter.short_name}}.py @@ -12,7 +12,7 @@ @click.command() @click.option("--upload/--skip-upload", default=True, type=bool, help="Upload dataset to Snapshot") {% if cookiecutter.dataset_manual_import == True %} -@click.option("--path-to-file", prompt=True, type=str, help="Path to local data file.") +@click.option("--path-to-file", "-f", prompt=True, type=str, help="Path to local data file.") def main(path_to_file: str, upload: bool) -> None: # Create a new snapshot. snap = Snapshot(f"{{cookiecutter.namespace}}/{SNAPSHOT_VERSION}/{{cookiecutter.short_name}}.{{cookiecutter.file_extension}}") diff --git a/apps/wizard/etl_steps/snapshot.py b/apps/wizard/etl_steps/snapshot.py index ed9d8c483f4..8cc5b71c90d 100644 --- a/apps/wizard/etl_steps/snapshot.py +++ b/apps/wizard/etl_steps/snapshot.py @@ -789,7 +789,7 @@ def run_snap_step() -> None: # Display next steps if form.dataset_manual_import: - manual_import_instructions = "--path-to-file **relative path of file**" + manual_import_instructions = "-f **relative path of file**" else: manual_import_instructions = "" st.subheader("Next steps") @@ -845,7 +845,7 @@ def run_snap_step() -> None: commands = ["uv", "run", "python", script_path] if form.dataset_manual_import: # Get snapshot local file - commands.extend(["--path-to-file", st.session_state["snapshot_file"]]) + commands.extend(["-f", st.session_state["snapshot_file"]]) command_str = f"`{' '.join(commands)}`" # Run step diff --git a/etl/scripts/archive/run_all_snapshots/run_all_snapshots.py b/etl/scripts/archive/run_all_snapshots/run_all_snapshots.py index 859786f0249..bc1c25ff2f8 100644 --- a/etl/scripts/archive/run_all_snapshots/run_all_snapshots.py +++ b/etl/scripts/archive/run_all_snapshots/run_all_snapshots.py @@ -58,7 +58,7 @@ def main(): log.info(f"Skipping {snapshot_script} because it does not have --upload flag.") continue # Skip scripts that require the use of a local file. - if "--path-to-file" in snapshot_text: + if ("--path-to-file" in snapshot_text) or ("-f " in snapshot_text): log.info(f"Skipping {snapshot_script} because it requires a local file.") continue