Skip to main content

Collection of persistent (disk-based) queues

Project description

Queuelib is a collection of persistent (disk-based) queues for Python.

Queuelib goals are speed and simplicity. It was originally part of the Scrapy framework and stripped out on its own library.


  • Python 2.6
  • no external library requirements



You can install Queuelib either via the Python Package Index (PyPI) or from source.

To install using pip:

$ pip install queuelib

To install using easy_install:

$ easy_install queuelib

If you have downloaded a source tarball you can install it by running the following (as root):

# python install

FIFO/LIFO disk queues

Queuelib provides FIFO and LIFO queue implementations.

Here is an example usage of the FIFO queue:

>>> from queuelib import FifoDiskQueue
>>> q = FifoDiskQueue("queuefile")
>>> q.push('a')
>>> q.push('b')
>>> q.push('c')
>>> q.pop()
>>> q.close()
>>> q = FifoDiskQueue("queuefile")
>>> q.pop()
>>> q.pop()
>>> q.pop()

The LIFO queue is identical (API-wise), but importing LifoDiskQueue instead.


A discrete-priority queue implemented by combining multiple FIFO/LIFO queues (one per priority).

First, select the type of QUEUE (FIFO or LIFO):

>>> from queuelib import FifoDiskQueue
>>> q = FifoDiskQueue("somedir")

Then instantiate the Priority Queue with it:

>>> from queuelib import PriorityQueue
>>> pq = PriorityQueue(q)

And use it:

>>> pq.push('a', 3)
>>> pq.push('b', 1)
>>> pq.push('c', 2)
>>> pq.push('d', 2)
>>> pq.pop()
>>> pq.pop()
>>> pq.pop()
>>> pq.pop()

Mailing list

Use the scrapy-users mailing list for questions about Queuelib.

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to our issue tracker at:


Development of Queuelib happens at GitHub:

You are highly encouraged to participate in the development. If you don’t like GitHub (for some reason) you’re welcome to send regular patches.

All changes require tests to be merged.


Tests are located in queuelib/tests directory. They can be run using nosetests with the following command:


The output should be something like the following:

$ nosetests
Ran 77 tests in 0.145s



This software is licensed under the BSD License. See the LICENSE file in the top distribution directory for the full license text.


This software follows Semantic Versioning

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for queuelib, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size queuelib-1.1.tar.gz (6.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page