Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pixi tree and pixi tree -i command #238

Closed
pavelzw opened this issue Jul 29, 2023 · 15 comments · Fixed by #1069
Closed

Add pixi tree and pixi tree -i command #238

pavelzw opened this issue Jul 29, 2023 · 15 comments · Fixed by #1069

Comments

@pavelzw
Copy link
Contributor

pavelzw commented Jul 29, 2023

It would be nice to have pixi tree and pixi tree -i similar to cargo tree and cargo tree -i

old resolved issue for `pixi list`

It would be nice to have a command that lists all installed packages.

$ pixi install
$ pixi list
python   <build-string> <version>
...
$ pixi list --all-platforms
<same thing but all platforms>
$ pixi list --json
...

Maybe we could also highlight the explicitly specified dependencies similar to micromamba
image

@pavelzw pavelzw changed the title Add pixi list command Add pixi list command Jul 29, 2023
@baszalmstra
Copy link
Contributor

I think we should definitely add this. Poetry uses the show command instead of list I think.

cargo has the tree command which also enables showing the dependency graph as a tree (and in reverse). Maybe that might also be useful?

@pavelzw
Copy link
Contributor Author

pavelzw commented Aug 14, 2023

Yes, tree (+ reverse) would also be awesome!

@traversaro
Copy link
Contributor

Another place were this is useful: in RoboStack template we ask users reporting an issue to report the output of conda list/mamba list/micromamba list for reproducibility. At the moment, pixi users do not have an equivalent command, so it is not clear what we should recommend them, see RoboStack/ros-humble#100 . In theory pixi.lock contains that info in some form, but it is much less readable.

@gagandeepp
Copy link

Interested please assign

@raceychan
Copy link

is this assigned yet or wip?

@ruben-arts
Copy link
Contributor

Nope @raceychan, go ahead if you like!

@pavelzw pavelzw changed the title Add pixi list command Add pixi list and pixi tree command Jan 4, 2024
ruben-arts added a commit that referenced this issue Jan 16, 2024
Original ticket: #238

---------

Co-authored-by: Ruben Arts <[email protected]>
@ruben-arts
Copy link
Contributor

pixi list is merged. But we're still missing the pixi tree which would also be a nice feature. Best example I know would be cargo tree.

@pavelzw
Copy link
Contributor Author

pavelzw commented Jan 26, 2024

And cargo tree -i 😉

@pavelzw pavelzw changed the title Add pixi list and pixi tree command Add pixi tree command Jan 26, 2024
@pavelzw pavelzw changed the title Add pixi tree command Add pixi tree and pixi tree -i command Jan 26, 2024
abkfenris added a commit to abkfenris/pixi that referenced this issue Mar 26, 2024
fixes: prefix-dev#238

Adds a tree command for the CLI that can print out the tree of dependencies based on those defined in pixi.toml. Additionally it can filter the regular dependency tree, or show what tree of packages need a given package.

It keeps track of visits for the regular tree, but currently does not for the inverted one.
@abkfenris
Copy link
Contributor

I took a swing at implementing them in my branch here: abkfenris/pixi@manifest-env-var...abkfenris:pixi:tree

pixi on  tree is 📦 v0.17.1 via 🦀 v1.76.0
❯
pixi tree pre-commit
└── pre-commit v3.3.3
    ├── cfgv v3.3.1
    │   └── python v3.12.2
    │       ├── bzip2 v1.0.8
    │       ├── libexpat v2.6.2
    │       ├── libffi v3.4.2
    │       ├── libsqlite v3.45.2
    │       │   └── libzlib v1.2.13
    │       ├── libzlib v1.2.13 (*)
    │       ├── ncurses v6.4.20240210
    │       ├── openssl v3.2.1
    │       ├── readline v8.2
    │       │   └── ncurses v6.4.20240210 (*)
    │       ├── tk v8.6.13
    │       │   └── libzlib v1.2.13 (*)
    │       └── xz v5.2.6
    ├── identify v2.5.35
    │   └── python v3.12.2 (*)
    ├── nodeenv v1.8.0
    │   └── python v3.12.2 (*)
    ├── python v3.12.2 (*)
    ├── pyyaml v6.0.1
    │   ├── python v3.12.2 (*)
    │   ├── python v3.12.2 (*)
    │   ├── python_abi v3.12
    │   └── yaml v0.2.5
    └── virtualenv v20.25.1
        ├── distlib v0.3.8
        │   └── python v3.12.2 (*)
        ├── filelock v3.13.1
        │   └── python v3.12.2 (*)
        ├── platformdirs v4.2.0
        │   └── python v3.12.2 (*)
        └── python v3.12.2 (*)
