Skip to main content

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.


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

# or get multiple items at once (here 10k)
keys = [f"key_" + str(random.randint(0, N - 1)) for i in range(10000)]


Maixent Chenebaux

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dikt, version 2.0.0
Filename, size File type Python version Upload date Hashes
Filename, size dikt-2.0.0-py3-none-any.whl (3.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size dikt-2.0.0.tar.gz (4.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page