Skip to content

Commit

Permalink
Moving the README to rst format and adding it to setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dushr committed Feb 13, 2015
1 parent 0fa8239 commit 69b2e1d
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 72 deletions.
70 changes: 0 additions & 70 deletions README.md

This file was deleted.

73 changes: 73 additions & 0 deletions README.rst
@@ -0,0 +1,73 @@
pyla
====

.. image:: https://travis-ci.org/dushyant88/pyla.png

.. image:: https://coveralls.io/repos/dushyant88/pyla/badge.svg?branch=master
:target: https://coveralls.io/r/dushyant88/pyla?branch=master

pyla is a redis based storage system which can filter entries based on item's
attributes.

In it's current version it stores the information of the entry in a sorted set
with all information present in the key.

Why pyla?
---------

Say you have certain jobs that you want to schedule and every job has certain
attributes associated to it.

.. code-block:: python
from pyla import entries
from pyla import fields
class Job(entries.Entry):
id = fields.BaseField(primary=True)
type = fields.BaseField(index=True)
assigned_to = fields.BaseField(index=True)
info = fields.BaseField(index=False)
j = Job(id=1, type='create', assigned_to='dush', info='testing')
j.save()
on calling save on that particular entry you will have following sorted
sets available in redis

.. code-block::
job
job:type:create
job:assigned_to:dush
Then you have the following awesome filtering abilities:

.. code-block:: python
# Get all the jobs
Job.objects.all()
# Get jobs with type create
Job.objects.filter(type='create')
# Get jobs with either create or delete type
Job.objects.filter(type=['create', 'delete'])
# Get jobs which are assigened to dush
Job.objects.filter(assigned_to='dush')
# Get jobs which are assigened to dush or spam
Job.objects.filter(assigned_to=['dush', 'spam'])
# Get jobs which are assigened to dush and are of type create
Job.objects.filter(assigned_to='dush', type='create')
# Get jobs which are assigened to dush and are of type create or delete
Job.objects.filter(assigned_to='dush', type=['create','delete'])
# Get jobs which are assigened to dush or spam and are of type create or delete
Job.objects.filter(assigned_to=['dush', 'spam'], type=['create','delete'])
You can have any number of filters over the fields which were set to index.
Obviously, the more indexes you have the slower your writes become.
13 changes: 11 additions & 2 deletions setup.py
@@ -1,8 +1,13 @@
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from codecs import open # To use a consistent encoding
from os import path

import sys
here = path.abspath(path.dirname(__file__))

# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()

install_requires = [
'redis==2.7.6',
Expand All @@ -13,8 +18,12 @@
setup(
name='pyla',
url='http://github.com/dushyant88/pyla',
version='0.1.0b',
version='0.1.0b0',
description="pyla is a redis based storage system",
long_description=long_description,
packages=find_packages(),
install_requires=install_requires,
dependency_links=dependency_links,

author="Dushyant Rijhwani"
)

0 comments on commit 69b2e1d

Please sign in to comment.