prefix-dev / setup-pixi

GitHub Action to set up pixi :octocat: 📦
https://pixi.sh/dev/advanced/github_actions
BSD 3-Clause "New" or "Revised" License
56 stars 10 forks source link

Default environment is always installed when calling `pixi run` #102

Closed borchero closed 7 months ago

borchero commented 7 months ago

While this might be expected behavior, it caught me by surprise that

- name: Setup pixi
  uses: prefix-dev/setup-pixi@v0.6.0
  with:
    environments: test
- name: Run tests
  run: pixi run pytest
  shell: pixi run bash -e {0}

installs the default environment along with the test environment once pixi run is called.

Would it be feasible for pixi run to use the previously installed environment?

pavelzw commented 7 months ago

I'm not sure I understand your use case. Why are you not doing

- name: Setup pixi
  uses: prefix-dev/setup-pixi@v0.6.0
  with:
    environments: test
- name: Run tests
  run: pixi run -e test pytest

i.e. without shell:... and with -e test?

Would it be feasible for pixi run to use the previously installed environment?

This would be a bit awkward since this would change the way pixi behaves just by the environments that are installed. IMO the environments should be thought of as ephermal and not relevant to how pixi run behaves.

borchero commented 7 months ago

The actual reason for setting up the shell is a bit more contrived (I'm not actually trying to call pytest but a Go binary which calls another binary that must be in the PATH), I just wanted to simplify the example here :smile:

That being said, I can, of course, still do pixi run -e test bash -e {0} and this works nicely, but I was a little puzzled that pixi run bash -e {0} sets up the default env when first trying this out. IIRC this is different to how poetry behaves where you can simply do poetry run xxx after installing a particular dependency group.

IMO the environments should be thought of as ephermal and not relevant to how pixi run behaves.

Fair enough, I think that this is also reasonable. Nonetheless, we could maybe add a comment to the documentation? There already exists something along these lines but the README kinda suggests that specifying -e <env> is only relevant when installing multiple environments.

borchero commented 7 months ago

I guess this can be closed, I'd rather continue a similar discussion in #103 :smile: