Skip to main content

local datastore with a dictionary interface

Project description

dictstore

dictstore is a simple local data store for Python that aims to provide an interface similar to a python dictionary.


Getting Started

Installation
pip install dictstore
Usage
# file: sample_1.py

from dictstore import DictStore

data = DictStore()

d[1] = 45
# file: sample_2.py

from dictstore import DictStore

data = DictStore()

print(d[1])

# output: 45

Considerations

  • dictstore uses an in memory dictionary to support fast reads

  • using multiple DictStore instances for the same data file is not supported. Instead DictStore class returns the same instance for the same data file throughout the python code (Singleton behaviour).

  • dictstore is best suited for CLIs or similar applications where values have to be remembered accross multiple runs.

  • The data file is a plain readable text file and no encryption is offered by dictstore.

  • dictstore might not be the fastest datastore, its promise is to get the work done and nothing more.

  • dictstore will evaluate the type of value for all the nested objects in a given value, this is done using a Tree.

  • This project has not be tested for concurrency safety. Please be cautious when using in projects involving multi-anything.

Keys

All Hashable Data Types are supported as keys.

Hashable Data Types
Name Type
String str
Integer int
Float float
Tuple tuple

Values

Dictstore uses ast package and ast.literal_eval under the hood, so currently all the data types supported by ast.literal_eval except Ellipsis are supported as values.

strings, bytes, numbers, tuples, lists, dicts, sets, booleans, None.

For more information about ast.literal_eval visit the following link.

https://docs.python.org/3/library/ast.html#ast.literal_eval

Project details


Download files

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

Source Distribution

dictstore-1.0.0.tar.gz (9.2 kB view hashes)

Uploaded Source

Built Distribution

dictstore-1.0.0-py3-none-any.whl (12.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page