Skip to main content

Keysort: Sorting Lists of Dictionaries

Keysort is small utility for sorting lists of dictionaries by dictionary key.

https://travis-ci.org/nkantar/Keysort.svg?branch=master https://ci.appveyor.com/api/projects/status/74nt0nnafahsntca/branch/master?svg=true https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg

Examples

>>> from keysort import keysort
>>> my_list = [{'code': 'beta',    'number': 3},
               {'code': 'delta',   'number': 2},
               {'code': 'alpha',   'number': 0},
               {'code': 'beta',    'number': 2},
               {'code': 'charlie', 'number': 1}]
>>> keysort(my_list, ['code', 'number'])
[{'code': 'alpha',   'number': 0},
 {'code': 'beta',    'number': 2},
 {'code': 'beta',    'number': 3},
 {'code': 'charlie', 'number': 1},
 {'code': 'delta',   'number': 2}]
>>> keysort(my_list, ['number', 'code'])
[{'code': 'alpha',   'number': 0},
 {'code': 'charlie', 'number': 1},
 {'code': 'beta',    'number': 2},
 {'code': 'delta',   'number': 2},
 {'code': 'beta',    'number': 3}]

Install

pip install keysort

Contributing

Contributions of all sorts are welcome, be they bug reports, patches, or even just feedback. Creating a new issue or pull request is probably the best way to get started.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Metadata

Release files for Keysort 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Keysort 0.1.3
File Size Uploaded
Keysort-0.1.3.tar.gz 1.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Keysort 0.1.3
File Interpreter ABI Platform
Keysort-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 5.0 kB

Release files / Keysort-0.1.3.tar.gz

Download URL Keysort-0.1.3.tar.gz
Size 1.8 kB
Tags Source
SHA-256 checksum
How to use checksums
185c06aeea547dee20e99871855ade106a0e819f89d75eb4ac6a62eebda32000
BLAKE2b-256 checksum
How to use checksums
174f6a4e0d30cedc2524e141daa4802b6aa1a16553c0228f9ee44c29fdb6955a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / Keysort-0.1.3-py3-none-any.whl

Download URL Keysort-0.1.3-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
474fd5b8dda1b4852b993445dcb86e082933b3c31bd2b45387d643ae7aa6428a
BLAKE2b-256 checksum
How to use checksums
f5494377432c16cb657ab123affa2ccf1bf41b80f194158576090bdd895e473c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page