Skip to content

feat: initialize scripts of any language with pixi init --script - #6929

Open
Hofer-Julian wants to merge 1 commit into
conda-script-commandsfrom
conda-script-init
Open

feat: initialize scripts of any language with pixi init --script#6929
Hofer-Julian wants to merge 1 commit into
conda-script-commandsfrom
conda-script-init

Conversation

@Hofer-Julian

@Hofer-Julian Hofer-Julian commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

pixi init --script <PATH> picks the block from the file extension (#3751).

  • A Python file gets a PEP 723 block; every other known extension gets a conda-script block from a per-language template with the comment prefix, an entrypoint, the toolchain dependency and a hello-world body
  • --format gains pep723 and conda-script to override that default
  • Unknown extensions error and list the supported ones
  • --script names one path, so a workspace directory next to it errors with the combined path to use instead: pixi init --script main.mojo some_directory points at pixi init --script some_directory/main.mojo

@Hofer-Julian Hofer-Julian changed the title conda script init feat: initialize scripts of any language with pixi init --manifest-path Aug 31, 2026
@Hofer-Julian
Hofer-Julian marked this pull request as ready for review August 31, 2026 12:43
@Hofer-Julian Hofer-Julian changed the title feat: initialize scripts of any language with pixi init --manifest-path feat: initialize scripts of any language with pixi init <PATH> Sep 3, 2026
@Hofer-Julian Hofer-Julian changed the title feat: initialize scripts of any language with pixi init <PATH> feat!: initialize scripts of any language with pixi init <PATH> Sep 3, 2026
@Hofer-Julian
Hofer-Julian force-pushed the conda-script-init branch 2 times, most recently from 889c77e to 5c7d4d1 Compare September 3, 2026 12:57
@ruben-arts

Copy link
Copy Markdown
Contributor

I'm not a huge fan of this change. Now we have to make a decision what a file extention is vs a path.

I did like the consistency of --script where every time you do something with a script you add that. I can totally see the --script script.py --format conda-script for this one edge case where you want to use conda-script for python files. And for heavy users we could add a configuration to default to conda-script even for python files for instance.

@Hofer-Julian

Copy link
Copy Markdown
Contributor Author

I'm not a huge fan of this change. Now we have to make a decision what a file extention is vs a path.

I did like the consistency of --script where every time you do something with a script you add that. I can totally see the --script script.py --format conda-script for this one edge case where you want to use conda-script for python files. And for heavy users we could add a configuration to default to conda-script even for python files for instance.

As discussed, I don't really agree with your point of view. But I do see where you are coming from, and I can live with the old behavior.

@Hofer-Julian Hofer-Julian changed the title feat!: initialize scripts of any language with pixi init <PATH> feat: initialize scripts of any language with pixi init --script Sep 4, 2026
`pixi init --script <PATH>` picks the block from the file extension. A Python
file gets a PEP 723 block, and every other known extension gets a
`conda-script` block from a per-language template with the comment prefix, an
entrypoint that runs immediately, the toolchain dependency and a hello-world
body for fresh files.

`--format` gains `pep723` and `conda-script` to override that default, so
`pixi init --script main.py --format conda-script` creates a conda-script
Python file. Unknown extensions error and list the supported ones.

`--script` names one path, so passing a workspace directory next to it errors
with the combined path to use instead: `pixi init --script main.mojo
some_directory` points at `pixi init --script some_directory/main.mojo`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants