{ "info": { "author": "Daniel Bradburn", "author_email": "moagstar@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Programming Language :: Python" ], "description": ".. image:: https://travis-ci.org/moagstar/xsorted.svg?branch=master\n :target: https://travis-ci.org/moagstar/xsorted\n \n.. image:: https://coveralls.io/repos/github/moagstar/xsorted/badge.svg?branch=master\n :target: https://coveralls.io/github/moagstar/xsorted?branch=master\n\n\n=======\nxsorted\n=======\n\nLike ``sorted`` but using external sorting so that large data sets can be sorted, for example:\n\n>>> from random import random\n>>> from six.moves import xrange\n>>> from xsorted import xsorted\n>>> nums = (random() for _ in xrange(pow(10, 7)))\n>>> for x in xsorted(nums): pass\n\nThe only restriction is that the items must be pickleable (or you can provide your own serializer for externalizing\npartitions of items).\n\nMotivation\n----------\n\nIt is sometimes necessary to sort a dataset without having to load the entire set into memory. For example, if you\nwant to group a very large csv file by one of it's columns. There are several ways in which this can be achieved, a\ncommon solution is to use the unix command ``sort``. However unix ``sort`` does not offer the flexibility of the python\ncsv module. ``xsorted`` attempts to generalize external sorting of any python iterable in a similar way in which\n``sorted`` generalises the sorting of any iterable.\n\nInstallation\n------------\n\n``$ pip install xsorted``\n\nUsage\n-----\n\nJust like ``sorted``...\n\n>>> from xsorted import xsorted\n>>> ''.join(xsorted('qwertyuiopasdfghjklzxcvbnm'))\n'abcdefghijklmnopqrstuvwxyz'\n\nWith ``reverse``...\n\n>>> ''.join(xsorted('qwertyuiopasdfghjklzxcvbnm', reverse=True))\n'zyxwvutsrqponmlkjihgfedcba'\n\nAnd a custom ``key``...\n\n>>> list(xsorted(('qwerty', 'uiop', 'asdfg', 'hjkl', 'zxcv', 'bnm'), key=lambda x: x[1]))\n['uiop', 'hjkl', 'bnm', 'asdfg', 'qwerty', 'zxcv']\n\nThe implementation details of ``xsorted`` can be customized using the factory ``xsorter`` (in order to provide\nthe same interface as ``sorted`` the partition_size is treated as an implementation detail):\n\n>>> from xsorted import xsorter\n>>> xsorted_custom = xsorter(partition_size=4)\n>>> ''.join(xsorted_custom('qwertyuiopasdfghjklzxcvbnm'))\n'abcdefghijklmnopqrstuvwxyz'", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/moagstar/xsorted", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "xsorted", "package_url": "https://pypi.org/project/xsorted/", "platform": "", "project_url": "https://pypi.org/project/xsorted/", "project_urls": { "Homepage": "https://github.com/moagstar/xsorted" }, "release_url": "https://pypi.org/project/xsorted/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "Like sorted but using external sorting so that large data sets can be sorted.", "version": "0.0.4" }, "last_serial": 2639550, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "96cfc6c3e3c89993eea11899df9ee249", "sha256": "0cc78836c5df4acc224a018dd64921a9b27fcf3ddd8e9aecb58ac3bbada79e44" }, "downloads": -1, "filename": "xsorted-0.0.2.tar.gz", "has_sig": false, "md5_digest": "96cfc6c3e3c89993eea11899df9ee249", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 117270, "upload_time": "2017-02-13T21:30:57", "url": "https://files.pythonhosted.org/packages/63/21/b6cbc400f7b0d0c408fd9e3c977844651907facb194118509e3712c3cd67/xsorted-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "9573f404c9efaf87a6639d0fea05e163", "sha256": "25efe35378b02a63515a37f0e172d8a1737502aa6a9a2ab3d05e8a5884980eba" }, "downloads": -1, "filename": "xsorted-0.0.3.tar.gz", "has_sig": false, "md5_digest": "9573f404c9efaf87a6639d0fea05e163", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 119058, "upload_time": "2017-02-13T21:48:41", "url": "https://files.pythonhosted.org/packages/0e/59/f529b6bbcded263c2298cac1c08f8e215ef821b63a953d9e1c7a9b1f1155/xsorted-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "3779eb7a5ca80fbb622aecf9f4fa9c6d", "sha256": "874971cb334ead12475a8b3879f3b32ac556baaae1ccffa112d9d3206f8171d9" }, "downloads": -1, "filename": "xsorted-0.0.4.tar.gz", "has_sig": false, "md5_digest": "3779eb7a5ca80fbb622aecf9f4fa9c6d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 119887, "upload_time": "2017-02-13T21:51:29", "url": "https://files.pythonhosted.org/packages/f0/f5/e6b846f9e4b58ee09921fc47c04604d1716712712d48010f437ff03b8b30/xsorted-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3779eb7a5ca80fbb622aecf9f4fa9c6d", "sha256": "874971cb334ead12475a8b3879f3b32ac556baaae1ccffa112d9d3206f8171d9" }, "downloads": -1, "filename": "xsorted-0.0.4.tar.gz", "has_sig": false, "md5_digest": "3779eb7a5ca80fbb622aecf9f4fa9c6d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 119887, "upload_time": "2017-02-13T21:51:29", "url": "https://files.pythonhosted.org/packages/f0/f5/e6b846f9e4b58ee09921fc47c04604d1716712712d48010f437ff03b8b30/xsorted-0.0.4.tar.gz" } ] }