From 2111778b316555de0c3d459056e7e9d4ed56119d Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Wed, 28 Feb 2024 00:51:42 -0500 Subject: [PATCH] Fix the script name to be the project name (#801) --- CHANGELOG.md | 3 +++ rye/src/templates/pyproject.toml.j2 | 2 +- rye/tests/test_init.rs | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab926a742a..bb71089114 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ that were not yet released. _Unreleased_ +- The `init` command now generates a script with the name of the + project rather than `hello`. #801 + - Retain markers when adding dependencies with features when uv is used. #807 diff --git a/rye/src/templates/pyproject.toml.j2 b/rye/src/templates/pyproject.toml.j2 index b8d4b9d376..d3db4b9d97 100644 --- a/rye/src/templates/pyproject.toml.j2 +++ b/rye/src/templates/pyproject.toml.j2 @@ -29,7 +29,7 @@ classifiers = ["Private :: Do Not Upload"] {%- if is_script %} [project.scripts] -hello = {{ name_safe ~ ":main"}} +{{ name }} = {{ name_safe ~ ":main"}} {%- endif %} {%- if not is_virtual %} diff --git a/rye/tests/test_init.rs b/rye/tests/test_init.rs index 9e636985d0..a5ce194501 100644 --- a/rye/tests/test_init.rs +++ b/rye/tests/test_init.rs @@ -131,7 +131,7 @@ fn test_init_script() { + my-project==0.1.0 (from file:[TEMP_PATH]/project) "###); - rye_cmd_snapshot!(space.rye_cmd().arg("run").arg("hello"), @r###" + rye_cmd_snapshot!(space.rye_cmd().arg("run").arg("my-project"), @r###" success: true exit_code: 0 ----- stdout -----