A trivial, persistent, dictionary-like object, backed by SQLite.
Installation
$ python setup.py install
Or just drop the permadict.py file into your package.
Usage
Basic usage:
>>> from permadict import Permadict
>>> d = Permadict("db.sqlite")
>>> d["key"] = "value"
>>> print(d["key"])
value
As a context manager:
>>> with Permadict("db.sqlite") as d:
... d["something"] = 1.2345
...
>>> with Permadict("db.sqlite") as d:
... print(d["something"])
...
1.2345
Iterating:
>>> d = Permadict("db.sqlite")
>>> for k, v in d.items():
... print(k, v)
...
something 1.2345
>>> for key in d.keys():
... print(key)
...
something
Deleting an item:
>>> del d["something"]
Clearing all items:
>>> d.clear()
Limitations
Keys must be strings. Values are stored as BLOB type after being pickled, so your Python objects must be picklable.
Permadict doesn’t act entirely like a dict: some methods are missing, whether that be on purpose (as with dict.copy) or simply due to negligence.
Motivation
I needed a way to share small amounts of data between processes. SQLite provides a safe way to do so. Also, why not?
Metadata
Release files for permadict 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| permadict-1.0.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for permadict-1.0.1-py2.py3-none-any.whl |
Release files / permadict-1.0.1-py2.py3-none-any.whl
| Download URL | permadict-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
30e3b0ada57835fb79e4162860c964dfe1ab57a23e04e75ab12452c9aa07a643
|
|
BLAKE2b-256 checksum How to use checksums |
62015a6484b487fd5637cdb9985e0ddaf986dae6774894f24dc2bc6f4f688dce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for permadict 1.0.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.