Skip to content

feat: add --fields argument to pixi list#5105

Merged
ruben-arts merged 10 commits intoprefix-dev:mainfrom
baszalmstra:claude/pixi-issue-5102-01CFcS51XcAKTmH56mxUzLch
Dec 11, 2025
Merged

feat: add --fields argument to pixi list#5105
ruben-arts merged 10 commits intoprefix-dev:mainfrom
baszalmstra:claude/pixi-issue-5102-01CFcS51XcAKTmH56mxUzLch

Conversation

@baszalmstra
Copy link
Contributor

@baszalmstra baszalmstra commented Dec 10, 2025

Description

Adds the --fields argument to pixi list and exposes just about everything possible.

Fixes #5102
Fixes #4715
Fixes #2076
Fixes #1558

How Has This Been Tested?

  • User tested

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: Claude Opus 4.5

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added sufficient tests to cover my changes.
  • I have verified that changes that would impact the JSON schema have been made in schema/model.py.

This adds a new `--fields` argument to the `pixi list` command that
allows users to:
- Select which columns to display in the output
- Control the order in which columns appear

Available fields include: name, version, build, build-number, size,
kind, source, license, license-family, is-explicit, is-editable,
description, md5, sha256, arch, platform, subdir, timestamp, noarch,
file-name, and url.

The default fields match the current behavior: name, version, build,
size, kind, source.

Example usage:
  pixi list --fields name,version,license
  pixi list --fields name,version,sha256

Closes prefix-dev#5102
- Remove Serialize derive and serde attribute since Field is never serialized
- Remove redundant doc comment listing available fields (clap shows them in help)
- Regenerate CLI documentation
@bollwyvl
Copy link
Contributor

Also, whilst mucking about in here: some care to alignment would be helpful: pretty much anything in an ordinal domain would benefit from being right-aligned. size, specifically, would also benefit from always including one trailing decimal place, as per prefix-dev/rattler-build#1399

name           version        build                 size    kind   source
openssl        3.6.0          h26f9b46_0        3 MiB       conda  https://conda.anaconda.org/conda-forge/
oras-py        0.1.14         pyhd8ed1ab_0      33.6 KiB    conda  https://conda.anaconda.org/conda-forge/
packaging      25.0           pyh29332c3_1      61 KiB      conda  https://conda.anaconda.org/conda-forge/

vs:

name           version        build                 size    kind   source
openssl        3.6.0          h26f9b46_0         3.0 MiB    conda  https://conda.anaconda.org/conda-forge/
oras-py        0.1.14         pyhd8ed1ab_0      33.6 KiB    conda  https://conda.anaconda.org/conda-forge/
packaging      25.0           pyh29332c3_1      61.0 KiB    conda  https://conda.anaconda.org/conda-forge/

This still leaves size somewhat difficult to visually inspect: i believe rattler-build now makes "sizes over some threshhold" a different color, but this approach (or any bold/color) can get lost in logs. I'm not sure how to encode this, as my one ASCII proposal was not well-received.

Another example of data loss is the (useful) direct/transitive dependency status, with a direct dependency encoded as a bold, green package name. Perhaps a depth field (if easy) would be even more useful, especially if direct dependencies were omitted entirely.

depth   name           version        build                 size    kind   source
    4   openssl        3.6.0          h26f9b46_0         3.0 MiB    conda  https://conda.anaconda.org/conda-forge/
    3   oras-py        0.1.14         pyhd8ed1ab_0      33.6 KiB    conda  https://conda.anaconda.org/conda-forge/
        packaging      25.0           pyh29332c3_1      61.0 KiB    conda  https://conda.anaconda.org/conda-forge/

claude and others added 3 commits December 10, 2025 21:03
Switch from tabwriter to comfy-table for table formatting in pixi list:
- Right-align the Size column for better readability
- Keep styling for explicit dependencies (bold colored names)
- Keep fancy display for package kind
- Simpler API without manual tab-delimited formatting
@baszalmstra
Copy link
Contributor Author

I added the alignment for size:

image

Computing the depth is a bit more involved but I added a field for the requested-spec:

image

@baszalmstra baszalmstra marked this pull request as ready for review December 10, 2025 22:25
@bollwyvl
Copy link
Contributor

The Requested is great, and shows actual information: could get long for some matchspecs out there in the wild, but probably more useful than some tree-walking metric which i've frankly never seen anywhere else, certainly not worth the hustle to dig that up if it's not just lying around.

Again regarding space/noise: I'm not sure how much value the second decimal place provides, but hardly seems worth doing anything about, and certainly would be relevant for the GiB unit.

Copy link
Contributor

@nichmor nichmor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loooks good technically and semantically!

@ruben-arts
Copy link
Contributor

Works great! My humor is probably broken, but I think this is funny:

image

@ruben-arts ruben-arts merged commit 916e6ac into prefix-dev:main Dec 11, 2025
47 checks passed
@ruben-arts ruben-arts deleted the claude/pixi-issue-5102-01CFcS51XcAKTmH56mxUzLch branch December 11, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants