skip to navigation
skip to content

Not Logged In

techies 0.1.0

Opinionated Python toolbox

Latest Version: 0.1.4

Opinionated Python toolbox

List of Tools

  1. Redis backed techies.landmines.Queue, (almost) Python standard Queue compatible, the main difference is that it's semi-persisted in Redis.
  2. Redis backed techies.landmines.UniQueue, a Queue implementation that keeps only distinct items.

Prerequisites

  • Redis server

Installation

$ pip install techies
$ pip install techies --upgrade  # to update

Usage

Queue

from techies.landmines import Queue

q = Queue(key='demo_q', host='localhost', port=6379, db=0)

# put, or enqueue
print(q.put('lol'))  # 1L
print(q.put('dota'))  # 2L
print(q.put('skyrim'))  # 3L
print(q.put('dota'))  # 4L
# Queue.put returns the queue size at that moment

# Check size of the queue, two ways
print(q.qsize())  # 4
print(len(q))  # 4

# get, or dequeue
print(q.get())  # 'lol'
print(q.get())  # 'dota'
print(q.get())  # 'skyrim'
print(q.get())  # 'dota'
print(q.get())  # NoneType

# clear the queue
q.clear()

UniQueue

from techies.landmines import UniQueue

q = UniQueue(key='demo_q', host='localhost', port=6379, db=0)

# put, or enqueue
print(q.put('lol'))  # 1
print(q.put('dota'))  # 1
print(q.put('skyrim'))  # 1
print(q.put('dota'))  # 0
# UniQueue.put returns 1 on success, 0 otherwise; such as duplicated item

# Check size of the unique queue, two ways
print(q.qsize())  # 3
print(len(q))  # 3

# get, or dequeue
print(q.get())  # 'lol'
print(q.get())  # 'dota'
print(q.get())  # 'skyrim'
print(q.get())  # NoneType
print(q.get())  # NoneType

# clear the queue
q.clear()

Test (Unit Tests)

To run unit tests locally, make sure that you have Redis server installed and running

$ pip install -r requirements.txt
$ pip install -r test_requirements.txt
$ nosetests --with-coverage --cover-package=techies

License

The MIT License (MIT). See the full LICENSE.

Changelog

0.1.0 (2014-01-16)

  • Initial release with Redis backed Queue and UniQueue
 
File Type Py Version Uploaded on Size
techies-0.1.0.tar.gz (md5) Source 2014-01-16 4KB
  • Downloads (All Versions):
  • 15 downloads in the last day
  • 113 downloads in the last week
  • 459 downloads in the last month
  • Author: Runzhou Li (Leo)
  • Home Page: https://github.com/woozyking/techies
  • License:
    Copyright (c) 2014 Runzhou Li
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.
  • Categories
  • Package Index Owner: woozyking
  • DOAP record: techies-0.1.0.xml