Dictionary read on disk
Query items out-of-memory from a dictionary that would take to long to open, or one that doesn't fit in RAM, with Dikt.
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Installing
You can install the method by typing:
pip install dikt
Basic usage
import dikt
import random
# generate a dictionary with 1 million entries
N = 1000000
data = {
# key can be anything you want
# values will be "eval"-ed by Python
"key_" + str(i): list(range(i, i + 100)) for i in range(N)
}
# persist to dictionary using dikt
dikt.dump(data, "data.dikt")
del data
# load file
data = dikt.Dikt("data.dikt")
# get item without loading the whole file in RAM
print(data["key_125"])
# or get multiple items at once (here 10k)
keys = [f"key_" + str(random.randint(0, N - 1)) for i in range(10000)]
print(data[keys][0])
Authors
Maixent Chenebaux
Metadata
Release files for dikt 2.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 | |
|---|---|---|---|
| dikt-2.0.0.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dikt-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.0 kB
Release files / dikt-2.0.0.tar.gz
| Download URL | dikt-2.0.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f3b26e2300dfe81727207b9674dd416f631b766e3b6c979e159084acb062898
|
|
BLAKE2b-256 checksum How to use checksums |
8d7aa3bdb5f4d36617cdca1f784d19216a5ff747b9110e4476474c43940f3ed6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8
|
Release files / dikt-2.0.0-py3-none-any.whl
| Download URL | dikt-2.0.0-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d6e274d584c4e367908af16e2d86148c11941bbb4dd08aa20204ca42716aceb9
|
|
BLAKE2b-256 checksum How to use checksums |
0d333f1c607d62279e5c68c929f4295718335997a488fe8552376b290cd3b23a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8
|