Pressdict is a compressed key-value store for JSON-serializable objects.
The objects to be stored in the container are JSON-serialized and the resulting string is compressed using zlib. The compressed string is then stored as value for the given key. When accessing the values in the container this process is reversed.
Example of usage
Pressdict can mostly be used like a normal Python dict:
from pressdict import Pressdict
pd = Pressdict()
pd["test"] = {"key": "value", "key2": 2}
print(pd["test"])
Important
Remember that everything in the dict is stored as string and is therefor IMMUTABLE!! That means that THIS WILL NOT WORK:
pd["list"].append("item") # will not work!
pd["dict"]["new_key"] = "value" # will not work!
Thus, changes to objects in the Pressdict have to be explicit:
pd["list"] = pd["list"] + ["item"] d = pd["dict"] d["new_key"] = "value" pd["dict"] = d
Lists
NEW: Package now also includes a pressed list:
from pressdict import Presslist
pl = Presslist()
pl.append({"key": "value", "key2": 2})
print(pl[0])
Note that the same restrictions apply as for Pressdicts: You can not modify a stored object directly. You need to retrieve the object, modify it and store it again.
Tests
Testing requires having the nose library (pip install nose). After installation, the package can be tested by executing from outside the source directory:
nosetests --exe -v
Release files for Pressdict 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Pressdict-1.0.0.tar.gz | 3.8 kB | Details |
Release files / Pressdict-1.0.0.tar.gz
| Download URL | Pressdict-1.0.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c68bb4c3687a4a32e09c5c89f635c72da25109c7585fc9823bf22559b1e61c2d
|
|
BLAKE2b-256 checksum How to use checksums |
9de49034e39e192cd01f71b0c06b008af881414fc4de8a4ed70fe8b53efb84bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.9
|