Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
3a7bb30
Fixed up for Python 2 / 3 compatibility
krishauser Jan 3, 2020
b0c04db
Bug fixes in support.py on ReadablePathHandler
joaomcm Jun 10, 2020
5ae9950
Merge pull request #1 from joaomcm/patch-1
krishauser Jun 15, 2020
dfe8287
Updated to version 0.1.0, made several fixes
krishauser Dec 19, 2020
66e490c
merged to new
krishauser Dec 19, 2020
76a9d8a
Fixed second-level write access problem
krishauser Dec 19, 2020
e3cf429
For Python2, all items are now encoded as str rather than unicode
krishauser Dec 20, 2020
d5ef82c
For Python2, all items are now encoded as str rather than unicode
krishauser Dec 20, 2020
a954a24
Can now delete properly using JSON.DEL
krishauser Dec 24, 2020
e91e19b
Can now read() / write() accessors as variables
krishauser Dec 24, 2020
ff0311f
added get/set commands to KeyValueStore
krishauser Apr 4, 2021
13a3bc4
Fixed markdown
krishauser May 20, 2021
fce8065
Updated docs
krishauser May 20, 2021
d1e0b4a
Streamlined naming, fixed one bug
krishauser Dec 14, 2021
db0e472
Renamed examples
krishauser Dec 14, 2021
b8bf442
Added wheel build setup
krishauser Dec 14, 2021
7848474
Updated to easier API
krishauser Apr 29, 2022
b573022
rename ship to marshall
krishauser Apr 29, 2022
18398e1
Updated docs to new version, Windows install
krishauser Apr 29, 2022
8c2459f
Minimal requirements.txt
krishauser May 2, 2022
f8c0fb8
Bump version number
krishauser May 2, 2022
7e18b33
Minimal requirements for RTD
krishauser May 2, 2022
2296857
Fixed links
krishauser May 2, 2022
414c033
Fixed module naming, copyright
krishauser May 2, 2022
1b91130
Trying to get API docs working
krishauser May 2, 2022
1d9d855
Trying to get API docs working... more requirements
krishauser May 2, 2022
7e2ec1d
Fixed some issues with building docs
krishauser May 2, 2022
868e9f1
Removed build folder
krishauser May 2, 2022
14a2e5f
Added RTD configuration
krishauser May 2, 2022
715079c
Added improved readme reading
krishauser May 2, 2022
d5ce165
Merge branch 'master' of https://github.com/krishauser/reem
krishauser May 2, 2022
3ea630b
Fixed docs warnings
krishauser May 2, 2022
82f426c
Trying more attempts to import
krishauser May 2, 2022
f0f7466
Trying to move reem to build from pip install
krishauser May 2, 2022
e34ad76
Trying to move reem to build from pip install
krishauser May 2, 2022
1f74a4c
More attempts to debug RTD build
krishauser May 2, 2022
71a696f
Need redis < 4.0.0
krishauser May 2, 2022
076ca85
Taking out pottery
krishauser May 2, 2022
c32e623
More testing
krishauser May 2, 2022
1d7ee6b
Trying to find which version of reem is installed
krishauser May 2, 2022
cfea3dc
Trying post1 version of reem
krishauser May 2, 2022
ee934b4
Updated to post1 post-build update
krishauser May 2, 2022
d921877
Fixed exceptions
krishauser May 10, 2022
4b4da95
Updated with better docs
krishauser May 11, 2022
8944c0e
Debugging pub/sub
krishauser May 11, 2022
6e1c401
Fixed merge conflict
krishauser May 11, 2022
42a1c6a
Read and write now at same rate
krishauser May 11, 2022
fad7dfe
Updated to 0.1.2, bug fixes and new get() method
krishauser May 11, 2022
ff3fc95
Updated to allow redis-py 4.x
krishauser May 20, 2022
c55a3e0
Updated example
krishauser May 20, 2022
846f2ce
Add __enter__ and __exit__ to RejsonCompat
patricknaughton01 May 4, 2023
1f07e32
Pass arguments through to redis interface
patricknaughton01 May 4, 2023
c9b7027
Adding docs to key value store for args and kwargs
patricknaughton01 May 12, 2023
14bdfcf
RejsonCompat del command
patricknaughton01 May 12, 2023
799c0ea
Merge pull request #5 from patricknaughton01/arg_passthrough
krishauser May 18, 2023
4ff8851
Bump version, updated docs for more up-to-date install instructions.
krishauser Oct 17, 2023
9c9c821
Added typestrings
krishauser Nov 25, 2023
c1a38ee
Fixed exception message
krishauser Nov 25, 2023
33fca07
More type hints
krishauser Dec 3, 2023
b0da1a9
Upgraded to use pip build system
krishauser Dec 4, 2023
ed7d362
Added convenience structure TolerantKeyValueStore
krishauser Dec 4, 2023
834cbdc
Created pyproject.toml to conform to new pip standards
krishauser Dec 5, 2023
f200a85
Better documentation
krishauser Dec 5, 2023
9aeba85
Installing current version for readthedocs
krishauser Dec 5, 2023
2cf823e
Hiding private methods, documenting marshalling classes
krishauser Dec 5, 2023
4fccd81
More docs updates
krishauser Dec 5, 2023
c6461c3
Fixed bugs identified by sonarqube
krishauser Feb 20, 2024
97a8a75
Updated readme and getting started
krishauser May 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
31 changes: 31 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "3.7"
# You can also specify other tool versions:
# nodejs: "16"
# rust: "1.55"
# golang: "1.17"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
python:
install:
- method: pip
path: .
- requirements: docs/requirements.txt
66 changes: 61 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,75 @@
# REEM

