Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/cli/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ platforms = {{ platforms }}
{%- endif %}

[tool.pixi.pypi-dependencies]
{{ name }} = { path = ".", editable = true }
{{ pypi_package_name }} = { path = ".", editable = true }

[tool.pixi.tasks]

Expand Down Expand Up @@ -334,12 +334,16 @@ pub async fn execute(args: Args) -> miette::Result<()> {

// Create a 'pyproject.toml' manifest
} else if pyproject {
// Python package names cannot contain '-', so we replace them with '_'
let pypi_package_name = default_name.replace("-", "_");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps better to parse the name as PackageName and use the dist info name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it!


let rv = env
.render_named_str(
consts::PYPROJECT_MANIFEST,
NEW_PYROJECT_TEMPLATE,
context! {
name => default_name,
pypi_package_name,
version,
author,
channels,
Expand All @@ -350,7 +354,8 @@ pub async fn execute(args: Args) -> miette::Result<()> {
)
.unwrap();
save_manifest_file(&pyproject_manifest_path, rv)?;
let src_dir = dir.join("src").join(default_name);

let src_dir = dir.join("src").join(pypi_package_name);
tokio::fs::create_dir_all(&src_dir)
.await
.into_diagnostic()
Expand Down