pixi on  tree is 📦 v0.17.1 via 🦀 v1.76.0
❯
pixi tree -i yaml

yaml
└── pyyaml
    └── pre-commit

ruamel.yaml
├── cffconvert
└── pykwalify
    └── cffconvert

pyyaml
└── pre-commit

ruamel.yaml.clib
└── ruamel.yaml
    ├── cffconvert
    └── pykwalify
        └── cffconvert

It's not quite ready for a PR yet as I haven't implemented visiting or versions for the inverted tree, and I built it off of another branch I already have a PR in progress for.

@pavelzw
Copy link
Contributor Author

pavelzw commented Mar 26, 2024

Looks great!
What does it look like when running pixi tree (without pre-commit)? All dependencies are shown then?

@abkfenris
Copy link
Contributor

Yup, it'll print out everything if it's not given a regex pattern.

pixi tree
├── pre-commit v3.3.3
│   ├── cfgv v3.3.1
│   │   └── python v3.12.2
│   │       ├── bzip2 v1.0.8
│   │       ├── libexpat v2.6.2
│   │       ├── libffi v3.4.2
│   │       ├── libsqlite v3.45.2
│   │       │   └── libzlib v1.2.13
│   │       ├── libzlib v1.2.13 (*)
│   │       ├── ncurses v6.4.20240210
│   │       ├── openssl v3.2.1
│   │       ├── readline v8.2
│   │       │   └── ncurses v6.4.20240210 (*)
│   │       ├── tk v8.6.13
│   │       │   └── libzlib v1.2.13 (*)
│   │       └── xz v5.2.6
│   ├── identify v2.5.35
│   │   └── python v3.12.2 (*)
│   ├── nodeenv v1.8.0
│   │   └── python v3.12.2 (*)
│   ├── python v3.12.2 (*)
│   ├── pyyaml v6.0.1
│   │   ├── python v3.12.2 (*)
│   │   ├── python v3.12.2 (*)
│   │   ├── python_abi v3.12
│   │   └── yaml v0.2.5
│   └── virtualenv v20.25.1
│       ├── distlib v0.3.8
│       │   └── python v3.12.2 (*)
│       ├── filelock v3.13.1
│       │   └── python v3.12.2 (*)
│       ├── platformdirs v4.2.0
│       │   └── python v3.12.2 (*)
│       └── python v3.12.2 (*)
├── rust v1.76.0
│   └── rust-std-aarch64-apple-darwin v1.76.0
├── openssl v3.2.1
├── pkg-config v0.29.2
│   ├── libglib v2.78.4
│   │   ├── gettext v0.21.1
│   │   │   └── libiconv v1.17
│   │   ├── libcxx v16.0.6
│   │   ├── libffi v3.4.2 (*)
│   │   ├── libiconv v1.17 (*)
│   │   ├── libzlib v1.2.13 (*)
│   │   └── pcre2 v10.42
│   │       ├── bzip2 v1.0.8 (*)
│   │       └── libzlib v1.2.13 (*)
│   └── libiconv v1.17 (*)
├── git v2.42.0
│   ├── libexpat v2.6.2 (*)
│   ├── libiconv v1.17 (*)
│   ├── libzlib v1.2.13 (*)
│   ├── openssl v3.2.1 (*)
│   ├── pcre2 v10.42 (*)
│   └── perl v5.32.1
├── cffconvert v2.0.0
│   ├── click v8.1.7
│   │   └── python v3.12.2 (*)
│   ├── jsonschema v3.2.0
│   │   ├── attrs v23.2.0
│   │   │   └── python v3.12.2 (*)
│   │   ├── pyrsistent v0.20.0
│   │   │   ├── python v3.12.2 (*)
│   │   │   ├── python v3.12.2 (*)
│   │   │   └── python_abi v3.12 (*)
│   │   ├── python v3.12.2 (*)
│   │   └── six v1.16.0
│   ├── pykwalify v1.8.0
│   │   ├── docopt v0.6.2
│   │   ├── python v3.12.2 (*)
│   │   ├── python-dateutil v2.9.0
│   │   │   ├── python v3.12.2 (*)
│   │   │   └── six v1.16.0 (*)
│   │   └── ruamel.yaml v0.18.6
│   │       ├── python v3.12.2 (*)
│   │       ├── python v3.12.2 (*)
│   │       ├── python_abi v3.12 (*)
│   │       └── ruamel.yaml.clib v0.2.8
│   │           ├── python v3.12.2 (*)
│   │           ├── python v3.12.2 (*)
│   │           └── python_abi v3.12 (*)
│   ├── python v3.12.2 (*)
│   ├── requests v2.31.0
│   │   ├── certifi v2024.2.2
│   │   │   └── python v3.12.2 (*)
│   │   ├── charset-normalizer v3.3.2
│   │   │   └── python v3.12.2 (*)
│   │   ├── idna v3.6
│   │   │   └── python v3.12.2 (*)
│   │   ├── python v3.12.2 (*)
│   │   └── urllib3 v2.2.1
│   │       ├── brotli-python v1.1.0
│   │       │   ├── libcxx v16.0.6 (*)
│   │       │   ├── python v3.12.2 (*)
│   │       │   ├── python v3.12.2 (*)
│   │       │   └── python_abi v3.12 (*)
│   │       ├── pysocks v1.7.1
│   │       │   └── python v3.12.2 (*)
│   │       └── python v3.12.2 (*)
│   └── ruamel.yaml v0.18.6 (*)
└── tbump v6.9.0
    ├── cli-ui v0.17.2
    │   ├── colorama v0.4.6
    │   │   └── python v3.12.2 (*)
    │   ├── python v3.12.2 (*)
    │   ├── tabulate v0.9.0
    │   │   └── python v3.12.2 (*)
    │   └── unidecode v1.3.8
    │       └── python v3.12.2 (*)
    ├── docopt v0.6.2 (*)
    ├── python v3.12.2 (*)
    ├── schema v0.7.5
    │   ├── contextlib2 v21.6.0
    │   │   └── python v3.12.2 (*)
    │   └── python v3.12.2 (*)
    └── tomlkit v0.12.4
        └── python v3.12.2 (*)

@ruben-arts
Copy link
Contributor

Please create a PR, love to test it out!

@pavelzw
Copy link
Contributor Author

pavelzw commented Mar 27, 2024

How about pixi tree -d 2 that only prints up to 2 layers deep?

Another idea (maybe a bit crazy / niechy): How about having an additional output format for the DOT Language? This would allow us to create svg plots from the dependency structure. Maybe there are already libraries in rust that do this 😅

@abkfenris
Copy link
Contributor

I am trying really hard not to get nerd sniped by DOT formatting here (since I've already failed at getting nerd sniped by learning Rust and trying to contribute to Pixi)...let me try to get basic functionality in first.

I think the format is simple enough that I wouldn't need to bring another library in though.

@abkfenris
Copy link
Contributor

Ok, have fun #1069

abkfenris added a commit to abkfenris/pixi that referenced this issue Mar 28, 2024
fixes: prefix-dev#238

Adds a tree command for the CLI that can print out the tree of dependencies based on those defined in pixi.toml. Additionally it can filter the regular dependency tree, or show what tree of packages need a given package.

It keeps track of visits for the regular tree, but currently does not for the inverted one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants