Dictionary read on disk
Project description
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
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
dikt-2.0.0.tar.gz
(4.3 kB
view details)
Built Distribution
dikt-2.0.0-py3-none-any.whl
(3.7 kB
view details)
File details
Details for the file dikt-2.0.0.tar.gz
.
File metadata
- Download URL: dikt-2.0.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f3b26e2300dfe81727207b9674dd416f631b766e3b6c979e159084acb062898 |
|
MD5 | d9b6c14ed8e689f2c0fb0179fa5932bf |
|
BLAKE2b-256 | 8d7aa3bdb5f4d36617cdca1f784d19216a5ff747b9110e4476474c43940f3ed6 |
File details
Details for the file dikt-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: dikt-2.0.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6e274d584c4e367908af16e2d86148c11941bbb4dd08aa20204ca42716aceb9 |
|
MD5 | fd067ee40705458ada19c1fd21879422 |
|
BLAKE2b-256 | 0d333f1c607d62279e5c68c929f4295718335997a488fe8552376b290cd3b23a |