Shared-memory Python object namespace with Apache Plasma. Built because of Plotly Dash, useful anywhere.
MIT License
Published by russellromney about 4 years ago
Bumps previously released v0.3.1 for PyPi to use a file with a new name.
Published by russellromney about 4 years ago
Wrong, untested code released in v0.3. Incomplete git add
. This fixes that and stabilizes the package.
Published by russellromney about 4 years ago
This release is the biggest release yet in the path to production usefulness outside of a few large objects. brain_plasma.Brain
is mostly rewritten and entirely refactored; it now hashes names for direct access to speed up read and write operations by several orders of magnitude due to fewer and more lightweight calls. The API is mostly the same. Custom exceptions are added to help users catch and understand errors better. Most functions are unit tested and can be checked with pytest
.
The sum of these changes means brain-plasma
can be used as a fast production backend similar to Redis, but with fast support for very large values as well as for very small values, and for few as well as many values. I'm pretty excited about it.
Speedup results are drastic, especially when there are more than a dozen or so names in the store. This is because the old Brain
called client.list()
multiple times for a most Brain
interactions. This was admittedly a horrible design that should never have existed. The new Brain
doesn't call client.list()
at all for most operations including all reads and writes. The script many_vals.py
compares the old with the new Brain
s:
plasma_store -m 10000000 -s /tmp/plasma
# new terminal
python many_vals.py
>>>
100 items:
learn:
old: 3.6606647968292236
hash: 0.030955076217651367
recall:
old: 4.092543840408325
hash: 0.017110824584960938
10 items:
learn:
old: 0.32016992568969727
hash: 0.005012035369873047
recall:
old: 0.31406521797180176
hash: 0.002324819564819336
Most functions are tested in tests/
. Check yourself or test your changes with:
pip install pytest
pytest
Custom exceptions are added to help users catch and understand errors better. Most types of errors that are unique to the functions rather than to Python errors are defined as custom exceptions. Function docstrings mention which exceptions which may be caught. New exceptions are imported en masse like:
from brain_plasma.exceptions import (
BrainNameNotExistError,
BrainNamespaceNameError,
BrainNamespaceNotExistError,
BrainNamespaceRemoveDefaultError,
BrainNameLengthError,
BrainNameTypeError,
BrainClientDisconnectedError,
BrainRemoveOldNameValueError,
BrainLearnNameError,
BrainUpdateNameError,
)
Code is formatted with the excellent black
. Markdown is formatted with Prettier.
Published by russellromney about 5 years ago
BIG RELEASE WITH BREAKING CHANGES: v0.2
learn()
to ('name',thing)
which is more intuitive (but you should always use bracket notation)len(brain)
, del brain['this']
and 'this' in brain
are now avilable (implemented __len__
, __delitem__
, and __contains__
)NOTE: stability problems should be resolved in v0.2
.
Published by russellromney over 5 years ago
PyPi setup was wrong; fixed so it works all the time.
brain.resize()
no longer lets you try to resize to a smaller size than your data before deleting all your current data, i.e. #7
Published by russellromney over 5 years ago
Packages were not accessible due to an incorrect package setup structure. Fixed.
Published by russellromney over 5 years ago
object_map(), used(), free(), resize(), bytes, size(), etc.
A more robust API.
brain.size is now brain.size() - a dynamically updated function.
Published by russellromney over 5 years ago
Added ability to learn
and recall
using bracket notation, via PR #1 from @tcbegley
Removed a bug preventing user from reassigning values to a name.
Added ability to start up plasma_store
in instantiation of Brain
.
Overall - core functionality is more stable and you don't need to start up other stuff beforehand in the command line to use brain-plasma.
Published by russellromney over 5 years ago
The first release of brain-plasma.