{"id":23021,"library":"zope-sequencesort","title":"Zope Sequence Sort","description":"Provides support for sorting sequences by one or more criteria, including ascending/descending order and case-insensitive comparisons. Current version: 6.0 (requires Python >=3.9). Maintained as part of the Zope Foundation, releases are stable but infrequent.","status":"active","version":"6.0","language":"python","source_language":"en","source_url":"https://github.com/zopefoundation/zope.sequencesort","tags":["zope","sorting","sequence","utility"],"install":[{"cmd":"pip install zope-sequencesort","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"sort","correct":"from zope.sequencesort import sort"}],"quickstart":{"code":"from zope.sequencesort import sort\n\n# Simple list of dictionaries\nitems = [{'name': 'Charlie'}, {'name': 'Alice'}, {'name': 'Bob'}]\n# Sort by 'name' ascending, case-insensitive\nsorted_items = sort(items, (('name', False, False),))\nprint([item['name'] for item in sorted_items])\n# Output: ['Alice', 'Bob', 'Charlie']\n","lang":"python","description":"Sort a list of dicts by a key, with options for descending and case-insensitive."},"warnings":[{"fix":"Ensure you pass a tuple of tuples, e.g., (('name', False, False),). Do not pass a single tuple without the outer parentheses.","message":"The sort function expects a sequence and a tuple of sort keys. Each sort key is a tuple of (attr, reverse, case_insensitive). The default for both reverse and case_insensitive is False, but you must pass a tuple for each key.","severity":"gotcha","affected_versions":"all"},{"fix":"Pre-process your data to flatten nested structures before sorting, or use a lambda with Python's sorted().","message":"The sort key's first element is an attribute name (string) used for getattr. It does not work for nested attributes or item access like 'key.subkey'.","severity":"gotcha","affected_versions":"all"},{"fix":"If you encounter install errors, upgrade pip and setuptools, or use a virtual environment.","message":"The package is very old and may not be compatible with Python 3.10+ if using deprecated 'distutils'. However, version 6.0 requires Python >=3.9 and should work.","severity":"gotcha","affected_versions":">=6.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install with 'pip install zope-sequencesort' and import as 'from zope.sequencesort import sort'.","cause":"Package not installed or wrong import path.","error":"ModuleNotFoundError: No module named 'zope.sequencesort'"},{"fix":"Wrap the key tuple in an extra set of parentheses: sort(items, (('name', False, False),))","cause":"Passing a single sort key tuple instead of a tuple containing that tuple.","error":"TypeError: sort() argument 2 must be tuple, not tuple"},{"fix":"Convert dicts to objects (e.g., using types.SimpleNamespace) or sort using Python's sorted() with a lambda.","cause":"Sort key uses getattr, but items are dictionaries; attribute access fails.","error":"AttributeError: 'dict' object has no attribute 'name'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}