Package: reem
REEMAuthor: Trishul Nagenalli, updates by Kris HauserAboutREEM (Redis Extendable Efficient Middleware) is a centralized middleware package for communication across distributed systems (e.g., robots). It is designed to be a single-package solution for passing information anywhere in the system while emphasizing ease of use and efficiency.To make it easy, we chose to model information as a nested data structure that closely resembles python dictionaries. To the user, working with a database feels like working with a python dictionary. Out of the box, REEM supports communicating all native python types and numpy arrays.To make it fast, we usedRedis(an in-memory key-value database) runningReJSON(enabling Redis to store JSON data) as a central information store. To get maximum performance, we give users the power to control exactly how information is passed between the local program and Redis by defining their own encoder/decoder objects.REEM currently offers two communication paradigms:get/set databasepublish-subscribeInstallationTo install the python package (and its dependencies), runpip install reemYou will also need to have access to a Redis server with RedisJSON enabled.  See thesetup tutorialfor step-by-step instructions o installing and configuring a compatible local Redis server.Tutorials and API documentationSeeexample.pyor the docs onread the docs.Version history0.1.2:bug fixes in pub/sub implementation.Addedget(key,default_value)to subkey accessor analogous to dict'sgetmethod.0.1.1:addedget()andset()to KeyValueStore for direct access to Rejson's JSON.GET / JSON.SET.0.1.0: fork by Kris HauserCan now access items by array index.Much easier to work with items like normal Python objects.  Can:Can treat accesssors as variables usingread()andwrite(), e.g.,var = server['key']; var.read(); var.write(x). (See bug fix note below).Delete items viadel server['key']ordel server['key']['subkey'](uses Rejson's JSON.DEL)Increment/decrement values viaserver['key']['subkey'] += 1or-=(uses Rejson's JSON.NUMINCRBY).  Note: does not work for Numpy arrays.Multiply/divide values viaserver['key']['subkey'] *= 2or/=(uses Rejson's JSON.NUMMULTBY).  Note: does not work for Numpy arrays.Append to arrays viaserver['key'].append(x)orserver['key']['subkey'].append(x)(uses Rejson's JSON.ARRAPPEND)Multiple append to arrays viaserver['key'] += [x,y,z]orserver['key']['subkey'] += [x,y,z](uses Rejson's JSON.ARRAPPEND)Get sizes of arrays/objects usinglen(server['key'])orlen(server['key']['subkey'])(uses Rejson's JSON.OBJLEN or JSON.ARRLEN)Get types of items usingserver['key'].type()orserver['key']['subkey'].type()(uses Rejson's JSON.TYPE)KeyValueStore, PublishSpace, SilentSubscriber, and CallbackSubscriber are now in the global reem namespace.  Also, they can be given a string host rather than separately having to create a RedisInterface object.KeyValueStore and PublishSpace are now thread safe. (Note: not thoroughly tested yet).Objects retrieved by ['key'] no longer get clobbered when accessing ['subkey'].  E.g.,kvs['topkey'] = {'subkey':{'foo':3}}
a = kvs['topkey']
b = a['subkey']
b['foo'] = 4
print(a.read())  #prior version unexpected prints {'subkey':{'foo':3},'foo':4}, new version prints {'subkey'{'foo':4}} as expected.Slight performance improvements for deeply nested accessesPython 2 version automatically returns json objects with keys / values as str instead of unicode.0.0.x: original from Trishul Nagenalli