feat: new `pixi global`
This adds functionality as described in https://pixi.sh/dev/design_proposals/pixi_global_manifest/
Test it locally by doing the following:
# Clone the repository
git clone https://github.com/prefix-dev/pixi.git
# Navigate into the repository
cd pixi
# Checkout a specific branch
git switch feature/pixi-global
# Install the Rust project with a custom binary name
pixi run install-as pixid
Helpful tests for us:
# Make sure that your current setup is loaded into a manifest in $HOME/.pixi/manifests/pixi_global.toml
> pixi global sync
⚠️ You don't have a global manifest yet.
Do you want to create one based on your existing installation?
ENTER!!
# Make sure running install adds a package and exposed the binaries
> pixi global install nushell
> nu
# Make sure binaries can be properly exposed as specials
> pixi global install "python==3.10.*" --expose python310=python
> python310
Nitpick: I'm not a fan of the project directory as this has nothing to do with the "pixi projects". I would just move all the code into the src/global. And then you could move the manifest into its own module for instance.
I have some messy left-overs from an earlier try.
I have files like:
#!/bin/sh
export PATH="/Users/wolfv/.pixi/envs/baz/bin:${PATH}"
export CONDA_PREFIX="/Users/wolfv/.pixi/envs/baz"
"/Users/wolfv/.pixi/envs/baz/bin/pip" "$@"
Where the .pixi/envs/baz does not exist anymore. I think we can / should check if the path still exists, and if not, we could also delete the shell script that links to the environment as a clean up.
EDIT by @Hofer-Julian: Should be fixed by https://github.com/prefix-dev/pixi/pull/2234
When running for the first time:
$ pixi global list
⚠️ You don't have a global manifest yet.
Do you want to create one based on your existing installation?
⚠️ You don't have a global manifest yet.
Do you want to create one based on your existing installation?
Your existing installation will be removed if you decide against it. yes
× Failed to create global manifest from existing installation
├─▶ Failed to extract exposed binaries from existing installation please clean up your installation.
├─▶ failed to read directory `/Users/tdejager/.pixi/envs/rattler-build/conda-meta`
╰─▶ No such file or directory (os error 2)
I don't remember doing anything with that folder? Maybe a bad global remove?
EDIT by @Hofer-Julian: Should be fixed by https://github.com/prefix-dev/pixi/pull/2234
When updating multiple envs, I don't know which one is currently updating (just see the name of the last one that was updated)
I was scared when it told me that we would remove everything. Maybe not have this option?
EDIT by @Hofer-Julian: Should be fixed by https://github.com/prefix-dev/pixi/pull/2234
As a user starting out I don't really have an idea that it's using a manifest and that there are some more features. Maybe with the migration it could give me some information in the console?
Also it told me it remove the installation folder, but sync still seems to remove some things.
Ohhh I want to see that shiny new manifest! How do I know what the path is? Can I use pixi global edit to open it in my $EDITOR?
EDIT by @Hofer-Julian: Will be fixed by https://github.com/prefix-dev/pixi/pull/2219
Doesn't show me version numbers which makes me saaaad :)
I was looking at pixi global add --help and the it's a bit hard to read the examples, like they all seem grouped together:
Adds dependencies to an environment
Example: pixi global add --environment python numpy pixi global add --environment my_env pytest pytest-cov --expose pytest=pytest
EDIT by @Hofer-Julian: fixed
I try to install older versions of rattler build which seems to either do nothing or be insanely fast. It at least doesn't give me much feedback.
Ahhh this kind of makes me think I can install pypi stuff as well, this is from the add command help:
--pypi-keyring-provider <PYPI_KEYRING_PROVIDER>
Specifies if we want to use uv keyring provider
[possible values: disabled, subprocess]
When I do pixi global install rattler-build=0.19 and then do pixi global install rattler-build it also seems to update rattler-build?
Can I see the location of the pixi toml as well in list?
╰─ pixi global list ─╯
Global environments at /Users/tdejager/.pixi:
├── bat: 0.24.0
├── ipython: 8.28.0
│ └─ exposes: ipython, ipython3
├── keyring: 25.4.1
└── nvim: 0.10.2
When I do this:
pixi global a --environment keyring keyrings.google-artifactregistry-auth
✔ Added package 'keyrings.google-artifactregistry-auth=1.1.1=pyhd8ed1ab_0'
I think I'd rather see:
pixi global a --environment keyring keyrings.google-artifactregistry-auth
├── keyring
└── dependencies: keyring 25.4.1, keyrings.google-artifactregistry-auth 1.1.1
Cause I'll probably always use pixi global list as a sanity check if it works.
I wonder if we should change the output:
╰─$ ixi global install "rattler-build 0.19"
✔ Added executable 'generate-cli-docs'.
To something that prints ✔ Added executable <color>generate-cli-docs</color>
Should we add the global manifest and the global bin dir to the output of pixi info?
I noticed that pixi global expose remove foo needs an env although there should probably be only a single foo anyways.
When updating or instlaling I would like to see the new version that was installed afterwards.
Also I had a situation where I did:
pixi global install rattler-build=0.23 # not the latest
pixi global update rattler-build # did not do anything
For the latter, I think it migth be good to print something. I know that might be more work though. Let's think about it tomorrow.
And one last little one: I tried to figure out what version of rattler-build I had installed, but I think pixi global list does not let me filter right now? I tried pixi global list rattler and pixi global list rattler-build. My assumption was, that, like search it would show me things starting with these letters.
@wolfv pixi g list -e rattler-build gives more info
Packages having underscore in their name get ignored
$ pixi g list
Global install location: C:\[redacted]\
├── conda-smithy 3.41.1
| └─ exec: feedstocks.bat, conda-smithy.bat
├── huggingface_hub 0.25.1
| └─ exec: huggingface-cli.bat
├── rattler-build 0.23.0
| └─ exec: rattler-build.bat, generate-cli-docs.bat
└── uv 0.4.17
└─ exec: uvx.bat, uv.bat
$ pixi-next g list
WARN Failed to parse environment name 'huggingface_hub', please use only lowercase letters, numbers and dashes
Global environments as specified in 'C:\[redacted]\manifests\pixi-global.toml'
├── conda-smithy: 3.41.1
│ └─ exposes: feedstocks, conda-smithy
├── rattler-build: 0.23.0
│ └─ exposes: generate-cli-docs, rattler-build
└── uv: 0.4.17
└─ exposes: uvx, uv
Oh nice find @chawyehsu!