A set of tools for simplifying reading and writing of single values to/from Redis.
Project description
PyRedisEasyIO
A project to simplify reading/writing single objects from/to redis
Description
Redis is a great way to share data between applications - or processes in an application. However, in its raw form, the application has to deal with data type conversion to/from string, check for existence, and other pesky stuff. It would be nice if that were abstracted in such a way to where it didn't appear in code that redis was being used at all.
This project seeks to allow the exchange of single data points in a readable way, eg. my_data.my_value = 30 (automatically writes '30' to redis)
Installation
pip install pyrediseasyio
Usage
The basis of functionality is the IOGroup class. It acts as a container for individual values and performs the behind-the-scenes reads and writes.
from io_group import IOGroup
from single_io import BooleanIO, IntIO, FloatIO
class TestGroup1(IOGroup):
Bool1 = BooleanIO("Boolean 1", "Bool1", False)
Bool2 = BooleanIO("Boolean 2", "Bool2", True)
Int1 = IntIO("Integer 1", "Int1")
Int2 = IntIO("Integer 2", "Int2", default=34)
Float1 = FloatIO("Float 1", "Float1", default=1.2)
class TestGroup2(IOGroup):
Bool1 = BooleanIO("Boolean 1", "Bool1", False)
Bool2 = BooleanIO("Boolean 2", "Bool2", True)
Int1 = IntIO("Integer 1", "Int1")
Int2 = IntIO("Integer 2", "Int2", default=34)
Float1 = FloatIO("Float 1", "Float1", default=1.2)
group1a = TestGroup1()
group1b = TestGroup1()
group2 = TestGroup2()
group1a.Float1 = 1234.5
print(group1b.Float1.value)
print(group2.Float1.value)
That is really all there is to it. For more specific cases, see the unit tests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyrediseasyio-0.0.10.tar.gz
.
File metadata
- Download URL: pyrediseasyio-0.0.10.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d674f963655443345bc37a7c0e0c64d81c80487dbe61e637d83062579739487f |
|
MD5 | 17621bbf0fb36e25d03d32f86a522019 |
|
BLAKE2b-256 | fada5bda197c739e3197087c39e7de37156570cd3dbedc5c35e1c9fdfa7c4de4 |
File details
Details for the file pyrediseasyio-0.0.10-py3-none-any.whl
.
File metadata
- Download URL: pyrediseasyio-0.0.10-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b35861ac2b6a875c3d3ce6eeec8affb1fd43e96ca4f26d176fa390cd0ba9bd7d |
|
MD5 | 119fb65536654543e4cdd87ea9bf5d3c |
|
BLAKE2b-256 | 07fabd4e51cd4d117975e2977024d6e8408d52435241d44ab3f50e552934999d |