Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow for init to pixi.toml when pyproject.toml is available. #1640

Merged
merged 13 commits into from
Aug 5, 2024

Conversation

ruben-arts
Copy link
Contributor

@ruben-arts ruben-arts commented Jul 19, 2024

Adds a dialog for pyproject.toml use, and an option to overwrite the dialog with --format pixi

> pixi init --format pixi # forces to always use pixi.toml
# And:
> touch pyproject.toml
> pixi init

A 'pyproject.toml' file already exists.
Do you want to extend it with the [tool.pixi] configuration? [y/N]

Fixes #1615 #1207

@ruben-arts ruben-arts marked this pull request as draft July 19, 2024 12:12
@ruben-arts ruben-arts marked this pull request as ready for review July 19, 2024 13:09
@baszalmstra
Copy link
Contributor

Mm could we rename the flag to something like --force-pixi-toml or something like that? I think --pixi is a bit ambiguous.

src/cli/init.rs Outdated
.interact()
} else {
Ok(args.pyproject)
}.into_diagnostic()?;
Copy link
Contributor

Choose a reason for hiding this comment

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

This diagnostic only ever applies to dialoguer so I would just move it in the if branch.

@tdejager
Copy link
Contributor

Mm could we rename the flag to something like --force-pixi-toml or something like that? I think --pixi is a bit ambiguous.

I think because the other CLI flag is --pyproject, that --pixi was chosen.

@baszalmstra
Copy link
Contributor

baszalmstra commented Jul 23, 2024

I think because the other CLI flag is --pyproject, that --pixi was chosen.

I understand that, but pixi init --pixi just seems very ambiguous, does it not?

@tdejager
Copy link
Contributor

tdejager commented Jul 23, 2024

I think because the other CLI flag is --pyproject, that --pixi was chosen.

I understand that, but pixi init --pixi just seems very ambiguous, does it not?

Indeed, maybe we could have something like --style=pixi-manifest --style=pyproject-toml as additions? Not sure. I think the force also sounds a bit forced haha

edit

or add --pyproject-toml and --pixi-manifest or something? Keep --pyproject to be backwards compatible I suppose.

@baszalmstra
Copy link
Contributor

Any of those are better than --pixi. I think I like --style=pixi or --style=pyproject the best because it leaves the door open for other stuff.

@ruben-arts
Copy link
Contributor Author

I guess, having autocompletion would be nice here. So --pixi-toml and --pyproject-toml seem most comfortable to me. If pixi would support more manifests styles we should indeed make it a option instead of a flag.

@baszalmstra
Copy link
Contributor

Dont you also get autocompletion for the style option?

@ruben-arts
Copy link
Contributor Author

ruben-arts commented Jul 23, 2024

Dont you also get autocompletion for the style option?

You would need to write a dynamic complete script for each shell and patch the completions scripts.

Edit: this does work for enums indeed.

@baszalmstra
Copy link
Contributor

Not if style is just an enum right? At least thats the case for nushell conpletions I think.

@ruben-arts
Copy link
Contributor Author

@baszalmstra Updated this. Now it's --format pyproject and --format pixi, I deprecated the --pyproject to allow for CI to not break on update.

src/cli/init.rs Outdated Show resolved Hide resolved
Co-authored-by: Bas Zalmstra <zalmstra.bas@gmail.com>
@ruben-arts ruben-arts merged commit e135f82 into prefix-dev:main Aug 5, 2024
27 checks passed
@ruben-arts ruben-arts deleted the fix/pixi_option_in_ini branch August 5, 2024 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pixi init always writes to pyproject.toml if it exists
3 participants