METADATA 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. Metadata-Version: 2.0
  2. Name: queuelib
  3. Version: 1.4.2
  4. Summary: Collection of persistent (disk-based) queues
  5. Home-page: https://github.com/scrapy/queuelib
  6. Author: Scrapy project
  7. Author-email: info@scrapy.org
  8. License: BSD
  9. Platform: Any
  10. Classifier: Development Status :: 5 - Production/Stable
  11. Classifier: License :: OSI Approved :: BSD License
  12. Classifier: Operating System :: OS Independent
  13. Classifier: Programming Language :: Python
  14. Classifier: Programming Language :: Python :: 2
  15. Classifier: Programming Language :: Python :: 2.7
  16. Classifier: Programming Language :: Python :: 3
  17. Classifier: Programming Language :: Python :: 3.3
  18. Classifier: Programming Language :: Python :: 3.4
  19. Classifier: Programming Language :: Python :: Implementation :: CPython
  20. Classifier: Programming Language :: Python :: Implementation :: PyPy
  21. ========
  22. queuelib
  23. ========
  24. .. image:: https://secure.travis-ci.org/scrapy/queuelib.png?branch=master
  25. :target: http://travis-ci.org/scrapy/queuelib
  26. .. image:: https://img.shields.io/codecov/c/github/scrapy/queuelib/master.svg
  27. :target: http://codecov.io/github/scrapy/queuelib?branch=master
  28. :alt: Coverage report
  29. Queuelib is a collection of persistent (disk-based) queues for Python.
  30. Queuelib goals are speed and simplicity. It was originally part of the `Scrapy
  31. framework`_ and stripped out on its own library.
  32. Requirements
  33. ============
  34. * Python 2.7 or Python 3.3
  35. * no external library requirements
  36. Installation
  37. ============
  38. You can install Queuelib either via the Python Package Index (PyPI) or from
  39. source.
  40. To install using pip::
  41. $ pip install queuelib
  42. To install using easy_install::
  43. $ easy_install queuelib
  44. If you have downloaded a source tarball you can install it by running the
  45. following (as root)::
  46. # python setup.py install
  47. FIFO/LIFO disk queues
  48. =====================
  49. Queuelib provides FIFO and LIFO queue implementations.
  50. Here is an example usage of the FIFO queue::
  51. >>> from queuelib import FifoDiskQueue
  52. >>> q = FifoDiskQueue("queuefile")
  53. >>> q.push(b'a')
  54. >>> q.push(b'b')
  55. >>> q.push(b'c')
  56. >>> q.pop()
  57. b'a'
  58. >>> q.close()
  59. >>> q = FifoDiskQueue("queuefile")
  60. >>> q.pop()
  61. b'b'
  62. >>> q.pop()
  63. b'c'
  64. >>> q.pop()
  65. >>>
  66. The LIFO queue is identical (API-wise), but importing ``LifoDiskQueue``
  67. instead.
  68. PriorityQueue
  69. =============
  70. A discrete-priority queue implemented by combining multiple FIFO/LIFO queues
  71. (one per priority).
  72. First, select the type of queue to be used per priority (FIFO or LIFO)::
  73. >>> from queuelib import FifoDiskQueue
  74. >>> qfactory = lambda priority: FifoDiskQueue('queue-dir-%s' % priority)
  75. Then instantiate the Priority Queue with it::
  76. >>> from queuelib import PriorityQueue
  77. >>> pq = PriorityQueue(qfactory)
  78. And use it::
  79. >>> pq.push(b'a', 3)
  80. >>> pq.push(b'b', 1)
  81. >>> pq.push(b'c', 2)
  82. >>> pq.push(b'd', 2)
  83. >>> pq.pop()
  84. b'b'
  85. >>> pq.pop()
  86. b'c'
  87. >>> pq.pop()
  88. b'd'
  89. >>> pq.pop()
  90. b'a'
  91. Mailing list
  92. ============
  93. Use the `scrapy-users`_ mailing list for questions about Queuelib.
  94. Bug tracker
  95. ===========
  96. If you have any suggestions, bug reports or annoyances please report them to
  97. our issue tracker at: http://github.com/scrapy/queuelib/issues/
  98. Contributing
  99. ============
  100. Development of Queuelib happens at GitHub: http://github.com/scrapy/queuelib
  101. You are highly encouraged to participate in the development. If you don't like
  102. GitHub (for some reason) you're welcome to send regular patches.
  103. All changes require tests to be merged.
  104. Tests
  105. =====
  106. Tests are located in `queuelib/tests` directory. They can be run using
  107. `nosetests`_ with the following command::
  108. nosetests
  109. The output should be something like the following::
  110. $ nosetests
  111. .............................................................................
  112. ----------------------------------------------------------------------
  113. Ran 77 tests in 0.145s
  114. OK
  115. License
  116. =======
  117. This software is licensed under the BSD License. See the LICENSE file in the
  118. top distribution directory for the full license text.
  119. Versioning
  120. ==========
  121. This software follows `Semantic Versioning`_
  122. .. _Scrapy framework: http://scrapy.org
  123. .. _scrapy-users: http://groups.google.com/group/scrapy-users
  124. .. _Semantic Versioning: http://semver.org/
  125. .. _nosetests: https://nose.readthedocs.org/en/latest/