feat(cli): add new pixi global tree command #4427
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3975
This pull request introduces a new global command,
pixi global tree
. The behavior is very similar topixi tree
, but it works on global environments.It is required to pass an argument representing the environment to target, like
pixi global list
.The implementation was extracted from the one existing for
pixi tree
, with some attempts at simplifying and documenting to make maintenance on it easier.Example screenshots:

I also included a small tweak to reduce the verbosity of the output slightly by filtering virtual packages (such as
__osx
), which I believe to be of little use for users of this command. This tweak was applied both to the new command and to the workspace-specific tree command.Just like the workspace-specific tree command, I've also allowed the possibility of printing dependent trees / reverse dependency trees by passing the
--invert
flag and specifying a regex to filter the packages to show.Two assumptions I'd like confirmation on, since this is my first code PR to Pixi and I'm not knowledgeable of package managers / Conda:
--pypi
flag inpixi global add
. I initially assumed this was possible, e.g. if I wanted a global environment with a Jupyter Notebook with specific Pypi dependencies that aren't available on Conda.conda-meta
folder. From some basic manual tests, the output looks correct, but I'm not sure whether there is some edge case or nuance I'm missing.I'm contributing to Pixi both because the project is really useful imo, but I also want to keep/improve my Rust skills, so please feel free to point out any issue or possible improvement during the review! Even though most of the code is "recycled" from the current implementation of
pixi tree
:)Edit: I just saw another PR related to the tree command: #4261. This PR may conflict with that one. I'm not sure if the PR is still active or not. If my PR is merged first, it might be a good idea to add the json format to the global tree command for consistency.