Skip to content

feat: run conda-script files via pixi run --experimental --script - #6909

Open
Hofer-Julian wants to merge 1 commit into
conda-script-shellfrom
conda-script-run
Open

feat: run conda-script files via pixi run --experimental --script#6909
Hofer-Julian wants to merge 1 commit into
conda-script-shellfrom
conda-script-run

Conversation

@Hofer-Julian

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

Copy link
Copy Markdown
Contributor

pixi run --experimental --script FILE runs conda-script files (#3751) end to end.

  • --experimental gates the new path and has no effect for PEP 723 scripts, so #!/usr/bin/env -S pixi run --experimental --script works for both block kinds; a conda-script file without the flag errors with a hint naming it
  • The block synthesizes a workspace through the existing script machinery: [dependencies] fills the default feature and [tool.pixi.*] becomes a second feature of the default environment, so both spec sets reach the solver as a union
  • The environment resolves for the machine, an adjacent lock file wins when present, and pixi lock --script FILE writes FILE.pixi.lock for conda-script files too
  • The entrypoint runs through the mini-shell with ${SCRIPT} and ${CACHE} defined and the working directory left at the invocation directory
  • A malformed pseudo-block in a .py file falls back to the PEP 723 path, so files that ran before keep running; initializing a file that already carries a conda-script block is refused
  • Integration tests cover the gate, the routing, argument forwarding, ${CACHE} persistence, when dependencies and locking

Considerations before merging

  • pixi lock --script accepts conda-script files without --experimental, since the flag only exists on run; locking a file with source dependencies fetches and builds them, like a PEP 723 script with the pixi-build preview does
  • Leading-hyphen arguments after the script path need a -- separator, the same as for PEP 723 scripts; a shebang line cannot insert one
  • The entrypoint's child processes get no kill-signal drop guard yet, unlike task execution

@Hofer-Julian Hofer-Julian changed the title conda script run feat: run conda-script files via pixi run --experimental --script Aug 27, 2026
@Hofer-Julian
Hofer-Julian force-pushed the conda-script-run branch 2 times, most recently from 38212f8 to 77ac750 Compare August 31, 2026 11:20
Wires the conda-script proposal (#3751) into the CLI. A `--script` file with a
`/// conda-script` block routes to a new path behind the `--experimental`
flag, which has no effect for PEP 723 scripts so a shebang line can pass it
unconditionally. The block synthesizes a workspace through the existing
script machinery: `[dependencies]` fills the default feature while
`[tool.pixi.dependencies]` and `[tool.pixi.pypi-dependencies]` become a
second feature of the default environment, so both spec sets reach the
solver as a union. The environment resolves for the host, an adjacent lock
file wins when present, and `pixi lock --script FILE` writes `FILE.pixi.lock`
for conda-script files too. The entrypoint runs through the mini-shell with
`${SCRIPT}` and `${CACHE}` defined, cwd left at the invocation directory and
CLI arguments appended to the last command.
@Hofer-Julian
Hofer-Julian marked this pull request as ready for review August 31, 2026 12:43
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.

1 participant