{ "info": { "author": "Steve Jackson", "author_email": "washad@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# PyRedisEasyIO\nA project to simplify reading/writing single objects from/to redis\n\n\n## Description\nRedis is a great way to share data between applications - or processes in an application. \nHowever, in its raw form, the application has to deal with data type conversion to/from\nstring, check for existence, and other pesky stuff. It would be nice if that were \nabstracted in such a way to where it didn't appear in code that redis was being used\nat all. \n\nThis project seeks to allow the exchange of single data points in a readable way, eg. \nmy_data.my_value = 30 (automatically writes '30' to redis) \n\n## Installation\npip install pyrediseasyio\n\n\n## Usage\nThe basis of functionality is the IOGroup class. It acts as a container for individual values\nand performs the behind-the-scenes reads and writes. \n\n~~~~\nfrom io_group import IOGroup\nfrom single_io import BooleanIO, IntIO, FloatIO\n\n\nclass TestGroup1(IOGroup):\n Bool1 = BooleanIO(\"Boolean 1\", \"Bool1\", False)\n Bool2 = BooleanIO(\"Boolean 2\", \"Bool2\", True)\n Int1 = IntIO(\"Integer 1\", \"Int1\")\n Int2 = IntIO(\"Integer 2\", \"Int2\", default=34)\n MyFloat1 = FloatIO(\"Float 1\", \"Float1\", default=1.2)\n\nclass TestGroup2(IOGroup):\n Bool1 = BooleanIO(\"Boolean 1\", \"Bool1\", False)\n Bool2 = BooleanIO(\"Boolean 2\", \"Bool2\", True)\n Int1 = IntIO(\"Integer 1\", \"Int1\")\n Int2 = IntIO(\"Integer 2\", \"Int2\", default=34)\n Float1 = FloatIO(\"Float 1\", \"Float1\", default=1.2)\n\n\ngroup1a = TestGroup1()\ngroup1b = TestGroup1()\ngroup2 = TestGroup2()\n\ngroup1a.MyFloat1 = 1234.5 # Performs redis 'set', sending 1234.5 with key 'Float1'\nprint(group1b.Float1.value) # Performs redis 'get', calling 'value' converts to primitive type\nprint(group2.Float1.value)\n~~~~\n\n### HTML: \nFor convenience, methods are provided to automatically generate html. The \n[dominate](https://github.com/Knio/dominate/blob/master/tests/test_html.py) library is used behind the scenes,\ngiving you first class access to manipulate the html response; Below is an example of usage, \nconsult the test cases for further examples. \n\n~~~~\n\nclass TestGroup(IOGroup):\n Bool1 = BooleanIO(\"Boolean 1\", \"Bool1\", units=\"On/Off\")\n Float1 = FloatIO(\"Float 1\", \"Float1\", default=1.23, units=\"furlongs\")\n\n\nh = HMTLIOGroup(test_group, \"my_id\", \"my_namespace\").html().render()\nprint(h) #-> Gives;\n\n'''\n