Add license column to `pixi list`
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
Sounds good to me!
We're open to contributions! 😄
I think it can also be an option, so you can opt in to show the license.
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.
@deltamarnix can i work on this ?
hey @MAVRICK-1 ! I think it is free to pickup in case @mrswastik-robot doesn't work on this
sure, pick it up @MAVRICK-1
Go ahead, I'm a pixi end user, and I'm not familiar with Rust.
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.
I think you can take it from PackageRecord. Please go ahead @prady0t
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,
}