Skip to content

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

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

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 is inert 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; pixi init --script refuses files that already carry a conda-script block
  • 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
  • Only run, lock and init know about conda-script files; add, update, list and friends still report "not a Python script"
  • Leading-hyphen arguments after the script path need a -- separator, the same as for PEP 723 scripts; a shebang line cannot insert one

@Hofer-Julian Hofer-Julian changed the title conda script run feat: run conda-script files via pixi run --experimental --script Aug 27, 2026
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 is inert 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.
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