From cf6c85b6b521b70c9a3be3b230951d999e32ff57 Mon Sep 17 00:00:00 2001 From: my1e5 <10064103+my1e5@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:04:30 +0100 Subject: [PATCH 1/4] Update default hello.py to include extra line --- crates/uv/src/commands/project/init.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/uv/src/commands/project/init.rs b/crates/uv/src/commands/project/init.rs index ef0b89b12474..79cece497560 100644 --- a/crates/uv/src/commands/project/init.rs +++ b/crates/uv/src/commands/project/init.rs @@ -368,6 +368,7 @@ fn init_application( def main(): print("Hello from {name}!") + if __name__ == "__main__": main() "#}, From 532e0578c816f019af1f930b85e1fd57c1c4daac Mon Sep 17 00:00:00 2001 From: my1e5 <10064103+my1e5@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:19:21 +0100 Subject: [PATCH 2/4] Update init.rs tests --- crates/uv/tests/init.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/uv/tests/init.rs b/crates/uv/tests/init.rs index aef72a66ceb0..47e30de0f723 100644 --- a/crates/uv/tests/init.rs +++ b/crates/uv/tests/init.rs @@ -102,6 +102,7 @@ fn init_application() -> Result<()> { def main(): print("Hello from foo!") + if __name__ == "__main__": main() "### From b907c24b05bafd7dfec055edfa723a8d42de57fa Mon Sep 17 00:00:00 2001 From: my1e5 <10064103+my1e5@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:21:33 +0100 Subject: [PATCH 3/4] Update projects.md docs to reflect new hello.py file --- docs/concepts/projects.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/concepts/projects.md b/docs/concepts/projects.md index 0e31ea2f0e76..14a8ff45c79f 100644 --- a/docs/concepts/projects.md +++ b/docs/concepts/projects.md @@ -115,6 +115,7 @@ The created script defines a `main` function with some standard boilerplate: def main(): print("Hello from example-app!") + if __name__ == "__main__": main() ``` From 29957c192cc5cc167b5d5b6e330ef993d1ed0d82 Mon Sep 17 00:00:00 2001 From: my1e5 <10064103+my1e5@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:38:23 +0100 Subject: [PATCH 4/4] Update init.rs tests --- crates/uv/tests/init.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/uv/tests/init.rs b/crates/uv/tests/init.rs index 47e30de0f723..b275a07f5924 100644 --- a/crates/uv/tests/init.rs +++ b/crates/uv/tests/init.rs @@ -223,6 +223,7 @@ fn init_application_other_python_exists() -> Result<()> { def main(): print("Hello from foo!") + if __name__ == "__main__": main() "### @@ -562,6 +563,7 @@ fn init_application_current_dir() -> Result<()> { def main(): print("Hello from foo!") + if __name__ == "__main__": main() "###