Xmem
Simple to use, extensible key-based storage module.
Built around python dictionary.
How to install
pip install xmem
Sample
from xmem import MemoryEngine
# for json based storage
from xmem.templates import JsonTemplate
# or for pickle based storage
from xmem.templates import PickleTemplate
# or Registry storage [Windows]
from xmem.templates import RegistryTemplate
# instantiate memory using save :path and :template instance
# path may be str, or pathlib.Path object
memory = MemoryEngine('data', JsonTemplate())
# optional: register save to python script exit event
memory.save_atexit()
CRUD
Create, Update
Create and update is handled using same functions.
put, putall
If key doesnt exist it would be created, else the value updated.
# add or update memory using :put
# method :put may be chained
memory\
.put('One', 1)\
.put('Two', 2)
# or by using :putall
memory.putall({
'three': 3,
'Four': 4
})
Read
# read from memory using :get
two = memory.get('Two')
# output: 2
Delete
# delete keys using :delete
memory.delete('Two', 'Four')
# or clear the whole memory using :clear
memory.clear()
Method :delete takes one or more keys as parameters
Create a template
A template has two methods that need to be overwridden
def save(self, data: dict):
...
def load(self) -> dict:
...
Metadata
Release files for xmem 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xmem-0.1.1.tar.gz | 6.1 kB | Without provenance | Details for xmem-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xmem-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for xmem-0.1.1-py3-none-any.whl |
Total release size: 18.3 kB
Release files / xmem-0.1.1.tar.gz
| Download URL | xmem-0.1.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bff9ca588767e06115fc3689b7073ddda5917ab8201fd2387a0f1260aed8b943
|
|
BLAKE2b-256 checksum How to use checksums |
9a69c360750fdfd798c12db6f6e5008808bb6599fa8cdedfa6f0d0f4e73d052a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.4
|
Release files / xmem-0.1.1-py3-none-any.whl
| Download URL | xmem-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9d8dac3d29be5c551883432be290e607da4917f385d8fd767fcd01e2ba4bdbb
|
|
BLAKE2b-256 checksum How to use checksums |
49907329d46c42bf9819c4f687843258e273ffe2e881eca56987e032b26a78e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.4
|
Security for xmem 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.