{
"info": {
"author": "Ali-Akber Saifee",
"author_email": "ali@indydevs.org",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: OS Independent",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries :: Python Modules"
],
"description": ".. |travis-ci| image:: https://img.shields.io/travis/alisaifee/sifr/master.svg?style=flat-square\r\n :target: https://travis-ci.org/#!/alisaifee/sifr?branch=master\r\n.. |coveralls| image:: https://img.shields.io/coveralls/alisaifee/sifr/master.svg?style=flat-square\r\n :target: https://coveralls.io/r/alisaifee/sifr?branch=master\r\n.. |pypi| image:: https://img.shields.io/pypi/v/sifr.svg?style=flat-square\r\n :target: https://pypi.python.org/pypi/sifr\r\n.. |license| image:: https://img.shields.io/pypi/l/sifr.svg?style=flat-square\r\n :target: https://pypi.python.org/pypi/sifr\r\n.. |landscape| image:: https://landscape.io/github/alisaifee/sifr/master/landscape.svg?style=flat-square\r\n :target: https://landscape.io/github/alisaifee/sifr/master\r\n\r\n****\r\nsifr\r\n****\r\n\r\n\r\n ... and with the sign 0 ... any number may be written\r\n\r\n -- Fibionacci\r\n\r\n\r\n|travis-ci| |coveralls| |landscape| |pypi| |license|\r\n\r\n.. image:: http://i.imgur.com/luJUJ31.png\r\n\r\nCount things in various time based windows using in-memory, redis or riak\r\nstorage.\r\n\r\nInstallation\r\n============\r\nInstall the basic package::\r\n\r\n pip install sifr\r\n\r\nInstall **sifr** with redis dependencies::\r\n\r\n pip install 'sifr[redis]'\r\n\r\nInstall **sifr** with riak dependencies::\r\n\r\n pip install 'sifr[riak]'\r\n\r\n\r\nInstall **sifr** with sifrd service dependencies::\r\n\r\n pip install 'sifr[daemon]'\r\n\r\nExamples\r\n========\r\n\r\nUsing **sifr** with direct storage\r\n----------------------------------\r\n.. code-block:: python\r\n\r\n import datetime\r\n import redis, riak\r\n\r\n from sifr.span import Year, Month, Day, Hour, Minute, get_time_spans\r\n from sifr.storage import MemoryStorage, RedisStorage, RiakStorage\r\n\r\n redis_client = redis.Redis()\r\n redis_store = RedisStorage(redis_client)\r\n\r\n riak_client = riak.RiakClient()\r\n riak_store = RiakStorage(riak_client)\r\n\r\n memory_store = MemoryStorage()\r\n\r\n stores = [memory_store, redis_store, riak_store]\r\n\r\n now = datetime.datetime.now()\r\n user_id = 1\r\n page = \"index.html\"\r\n\r\n # construct the windows. These are the resolutions that will be tracked.\r\n spans = [\r\n span(now, [\"views\", \"user\", user_id])\r\n for span in [Year, Month, Day, Hour, Minute]\r\n ]\r\n # incr a counter for all resolutions\r\n [store.incr_multi(spans) for store in stores]\r\n\r\n # incr a unique counter\r\n [store.incr_unique_multi(spans, page) for store in stores]\r\n [store.incr_unique_multi(spans, page) for store in stores]\r\n\r\n # track the page view\r\n [store.track_multi(spans, page) for store in stores]\r\n [store.track_multi(spans, page) for store in stores]\r\n\r\n # get the counts/uniques for a single year window\r\n for store in stores:\r\n assert 1 == store.count(Year(now, [\"views\", \"user\", 1]))\r\n assert 1 == store.cardinality(Year(now, [\"views\", \"user\", 1]))\r\n assert set([\"index.html\"]) == store.uniques(Year(now, [\"views\", \"user\", 1]))\r\n\r\n\r\n # get the counts/uniques for a range\r\n start = now - datetime.timedelta(minutes=1)\r\n end = now + datetime.timedelta(minutes=1)\r\n\r\n span_range = get_time_spans(start, end, [\"views\", \"user\", 1], [Minute])\r\n for store in stores:\r\n assert [1] == [store.count(span) for span in span_range]\r\n assert [1] == [store.cardinality(span) for span in span_range]\r\n assert [set([\"index.html\"])] == [store.uniques(span) for span in span_range]\r\n\r\n\r\nUsing **sifr** via rpc\r\n----------------------\r\n\r\nsifr.yml (using a redis backend)\r\n\r\n.. code-block:: yaml\r\n\r\n storage: redis\r\n redis_url: redis://localhost:6379/1\r\n host: localhost\r\n port: 6000\r\n\r\nsifr.yml (using a riak backend)\r\n\r\n.. code-block:: yaml\r\n\r\n storage: riak\r\n riak_nodes:\r\n - host: localhost\r\n pb_port: 8087\r\n host: localhost\r\n port: 6000\r\n\r\nRun the server\r\n\r\n.. code-block:: bash\r\n\r\n sifrd msgpack_server --config=sifr.yml\r\n\r\n\r\nInteract with the server\r\n\r\n.. code-block:: python\r\n\r\n from sifr import RPCClient\r\n client = RPCCient(host='localhost', port=6000, resolutions=[\"year\", \"month\", \"day\"])\r\n client.incr(\"views:user:1\")\r\n client.incr_unique(\"views:user:1\", \"index.html\")\r\n client.incr_unique(\"views:user:1\", \"index.html\")\r\n client.track(\"views:user:1\", \"index.html\")\r\n client.track(\"views:user:1\", \"index.html\")\r\n\r\n assert 1 == client.count(\"views:user:1\", datetime.datetime.now(), \"day\")\r\n assert 1 == client.cardinality(\"views:user:1\", datetime.datetime.now(), \"day\")\r\n assert set([\"index.html\"]) == client.uniques(\"views:user:1\", datetime.datetime.now(), \"day\")\r\n\r\nReferences\r\n==========\r\n* `Minuteman `_\r\n* `Zero `_\r\n\r\n.. :changelog:\r\n\r\nChangelog\r\n---------\r\n\r\n0.0.4 2015-06-16\r\n================\r\n* Removed transactional pipelines from redis storage.\r\n\r\n0.0.3 2015-06-10\r\n================\r\n* Initial release",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/alisaifee/sifr",
"keywords": "",
"license": "MIT",
"maintainer": "",
"maintainer_email": "",
"name": "sifr",
"package_url": "https://pypi.org/project/sifr/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/sifr/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "https://github.com/alisaifee/sifr"
},
"release_url": "https://pypi.org/project/sifr/0.0.4/",
"requires_dist": null,
"requires_python": null,
"summary": "Window based counters",
"version": "0.0.4"
},
"last_serial": 1593587,
"releases": {
"0.0.1": [],
"0.0.2": [
{
"comment_text": "",
"digests": {
"md5": "8bdba6395af1b5722d3b6357b0270c34",
"sha256": "e966311b451f7f8f12d8a2dff3026b83bbddbb0724af888f1f7b3c447e207b02"
},
"downloads": -1,
"filename": "sifr-0.0.2-py2.7.egg",
"has_sig": false,
"md5_digest": "8bdba6395af1b5722d3b6357b0270c34",
"packagetype": "bdist_egg",
"python_version": "2.7",
"requires_python": null,
"size": 37738,
"upload_time": "2015-06-10T13:01:17",
"url": "https://files.pythonhosted.org/packages/21/98/1e024867a405b2bbde5877b1eb45aeb733031f0091b6b5d056131a2fad87/sifr-0.0.2-py2.7.egg"
},
{
"comment_text": "",
"digests": {
"md5": "b9b32e7b8d5c30bb56bac5e18afc88c7",
"sha256": "3060ea29eccdce316f68e4cf008eda1696e0f4eab48313d1a29db41a12fa4664"
},
"downloads": -1,
"filename": "sifr-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "b9b32e7b8d5c30bb56bac5e18afc88c7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 224161,
"upload_time": "2015-06-10T13:01:11",
"url": "https://files.pythonhosted.org/packages/61/1f/e63b2bac2054723fe544624a9e3d7e6763a67274369a1853e3c06a4b141e/sifr-0.0.2.tar.gz"
}
],
"0.0.3": [
{
"comment_text": "",
"digests": {
"md5": "87ee1ceddc3b8af62d8f34ba88eb8ff6",
"sha256": "3d21dc799fcffba6f5150c799e22bd3109e333ace831402587671f1a194de8fa"
},
"downloads": -1,
"filename": "sifr-0.0.3-py2.7.egg",
"has_sig": false,
"md5_digest": "87ee1ceddc3b8af62d8f34ba88eb8ff6",
"packagetype": "bdist_egg",
"python_version": "2.7",
"requires_python": null,
"size": 37741,
"upload_time": "2015-06-10T13:19:59",
"url": "https://files.pythonhosted.org/packages/d0/fc/75c7f9e81314d93ef11ba20122c15e5465d5c1c21ef6ee729d18770a91dd/sifr-0.0.3-py2.7.egg"
},
{
"comment_text": "",
"digests": {
"md5": "cf0650a3059ce5db60956d678120d16e",
"sha256": "a78f1394d8cfad9e1f8f9552b7165b7b2ea0dfdbe107793f15e898a39b485acd"
},
"downloads": -1,
"filename": "sifr-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "cf0650a3059ce5db60956d678120d16e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 224168,
"upload_time": "2015-06-10T13:19:54",
"url": "https://files.pythonhosted.org/packages/4d/5d/d65257d91fa8fe4896b066a2cd55a59b2ffda137a952b233f78ef1a935c9/sifr-0.0.3.tar.gz"
}
],
"0.0.4": [
{
"comment_text": "",
"digests": {
"md5": "f8aa702a69bc74595ce37db24e51d97a",
"sha256": "15162585d941d95cc8fd777d4c8f4feb17bbfd7599b998304c9ee89be98ad86e"
},
"downloads": -1,
"filename": "sifr-0.0.4-py2.7.egg",
"has_sig": false,
"md5_digest": "f8aa702a69bc74595ce37db24e51d97a",
"packagetype": "bdist_egg",
"python_version": "2.7",
"requires_python": null,
"size": 37955,
"upload_time": "2015-06-15T22:29:07",
"url": "https://files.pythonhosted.org/packages/85/87/cfe73689ba349f548675f55bec88e2f9424bb5f0bc5c8c19b7f2e141d732/sifr-0.0.4-py2.7.egg"
},
{
"comment_text": "",
"digests": {
"md5": "c8420e72c5d5c59424986b0c42688318",
"sha256": "fed1170cc039435fdce29a3d1235e4ef1c5e5710925419917d9863a5f25205e8"
},
"downloads": -1,
"filename": "sifr-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "c8420e72c5d5c59424986b0c42688318",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 224331,
"upload_time": "2015-06-15T22:29:02",
"url": "https://files.pythonhosted.org/packages/b3/af/fcbe9f214281f800ee716fa15a874550a1489f3fa315b8636ec391e87c3d/sifr-0.0.4.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "f8aa702a69bc74595ce37db24e51d97a",
"sha256": "15162585d941d95cc8fd777d4c8f4feb17bbfd7599b998304c9ee89be98ad86e"
},
"downloads": -1,
"filename": "sifr-0.0.4-py2.7.egg",
"has_sig": false,
"md5_digest": "f8aa702a69bc74595ce37db24e51d97a",
"packagetype": "bdist_egg",
"python_version": "2.7",
"requires_python": null,
"size": 37955,
"upload_time": "2015-06-15T22:29:07",
"url": "https://files.pythonhosted.org/packages/85/87/cfe73689ba349f548675f55bec88e2f9424bb5f0bc5c8c19b7f2e141d732/sifr-0.0.4-py2.7.egg"
},
{
"comment_text": "",
"digests": {
"md5": "c8420e72c5d5c59424986b0c42688318",
"sha256": "fed1170cc039435fdce29a3d1235e4ef1c5e5710925419917d9863a5f25205e8"
},
"downloads": -1,
"filename": "sifr-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "c8420e72c5d5c59424986b0c42688318",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 224331,
"upload_time": "2015-06-15T22:29:02",
"url": "https://files.pythonhosted.org/packages/b3/af/fcbe9f214281f800ee716fa15a874550a1489f3fa315b8636ec391e87c3d/sifr-0.0.4.tar.gz"
}
]
}