pixi icon indicating copy to clipboard operation
pixi copied to clipboard

Add license column to `pixi list`

Open deltamarnix opened this issue 3 months ago • 8 comments

Problem description

pixi list is very useful to get a list of all the packages. I want to be able to check all the licenses that are associated with the packages. It seems that pixi.lock contains all this information about package licenses.

Would it be possible to add a column for which license the package is distributed under?

In the lock file I see:

- conda: https://conda.anaconda.org/conda-forge/noarch/affine-2.4.0-pyhd8ed1ab_1.conda
  sha256: 0deeaf0c001d5543719db9b2686bc1920c86c7e142f9bec74f35e1ce611b1fc2
  md5: 8c4061f499edec6b8ac7000f6d586829
  depends:
  - python >=3.9
  license: BSD-3-Clause # <-- this info would be very useful
  license_family: BSD
  size: 19164
  timestamp: 1733762153202

deltamarnix avatar Oct 09 '25 06:10 deltamarnix

Sounds good to me!

Hofer-Julian avatar Oct 09 '25 07:10 Hofer-Julian

We're open to contributions! 😄

ruben-arts avatar Oct 13 '25 07:10 ruben-arts

I think it can also be an option, so you can opt in to show the license.

nichmor avatar Oct 17 '25 08:10 nichmor

yes I think an option would be great! What should the option look like - pixi list --liscense? I would be happy to make the PR.

mrswastik-robot avatar Oct 20 '25 21:10 mrswastik-robot

@deltamarnix can i work on this ?

MAVRICK-1 avatar Oct 23 '25 06:10 MAVRICK-1

hey @MAVRICK-1 ! I think it is free to pickup in case @mrswastik-robot doesn't work on this

nichmor avatar Oct 23 '25 06:10 nichmor

sure, pick it up @MAVRICK-1

mrswastik-robot avatar Oct 23 '25 07:10 mrswastik-robot

Go ahead, I'm a pixi end user, and I'm not familiar with Rust.

deltamarnix avatar Oct 23 '25 07:10 deltamarnix

I think this has more to do with how rattler only picks up these info about bdist and sdist from the lock-file:

/// Information about a binary conda package stored in the lock-file.
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct CondaBinaryData {
    /// The package record.
    pub package_record: PackageRecord,

    /// The location of the package. This can be a URL or a local path.
    pub location: UrlOrPath,

    /// The filename of the package.
    pub file_name: String,

    /// The channel of the package.
    pub channel: Option<ChannelUrl>,
}

See: https://github.com/conda/rattler/blob/3b825691270a8fac0d5c260021855d8f47bb98a2/crates/rattler_lock/src/conda.rs#L107

(Same for sdist).

This is used by CondaPackageData, which pixi uses to list all the info.

I can dig deeper if no one has already made progress.

prady0t avatar Nov 15 '25 21:11 prady0t

I think you can take it from PackageRecord. Please go ahead @prady0t

nichmor avatar Nov 17 '25 09:11 nichmor

Yes, we can. Thanks! Do we also have a similar method for finding licenses for PyPI packages? I cannot find it in PypiPackageData:


pub struct PypiPackageData {
    /// The name of the package.
    pub name: PackageName,

    /// The version of the package.
    pub version: pep440_rs::Version,

    /// The location of the package. This can be a URL or a path.
    pub location: UrlOrPath,

    /// Hashes of the file pointed to by `url`.
    pub hash: Option<PackageHashes>,

    /// A list of dependencies on other packages.
    pub requires_dist: Vec<Requirement>,

    /// The python version that this package requires.
    pub requires_python: Option<VersionSpecifiers>,

    /// Whether the projects should be installed in editable mode or not.
    pub editable: bool,
}

prady0t avatar Nov 17 '25 12:11 prady0t