Skip to content

feat(list): add a flag to only list local packages#6030

Open
IamPhytan wants to merge 1 commit into
prefix-dev:mainfrom
IamPhytan:feat/list-local-packages
Open

feat(list): add a flag to only list local packages#6030
IamPhytan wants to merge 1 commit into
prefix-dev:mainfrom
IamPhytan:feat/list-local-packages

Conversation

@IamPhytan
Copy link
Copy Markdown

@IamPhytan IamPhytan commented May 6, 2026

Description

Provide a way to list only packages that are part of a Pixi workspace.

$ pixi list
Name                               Version          Build                          Size  Kind   Source
_libgcc_mutex                      0.1              conda_forge                2.50 KiB  conda  https://prefix.dev/conda-forge
...
zstd                               1.5.7            hb78ec9c_6               587.28 KiB  conda  https://prefix.dev/conda-forge

$ pixi list --local
Error:   × No local packages found in 'default' environment for 'linux-64' platform.

$ pixi list -w my-pixi-workspace
Name               Version    Build                        Size  Kind   Source
_openmp_mutex      4.5        20_gnu                  28.27 KiB  conda  https://conda.anaconda.org/conda-forge
bzip2              1.0.8      hda65f42_9             254.08 KiB  conda  https://conda.anaconda.org/conda-forge
ca-certificates    2026.4.22  hbd8a1cb_0             127.97 KiB  conda  https://conda.anaconda.org/conda-forge
ld_impl_linux-64   2.45.1     default_hbd61a6d_102   710.94 KiB  conda  https://conda.anaconda.org/conda-forge
libexpat           2.8.0      hecca717_0              75.43 KiB  conda  https://conda.anaconda.org/conda-forge
libffi             3.5.2      h3435931_0              57.22 KiB  conda  https://conda.anaconda.org/conda-forge
libgcc             15.2.0     he0feb66_18           1017.37 KiB  conda  https://conda.anaconda.org/conda-forge
libgomp            15.2.0     he0feb66_18            589.12 KiB  conda  https://conda.anaconda.org/conda-forge
liblzma            5.8.3      hb03c661_0             110.82 KiB  conda  https://conda.anaconda.org/conda-forge
libmpdec           4.0.0      hb03c661_1              90.23 KiB  conda  https://conda.anaconda.org/conda-forge
libsqlite          3.53.1     h0c1763c_0             932.58 KiB  conda  https://conda.anaconda.org/conda-forge
libstdcxx          15.2.0     h934c35e_18              5.58 MiB  conda  https://conda.anaconda.org/conda-forge
libuuid            2.42       h5347b49_0              39.35 KiB  conda  https://conda.anaconda.org/conda-forge
libzlib            1.3.2      h25fd6f3_2              62.14 KiB  conda  https://conda.anaconda.org/conda-forge
my_cpp_package     0.1.0      hb0f4dca_0                         conda  packages/my_cpp_package
my_python_package  0.1.0      pyh4616a5c_0                       conda  packages/my_python_package
ncurses            6.6        hdb14827_0             897.42 KiB  conda  https://conda.anaconda.org/conda-forge
numpy              2.4.4                              53.90 MiB  pypi   https://pypi.org/simple
openssl            3.6.2      h35e630c_0               3.02 MiB  conda  https://conda.anaconda.org/conda-forge
python             3.14.4     habeac84_100_cp314      35.01 MiB  conda  https://conda.anaconda.org/conda-forge
python_abi         3.14       8_cp314                  6.83 KiB  conda  https://conda.anaconda.org/conda-forge
readline           8.3        h853b02a_0             336.99 KiB  conda  https://conda.anaconda.org/conda-forge
tk                 8.6.13     noxft_h366c992_103       3.15 MiB  conda  https://conda.anaconda.org/conda-forge
tzdata             2025c      hc9c84f9_1             116.34 KiB  conda  https://conda.anaconda.org/conda-forge
zstd               1.5.7      hb78ec9c_6             587.28 KiB  conda  https://conda.anaconda.org/conda-forge

$ pixi list -w my-pixi-workspace --local
Name               Version  Build         Size  Kind   Source
my_cpp_package     0.1.0    hb0f4dca_0          conda  packages/my_cpp_package
my_python_package  0.1.0    pyh4616a5c_0        conda  packages/my_python_package

$ pixi list -w empty_workspace
Error:   × No packages found in 'default' environment for 'linux-64' platform.

$ pixi list -w empty_workspace --local 
Error:   × No local packages found in 'default' environment for 'linux-64' platform.

How Has This Been Tested?

Ran pixi run lint and pixi run test
Used the built pixi binary to test the behavior on different workspaces (as visible above)

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

Copy link
Copy Markdown
Contributor

@baszalmstra baszalmstra left a comment

Choose a reason for hiding this comment

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

We also already have --explicit what does --local mean? You now check that the size == None but that can also be true for binary conda packages or pypi packages.

@IamPhytan
Copy link
Copy Markdown
Author

Hi @baszalmstra

We also already have --explicit what does --local mean?

If I understand correctly, explicit shows all the dependencies that are explicitly listed in pixi.toml. I wanted to implement a flag to only list the packages that are part of a workspace, with a local path.

You now check that the size == None but that can also be true for binary conda packages or pypi packages.

Fair, while trying to implement, I found out that checking size == None was working because of the implementation of Package:

https://github.com/prefix-dev/pixi/blob/main/crates/pixi_api/src/workspace/list/package.rs#L71-L115

But probably there is a better way to do it, either in the package discovery, or while scraping the content of the workspace's pixi.toml ?

Thanks for the feedback !

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 this pull request may close these issues.

2 participants