Skip to content

feat(list): add a license column#4935

Closed
prady0t wants to merge 3 commits intoprefix-dev:mainfrom
prady0t:liscense-column
Closed

feat(list): add a license column#4935
prady0t wants to merge 3 commits intoprefix-dev:mainfrom
prady0t:liscense-column

Conversation

@prady0t
Copy link
Copy Markdown
Contributor

@prady0t prady0t commented Nov 17, 2025

Description

Added a column for license in pixi list, this is the output now:
Screenshot 2025-11-18 at 1 18 38 AM

Fixes #4715

How Has This Been Tested?

Building locally and then pixi list

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.

@prady0t prady0t changed the title Add a license column in pixi list feat: add a license column in pixi list Nov 17, 2025
@lucascolley lucascolley changed the title feat: add a license column in pixi list feat(list): add a license column Nov 19, 2025
@lucascolley lucascolley added enhancement New features area:list Related to pixi list labels Nov 19, 2025
@ruben-arts
Copy link
Copy Markdown
Contributor

Hi @prady0t, thank you for the PR. I was testing/playing with it a little more.

I added --sort-by license and --show-license I felt like the output became a little too verbose, so hiding it behind a flag seemed like the right way to me. What do you think?

Copy link
Copy Markdown
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

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

I'm approving it from my side.

@prady0t
Copy link
Copy Markdown
Contributor Author

prady0t commented Nov 24, 2025

What do you think?

Yes, it looks much clearer now. Thanks for the changes.

Copy link
Copy Markdown
Contributor Author

@prady0t prady0t left a comment

Choose a reason for hiding this comment

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

@ruben-arts I think this is ready to be merged.

pub fn license(&self) -> Cow<'_, str> {
match self {
Self::Conda(value) => value.record().license.as_deref().unwrap_or("").into(),
Self::PyPI(_value, _) => String::from("").into()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can't find a way to extract PyPI license info. Maybe we need to add a field in PyPiPackageData in rattler? @nichmor

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Still not sure if we need to/can address this in rattler.

}
}

pub fn license(&self) -> Cow<'_, str> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lets return Option<&str> here instead

Comment on lines +460 to +464
let license = if show_license {
Some(package.license().into_owned())
} else {
None
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it makes more sense to just remove this argument and return Option<..> from package.license instead.

# Test that --show-license flag shows the License column header
verify_cli_command(
[pixi, "list", "--manifest-path", manifest_path, "--show-license"],
stdout_contains="License",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe we should also verify that a license is actually outputted. Maybe just add MIT here? Or a just any license that is in the output.

@baszalmstra
Copy link
Copy Markdown
Contributor

I noticed that conda list uses a --fields argument to specify which fields to show. I think thats a much more elegant approach because it allows you to exactly specify what you want and the order. I think it would be much more future proof to implement that instead.

@prady0t
Copy link
Copy Markdown
Contributor Author

prady0t commented Dec 7, 2025

I think it would be much more future-proof to implement that instead.

Sounds like a good idea. Should I open a new issue for this?

@ruben-arts
Copy link
Copy Markdown
Contributor

Thanks for your work, I guess we can close this now as it inspired @baszalmstra enough to make the --fields option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:list Related to pixi list enhancement New features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add license column to pixi list

4 participants