dictature -- A generic wrapper around dict-like interface with mulitple backends
Project description
Dictature
A wrapper for Python's dictionary with multiple backends.
Installation
pip install dictature
Dictature usage
This package also includes a class that allows you to use your SQLite db or any backend as a Python dictionary:
from dictature import Dictature
from dictature.backend import DictatureBackendDirectory, DictatureBackendSQLite
# will use/create the db directory
# dictionary = Dictature(DictatureBackendDirectory('test_data'))
# will use/create the db file
dictionary = Dictature(DictatureBackendSQLite('test_data.sqlite3'))
# will create a table db_test and there a row called foo with value bar
dictionary['test']['foo'] = 'bar'
# also support anything that can be jsonized
dictionary['test']['list'] = ['1', 2, True]
print(dictionary['test']['list']) # prints ['1', 2, True]
# or anything, really (that can be serialized with pickle)
from threading import Thread
dictionary['test']['thread'] = Thread
print(dictionary['test']['thread']) # prints <class 'threading.Thread'>
# and deleting
del dictionary['test']['list'] # deletes the record
del dictionary['test'] # drops whole table
Currently, the following backends are supported:
DictatureBackendDirectory: stores the data in a directory as json filesDictatureBackendSQLite: stores the data in a SQLite database
Transformers
You can also use transformers to change how the values are stored. E.g. to encrypt data, you can use the
AESTransformer (which requires the pycryptodome package):
from dictature import Dictature
from dictature.backend import DictatureBackendDirectory
from dictature.transformer.aes import AESTransformer
name_transformer = AESTransformer('password1', True)
value_transformer = AESTransformer('password2', False)
dictionary = Dictature(
DictatureBackendSQLite('test_data.sqlite3'),
name_transformer=name_transformer,
value_transformer=value_transformer
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dictature-0.9.3.tar.gz.
File metadata
- Download URL: dictature-0.9.3.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
828209dbc528b770f9fad863290cea275304ff9e04a7cb0ced4f1277a81a9a98
|
|
| MD5 |
06257c8f26fa2a07f53decf23488e8e4
|
|
| BLAKE2b-256 |
1751344cc568f31e224d91c8debe73d54e7ff488c77b814f3e42e6d725deb256
|
Provenance
The following attestation bundles were made for dictature-0.9.3.tar.gz:
Publisher:
pypi-deploy.yml on esoadamo/dictature
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dictature-0.9.3.tar.gz -
Subject digest:
828209dbc528b770f9fad863290cea275304ff9e04a7cb0ced4f1277a81a9a98 - Sigstore transparency entry: 175483618
- Sigstore integration time:
-
Permalink:
esoadamo/dictature@65f0988f827fd380d8e5b375073f5326ffde5e04 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/esoadamo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-deploy.yml@65f0988f827fd380d8e5b375073f5326ffde5e04 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dictature-0.9.3-py3-none-any.whl.
File metadata
- Download URL: dictature-0.9.3-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eeb1d7974607992668aefc3b9a2db3b6f80327e1c13665070ecb3a02ce749221
|
|
| MD5 |
e29247eb06a0c0a644bf491c7afce3cc
|
|
| BLAKE2b-256 |
b9f46c764f0b7fabb59c58c08ee8b143fbe18b1e26aeffb22b78b390e19d09fe
|
Provenance
The following attestation bundles were made for dictature-0.9.3-py3-none-any.whl:
Publisher:
pypi-deploy.yml on esoadamo/dictature
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dictature-0.9.3-py3-none-any.whl -
Subject digest:
eeb1d7974607992668aefc3b9a2db3b6f80327e1c13665070ecb3a02ce749221 - Sigstore transparency entry: 175483621
- Sigstore integration time:
-
Permalink:
esoadamo/dictature@65f0988f827fd380d8e5b375073f5326ffde5e04 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/esoadamo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-deploy.yml@65f0988f827fd380d8e5b375073f5326ffde5e04 -
Trigger Event:
push
-
Statement type: