From c6b5f3b3f7b16e04f59958232c4156df6e60a417 Mon Sep 17 00:00:00 2001 From: Dmitry Balabka Date: Mon, 12 Jun 2023 06:03:10 +0300 Subject: [PATCH] Fix sorting case sensitivity in list command (#1973) (#1974) --- news/1973.bugfix.md | 1 + src/pdm/cli/commands/list.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 news/1973.bugfix.md diff --git a/news/1973.bugfix.md b/news/1973.bugfix.md new file mode 100644 index 0000000000..7d3d5485d5 --- /dev/null +++ b/news/1973.bugfix.md @@ -0,0 +1 @@ +Case-insensitive sorting in `pdm list`. diff --git a/src/pdm/cli/commands/list.py b/src/pdm/cli/commands/list.py index 19fbef8c35..27f428936e 100644 --- a/src/pdm/cli/commands/list.py +++ b/src/pdm/cli/commands/list.py @@ -234,7 +234,7 @@ def _group_of(name: str) -> set[str]: keys = parse_comma_separated_string(options.sort) if not all(key in Listable.KEYS for key in keys): raise PdmUsageError(f"--sort key must be one of: {','.join(Listable.KEYS)}") - records.sort(key=lambda d: tuple(d[key] for key in keys)) + records.sort(key=lambda d: tuple(d[key].casefold() for key in keys)) # Write CSV if options.csv: