Provide an easy way to store python objects in Redis, without losing the power and the control of the Redis API
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
limpyd
tests
.gitignore
.travis.yml
AUTHORS.rst
CHANGELOG.rst
LICENSE
MANIFEST.in
README.rst
requirements.txt
run_tests.py
setup.cfg
setup.py

README.rst

PyPI Version Build Status Doc Status

Limpyd

Limpyd provides an easy way to store objects in Redis, without losing the power and the control of the Redis API, in a limpid way, with just as abstraction as needed.

Featuring:

  • Don't care about keys, limpyd do it for you
  • Retrieve objects from some of their attributes
  • Retrieve objects collection
  • CRUD abstraction
  • Powerful indexing and filtering
  • Keep the power of all the Redis data types in your own code

Example of configuration:

from limpyd import model

main_database = model.RedisDatabase(
    host="localhost",
    port=6379,
    db=0
)

class Bike(model.RedisModel):

    database = main_database

    name = model.InstanceHashField(indexable=True, unique=True)
    color = model.InstanceHashField()
    wheels = model.StringField(default=2)

So you can use it like this:

>>> mountainbike = Bike(name="mountainbike")
>>> mountainbike.wheels.get()
'2'
>>> mountainbike.wheels.incr()
>>> mountainbike.wheels.get()
'3'
>>> mountainbike.name.set("tricycle")
>>> tricycle = Bike.collection(name="tricycle")[0]
>>> tricycle.wheels.get()
'3'
>>> tricycle.hmset(color="blue")
True
>>> tricycle.hmget('color')
['blue']
>>> tricycle.hmget('color', 'name')
['blue', 'tricycle']
>>> tricycle.color.hget()
'blue'
>>> tricycle.color.hset('yellow')
True
>>> tricycle.hmget('color')
['yellow']

Install

Python versions 2.7 and 3.4 to 3.6 are supported (CPython and PyPy).

Redis-py versions >= 2.9.1 and < 2.11 are supported.

pip install redis-limpyd

Note: Version 1.0, 1.0.1 and 1.1 where broken so removed from PyPI

Documentation

See https://redis-limpyd.readthedocs.io/ for a full documentation

Changelog

See CHANGELOG.rst

Maintainers

Extensions