REEM (Redis Extendable Efficient Middleware) is a centralized middleware package for robotic communication. It is designed to be a single-package solution for passing information anywhere in the robot while emphasizing ease of use and efficiency.
Author: Trishul Nagenalli and Kris Hauser

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.
## About

To make it fast, we used [Redis](https://redis.io/) (an in-memory key-value database) running [ReJSON](https://oss.redislabs.com/redisjson/) (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 (Redis Extendable Efficient Middleware) is a middleware package for communication across distributed systems (e.g., robots) using a centralized Redis database. It is designed to be a single-package solution for passing information anywhere in a system while emphasizing ease of use and efficiency.

- REEM is easy to use. You can read or write data from the database using a nested data structure that feels almost like working with native Python dictionaries, lists, strings, numbers, and Numpy arrays. If you feel ReJSON is a little clumsy, REEM may be just the tool for you.
- REEM is fast. We use [Redis](https://redis.io/) (an in-memory key-value database) running [ReJSON](https://oss.redislabs.com/redisjson/) (enabling Redis to store JSON data) as a central information store. This can support hundreds of thousands of queries per second. We also support Pythonic access to array extension, length queries,
- REEM is extendable. If you want to store some complex Python object, we give users the power to control exactly how information is passed between the local program and Redis by defining custom marshallers. REEM comes with builtin marshallers for Numpy arrays.

REEM currently offers two communication paradigms:
- get/set database
- get/set key-value store
- publish-subscribe

In other projects, we have used these primitives implement other paradigms, such as streams, event queues, and RPC.


## Installation

REEM is highly portable and runs on Python 3.3+.

To install the python package (and its dependencies), run
```
pip install reem
```
See the docs on [read the docs](https://reem.readthedocs.io)
You will also need to have access to a Redis server with RedisJSON enabled. See the [setup tutorial](https://reem.readthedocs.io/en/latest/gettingstarted.html) for step-by-step instructions on installing and configuring a compatible local Redis server.

## Tutorials and API documentation
See [example.py](https://www.github.com/krishauser/reem/blob/master/example.py) or the docs on [read the docs](https://reem.readthedocs.io).



## Version history

0.1.3:
- Updated to require redis-py 4.0.0+. API is still backwards-compatible with redis-py 3.5+ (which requires rejson).
- Added `with` syntax on key-value store accessors which allows you to make many updates to an object without bogging down the Redis server. Usage is `with kvs['key'] as val: foo(val)` which is equivalent to `val=kvs['key'].read(); foo(val); kvs['key'] = val` and often much faster than `foo(kvs['key'])` if `foo` performs lots of reads and writes.
- Useless `RedisInterface.initialize()` method removed.
- Accessor `KeyValueStore.get(key)` will not fail if the top-level key exists on the Redis server but hasn't been pulled in this client.
- Added new convenience structure `TolerantKeyValueStore` which will automatically create uninitialized subkeys, throttle frequent reads, and accept both `.`-separated strings and lists of indexes as keys.

0.1.2:
- bug fixes in pub/sub implementation.
- Added `get(key,default_value)` to subkey accessor analogous to dict's `get` method.

0.1.1:
- added `get()` and `set()` to KeyValueStore for direct access to Rejson's JSON.GET / JSON.SET.

0.1.0: fork by Kris Hauser
- Can now access items by array index.
- Much easier to work with items like normal Python objects. Can:
- Can treat accesssors as variables using `read()` and `write()`, e.g., `var = server['key']; var.read(); var.write(x)`. (See bug fix note below).
- Delete items via `del server['key']` or `del server['key']['subkey']` (uses Rejson's JSON.DEL)
- Increment/decrement values via `server['key']['subkey'] += 1` or `-=` (uses Rejson's JSON.NUMINCRBY). Note: does not work for Numpy arrays.
- Multiply/divide values via `server['key']['subkey'] *= 2` or `/=` (uses Rejson's JSON.NUMMULTBY). Note: does not work for Numpy arrays.
- Append to arrays via `server['key'].append(x)` or `server['key']['subkey'].append(x)` (uses Rejson's JSON.ARRAPPEND)
- Multiple append to arrays via `server['key'] += [x,y,z]` or `server['key']['subkey'] += [x,y,z]` (uses Rejson's JSON.ARRAPPEND)
- Get sizes of arrays/objects using `len(server['key'])` or `len(server['key']['subkey'])` (uses Rejson's JSON.OBJLEN or JSON.ARRLEN)
- Get types of items using `server['key'].type()` or `server['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 accesses
- Python 2 version automatically returns json objects with keys / values as str instead of unicode.

0.0.x: original from Trishul Nagenalli
Binary file removed docs/_build/doctrees/advanced.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/basic.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/docs.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file removed docs/_build/doctrees/examples.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/gettingstarted.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/index.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/performance.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/server-utilities.doctree
Binary file not shown.
4 changes: 0 additions & 4 deletions docs/_build/html/.buildinfo

This file was deleted.

Binary file removed docs/_build/html/_images/browser_screen_cap.png
Binary file not shown.
Binary file removed docs/_build/html/_images/numpy_get_fr.png
Binary file not shown.
Binary file removed docs/_build/html/_images/numpy_set_fr.png
Binary file not shown.
Binary file removed docs/_build/html/_images/pottery_comparison.png
Binary file not shown.
Binary file removed docs/_build/html/_images/reem_v_pottery.png
Binary file not shown.
Binary file removed docs/_build/html/_images/set_numpy.png
Binary file not shown.
Binary file removed docs/_build/html/_images/set_string.png
Binary file not shown.
Binary file removed docs/_build/html/_images/subscriber_oh.png
Binary file not shown.
38 changes: 0 additions & 38 deletions docs/_build/html/_sources/advanced.rst.txt

This file was deleted.

Loading