Enforce Pixi Version as Code
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.
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.
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)
Great, here is a proposal:
- Add an optional
pixi-versionfield in the[(tool.pixi.)project]table within theManifest, allowing aVersionSpecto 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!
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
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.
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.
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 @AliPiccioniQC can we consider this issue implemented or is there anything missing? :)
I'll close it for now, feel free to reopen the possible missing features as a separate issue