pixi icon indicating copy to clipboard operation
pixi copied to clipboard

Enforce Pixi Version as Code

Open AliPiccioniQC opened this issue 1 year ago • 8 comments

Problem description

I want to guarantee a completely deterministic and reproducible toolchain across developer environments. To that end, I want tight guarantees about the version of the Pixi binary used in my repository.

Motivation

  • Mitigate unexpected results when developers run an out-dated or forwards incompatible version of Pixi.
  • Guarantee reproducible toolchain and behavior across developer environments and across CI and developer environments.

Objective Developers specify the Pixi version in a configuration file that is checked into their repository. The version of Pixi specified in the configuration file is used to execute all Pixi commands.

Prior Art See Bazelisk - a drop-in replacement for the Bazel executible. Developers specify the Bazel version in a .bazelrc, then bazelisk downloads that specific version of Bazel, and passes command executions through it.

AliPiccioniQC avatar Oct 15 '24 07:10 AliPiccioniQC

Hi @AliPiccioniQC, thanks for your message.

We should and will most likely build something like this. I currently can't give you a timeline. Would it already be enough to have a simple version check which just prints a big fat warning or error for the time being? Because that could fit into our current schedule.

ruben-arts avatar Oct 15 '24 12:10 ruben-arts

Hi @AliPiccioniQC, thanks for your message.

We should and will most likely build something like this. I currently can't give you a timeline. Would it already be enough to have a simple version check which just prints a big fat warning or error for the time being? Because that could fit into our current schedule.

Thanks for the quick response.

What you describe sounds like nice low-hanging fruit. Anecdotal, most developer issues seem to be from using a local pixi version that's too old. I would be happy to at least be able to enforce a minimum required version of pixi. (e.g. pixi >= 0.24.0)

AliPiccioniQC avatar Oct 15 '24 12:10 AliPiccioniQC

Great, here is a proposal:

  • Add an optional pixi-version field in the [(tool.pixi.)project] table within the Manifest, allowing a VersionSpec to be defined (e.g., pixi-version = ">=1.2.3").
  • Implement this in model.py for the schema validation + tests.
  • During manifest parsing, validate the version against the current pixi runtime version and provide a clear error or warning if the versions are incompatible.
  • Include tests to verify correct behavior for lower, matching, and higher version cases.

Anyone is welcome to take this on!

ruben-arts avatar Oct 15 '24 14:10 ruben-arts

As we observed problems for different pixi versions in the team, I would highly appreciate this feature!

I may be able to contribute on the weekend

Zaubeerer avatar Oct 15 '24 14:10 Zaubeerer

Thanks.

It would be best to have native support for version management in pixi. Until this feature is implemented, I've written a (temporary) thin wrapper to manage my own pixi versions.

AliPiccioniQC avatar Oct 17 '24 10:10 AliPiccioniQC

Writing a version [(tool.pixi.)project] is one thing. I would be very nice from deterministic perspective if the exact used version is also always written to the pixi.lock file when the pixi.lock is updated.... the later bootstrap mechanism can then either bootstrap a version that is in the range of what is specified via the pixi-version constrain in [(tool.pixi.)project] OR via "--exact" arg the version which was used to create/update the pixi.lock.

dbast avatar Oct 24 '24 14:10 dbast

pixi 0.44.0 comes with requires-pixi. this could be interesting in this scenario. i'm also planning in adding support for this in setup-pixi: https://github.com/prefix-dev/setup-pixi/issues/186

pavelzw avatar Mar 31 '25 12:03 pavelzw

@pavelzw @AliPiccioniQC can we consider this issue implemented or is there anything missing? :)

borchero avatar Apr 21 '25 18:04 borchero

I'll close it for now, feel free to reopen the possible missing features as a separate issue

ruben-arts avatar Apr 30 '25 09:04 ruben-arts