Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install queuelib

How to install queuelib

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install queuelib
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
1.0 Available View build log
Linux (32-bit)
1.0 Available View build log
Linux (64-bit)
1.0 Available View build log
 
License
BSD
Depended by
Lastest release
version 1.0 on May 19th, 2013

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.

Requirements

  • Python 2.6
  • no external library requirements

Installation

Installation

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 setup.py 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()
'c'
>>> q.close()
>>> q = FifoDiskQueue("queuefile")
>>> q.pop()
'b'
>>> q.pop()
'a'
>>> q.pop()
>>>

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

PriorityQueue

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()
'b'
>>> pq.pop()
'c'
>>> pq.pop()
'd'
>>> pq.pop()
'a'

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: http://github.com/scrapy/queuelib/issues/

Contributing

Development of Queuelib happens at GitHub: http://github.com/scrapy/queuelib

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

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

nosetests

The output should be something like the following:

$ nosetests
.............................................................................
----------------------------------------------------------------------
Ran 77 tests in 0.145s

OK

License

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

Versioning

This software follows Semantic Versioning

Subscribe to package updates

Last updated May 19th, 2013

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.