METADATA 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. Metadata-Version: 2.1
  2. Name: sortedcontainers
  3. Version: 2.4.0
  4. Summary: Sorted Containers -- Sorted List, Sorted Dict, Sorted Set
  5. Home-page: http://www.grantjenks.com/docs/sortedcontainers/
  6. Author: Grant Jenks
  7. Author-email: contact@grantjenks.com
  8. License: Apache 2.0
  9. Platform: UNKNOWN
  10. Classifier: Development Status :: 5 - Production/Stable
  11. Classifier: Intended Audience :: Developers
  12. Classifier: License :: OSI Approved :: Apache Software License
  13. Classifier: Natural Language :: English
  14. Classifier: Programming Language :: Python
  15. Classifier: Programming Language :: Python :: 2
  16. Classifier: Programming Language :: Python :: 2.7
  17. Classifier: Programming Language :: Python :: 3
  18. Classifier: Programming Language :: Python :: 3.2
  19. Classifier: Programming Language :: Python :: 3.3
  20. Classifier: Programming Language :: Python :: 3.4
  21. Classifier: Programming Language :: Python :: 3.5
  22. Classifier: Programming Language :: Python :: 3.6
  23. Classifier: Programming Language :: Python :: 3.7
  24. Classifier: Programming Language :: Python :: Implementation :: CPython
  25. Classifier: Programming Language :: Python :: Implementation :: PyPy
  26. Python Sorted Containers
  27. ========================
  28. `Sorted Containers`_ is an Apache2 licensed `sorted collections library`_,
  29. written in pure-Python, and fast as C-extensions.
  30. Python's standard library is great until you need a sorted collections
  31. type. Many will attest that you can get really far without one, but the moment
  32. you **really need** a sorted list, sorted dict, or sorted set, you're faced
  33. with a dozen different implementations, most using C-extensions without great
  34. documentation and benchmarking.
  35. In Python, we can do better. And we can do it in pure-Python!
  36. .. code-block:: python
  37. >>> from sortedcontainers import SortedList
  38. >>> sl = SortedList(['e', 'a', 'c', 'd', 'b'])
  39. >>> sl
  40. SortedList(['a', 'b', 'c', 'd', 'e'])
  41. >>> sl *= 10_000_000
  42. >>> sl.count('c')
  43. 10000000
  44. >>> sl[-3:]
  45. ['e', 'e', 'e']
  46. >>> from sortedcontainers import SortedDict
  47. >>> sd = SortedDict({'c': 3, 'a': 1, 'b': 2})
  48. >>> sd
  49. SortedDict({'a': 1, 'b': 2, 'c': 3})
  50. >>> sd.popitem(index=-1)
  51. ('c', 3)
  52. >>> from sortedcontainers import SortedSet
  53. >>> ss = SortedSet('abracadabra')
  54. >>> ss
  55. SortedSet(['a', 'b', 'c', 'd', 'r'])
  56. >>> ss.bisect_left('c')
  57. 2
  58. All of the operations shown above run in faster than linear time. The above
  59. demo also takes nearly a gigabyte of memory to run. When the sorted list is
  60. multiplied by ten million, it stores ten million references to each of "a"
  61. through "e". Each reference requires eight bytes in the sorted
  62. container. That's pretty hard to beat as it's the cost of a pointer to each
  63. object. It's also 66% less overhead than a typical binary tree implementation
  64. (e.g. Red-Black Tree, AVL-Tree, AA-Tree, Splay-Tree, Treap, etc.) for which
  65. every node must also store two pointers to children nodes.
  66. `Sorted Containers`_ takes all of the work out of Python sorted collections -
  67. making your deployment and use of Python easy. There's no need to install a C
  68. compiler or pre-build and distribute custom extensions. Performance is a
  69. feature and testing has 100% coverage with unit tests and hours of stress.
  70. .. _`Sorted Containers`: http://www.grantjenks.com/docs/sortedcontainers/
  71. .. _`sorted collections library`: http://www.grantjenks.com/docs/sortedcontainers/
  72. Testimonials
  73. ------------
  74. **Alex Martelli**, `Fellow of the Python Software Foundation`_
  75. "Good stuff! ... I like the `simple, effective implementation`_ idea of
  76. splitting the sorted containers into smaller "fragments" to avoid the O(N)
  77. insertion costs."
  78. **Jeff Knupp**, `author of Writing Idiomatic Python and Python Trainer`_
  79. "That last part, "fast as C-extensions," was difficult to believe. I would need
  80. some sort of `Performance Comparison`_ to be convinced this is true. The author
  81. includes this in the docs. It is."
  82. **Kevin Samuel**, `Python and Django Trainer`_
  83. I'm quite amazed, not just by the code quality (it's incredibly readable and
  84. has more comment than code, wow), but the actual amount of work you put at
  85. stuff that is *not* code: documentation, benchmarking, implementation
  86. explanations. Even the git log is clean and the unit tests run out of the box
  87. on Python 2 and 3.
  88. **Mark Summerfield**, a short plea for `Python Sorted Collections`_
  89. Python's "batteries included" standard library seems to have a battery
  90. missing. And the argument that "we never had it before" has worn thin. It is
  91. time that Python offered a full range of collection classes out of the box,
  92. including sorted ones.
  93. `Sorted Containers`_ is used in popular open source projects such as:
  94. `Zipline`_, an algorithmic trading library from Quantopian; `Angr`_, a binary
  95. analysis platform from UC Santa Barbara; `Trio`_, an async I/O library; and
  96. `Dask Distributed`_, a distributed computation library supported by Continuum
  97. Analytics.
  98. .. _`Fellow of the Python Software Foundation`: https://en.wikipedia.org/wiki/Alex_Martelli
  99. .. _`simple, effective implementation`: http://www.grantjenks.com/docs/sortedcontainers/implementation.html
  100. .. _`author of Writing Idiomatic Python and Python Trainer`: https://jeffknupp.com/
  101. .. _`Python and Django Trainer`: https://www.elephorm.com/formateur/kevin-samuel
  102. .. _`Python Sorted Collections`: http://www.qtrac.eu/pysorted.html
  103. .. _`Zipline`: https://github.com/quantopian/zipline
  104. .. _`Angr`: https://github.com/angr/angr
  105. .. _`Trio`: https://github.com/python-trio/trio
  106. .. _`Dask Distributed`: https://github.com/dask/distributed
  107. Features
  108. --------
  109. - Pure-Python
  110. - Fully documented
  111. - Benchmark comparison (alternatives, runtimes, load-factors)
  112. - 100% test coverage
  113. - Hours of stress testing
  114. - Performance matters (often faster than C implementations)
  115. - Compatible API (nearly identical to older blist and bintrees modules)
  116. - Feature-rich (e.g. get the five largest keys in a sorted dict: d.keys()[-5:])
  117. - Pragmatic design (e.g. SortedSet is a Python set with a SortedList index)
  118. - Developed on Python 3.7
  119. - Tested on CPython 2.7, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 and PyPy, PyPy3
  120. .. image:: https://api.travis-ci.org/grantjenks/python-sortedcontainers.svg?branch=master
  121. :target: http://www.grantjenks.com/docs/sortedcontainers/
  122. .. image:: https://ci.appveyor.com/api/projects/status/github/grantjenks/python-sortedcontainers?branch=master&svg=true
  123. :target: http://www.grantjenks.com/docs/sortedcontainers/
  124. Quickstart
  125. ----------
  126. Installing `Sorted Containers`_ is simple with `pip
  127. <https://pypi.org/project/pip/>`_::
  128. $ pip install sortedcontainers
  129. You can access documentation in the interpreter with Python's built-in `help`
  130. function. The `help` works on modules, classes and methods in `Sorted
  131. Containers`_.
  132. .. code-block:: python
  133. >>> import sortedcontainers
  134. >>> help(sortedcontainers)
  135. >>> from sortedcontainers import SortedDict
  136. >>> help(SortedDict)
  137. >>> help(SortedDict.popitem)
  138. Documentation
  139. -------------
  140. Complete documentation for `Sorted Containers`_ is available at
  141. http://www.grantjenks.com/docs/sortedcontainers/
  142. User Guide
  143. ..........
  144. The user guide provides an introduction to `Sorted Containers`_ and extensive
  145. performance comparisons and analysis.
  146. - `Introduction`_
  147. - `Performance Comparison`_
  148. - `Load Factor Performance Comparison`_
  149. - `Runtime Performance Comparison`_
  150. - `Simulated Workload Performance Comparison`_
  151. - `Performance at Scale`_
  152. .. _`Introduction`: http://www.grantjenks.com/docs/sortedcontainers/introduction.html
  153. .. _`Performance Comparison`: http://www.grantjenks.com/docs/sortedcontainers/performance.html
  154. .. _`Load Factor Performance Comparison`: http://www.grantjenks.com/docs/sortedcontainers/performance-load.html
  155. .. _`Runtime Performance Comparison`: http://www.grantjenks.com/docs/sortedcontainers/performance-runtime.html
  156. .. _`Simulated Workload Performance Comparison`: http://www.grantjenks.com/docs/sortedcontainers/performance-workload.html
  157. .. _`Performance at Scale`: http://www.grantjenks.com/docs/sortedcontainers/performance-scale.html
  158. Community Guide
  159. ...............
  160. The community guide provides information on the development of `Sorted
  161. Containers`_ along with support, implementation, and history details.
  162. - `Development and Support`_
  163. - `Implementation Details`_
  164. - `Release History`_
  165. .. _`Development and Support`: http://www.grantjenks.com/docs/sortedcontainers/development.html
  166. .. _`Implementation Details`: http://www.grantjenks.com/docs/sortedcontainers/implementation.html
  167. .. _`Release History`: http://www.grantjenks.com/docs/sortedcontainers/history.html
  168. API Documentation
  169. .................
  170. The API documentation provides information on specific functions, classes, and
  171. modules in the `Sorted Containers`_ package.
  172. - `Sorted List`_
  173. - `Sorted Dict`_
  174. - `Sorted Set`_
  175. .. _`Sorted List`: http://www.grantjenks.com/docs/sortedcontainers/sortedlist.html
  176. .. _`Sorted Dict`: http://www.grantjenks.com/docs/sortedcontainers/sorteddict.html
  177. .. _`Sorted Set`: http://www.grantjenks.com/docs/sortedcontainers/sortedset.html
  178. Talks
  179. -----
  180. - `Python Sorted Collections | PyCon 2016 Talk`_
  181. - `SF Python Holiday Party 2015 Lightning Talk`_
  182. - `DjangoCon 2015 Lightning Talk`_
  183. .. _`Python Sorted Collections | PyCon 2016 Talk`: http://www.grantjenks.com/docs/sortedcontainers/pycon-2016-talk.html
  184. .. _`SF Python Holiday Party 2015 Lightning Talk`: http://www.grantjenks.com/docs/sortedcontainers/sf-python-2015-lightning-talk.html
  185. .. _`DjangoCon 2015 Lightning Talk`: http://www.grantjenks.com/docs/sortedcontainers/djangocon-2015-lightning-talk.html
  186. Resources
  187. ---------
  188. - `Sorted Containers Documentation`_
  189. - `Sorted Containers at PyPI`_
  190. - `Sorted Containers at Github`_
  191. - `Sorted Containers Issue Tracker`_
  192. .. _`Sorted Containers Documentation`: http://www.grantjenks.com/docs/sortedcontainers/
  193. .. _`Sorted Containers at PyPI`: https://pypi.org/project/sortedcontainers/
  194. .. _`Sorted Containers at Github`: https://github.com/grantjenks/python-sortedcontainers
  195. .. _`Sorted Containers Issue Tracker`: https://github.com/grantjenks/python-sortedcontainers/issues
  196. Sorted Containers License
  197. -------------------------
  198. Copyright 2014-2019 Grant Jenks
  199. Licensed under the Apache License, Version 2.0 (the "License");
  200. you may not use this file except in compliance with the License.
  201. You may obtain a copy of the License at
  202. http://www.apache.org/licenses/LICENSE-2.0
  203. Unless required by applicable law or agreed to in writing, software
  204. distributed under the License is distributed on an "AS IS" BASIS,
  205. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  206. See the License for the specific language governing permissions and
  207. limitations under the License.