Skip to content

Commit

Permalink
Don't require .py extension
Browse files Browse the repository at this point in the history
  • Loading branch information
tfsingh committed Sep 20, 2024
1 parent 4146b3e commit 58026d2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
10 changes: 0 additions & 10 deletions crates/uv/src/commands/project/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,16 +634,6 @@ impl InitProjectKind {
if package {
warn_user_once!("`--package` is a no-op for Python scripts, which are standalone");
}

if let Some(path) = script_path.to_str() {
if !std::path::Path::new(path)
.extension()
.map_or(false, |ext| ext.eq_ignore_ascii_case("py"))
{
anyhow::bail!("Script must end in .py extension");
}
}

let client_builder = BaseClientBuilder::new()
.connectivity(connectivity)
.native_tls(native_tls);
Expand Down
11 changes: 1 addition & 10 deletions crates/uv/tests/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ fn init_script_create_directory() -> Result<()> {
Ok(())
}

// Init script should fail if file path exists or doesn't end with .py
// Init script should fail if file path exists
#[test]
fn init_script_file_conflicts() -> Result<()> {
let context = TestContext::new("3.12");
Expand All @@ -562,15 +562,6 @@ fn init_script_file_conflicts() -> Result<()> {
error: Script already exists at name_conflict.py
"###);

uv_snapshot!(context.filters(), context.init().current_dir(&child).arg("--script").arg("new_issue"), @r###"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
error: Script must end in .py extension
"###);

Ok(())
}

Expand Down

0 comments on commit 58026d2

Please sign in to comment.