Skip to main content

No project description provided

Project description

Introduction

Islet is a pure python key-value file database. It allows for multiple serializers for both the keys and values. The API is designed to use all of the same python dictionary methods python programmers are used to in addition to the typical dbm methods.

Installation

Install via pip:

pip install islet

Or conda:

conda install -c mullenkamp islet

I’ll probably put it on conda-forge once I feel like it’s up to an appropriate standard…

Serialization

Both the keys and values stored in Islet must be bytes when written to disk. This is the default when “open” is called. Islet allows for various serializers to be used for taking input keys and values and converting them to bytes. The in-build serializers include pickle, str, json, and orjson (if orjson is installed). If you want to serialize to json, then it is highly recommended to use orjson as it is substantially faster than the standard json python module. The user can also pass custom serializers to the key_serializer and value_serializer parameters. These must have “dumps” and “loads” static methods. This allows the user to chain a serializer and a compressor together if desired.

Usage

The docstrings have a lot of info about the classes and methods. Files should be opened with the islet.open function. Read the docstrings of the open function for more details.

Write data

import islet

with islet.open('test.islet', 'n', value_serializer='pickle', key_serializer='str') as db:
  db['test_key'] = ['one', 2, 'three', 4]

Read data

with islet.open('test.islet', 'r') as db:
  test_data = db['test_key']

Notice that you don’t need to pass serializer parameters when reading. Islet stores this info on the initial file creation.

Recommendations

In most cases, the user should use python’s context manager “with” when reading and writing data. This will ensure data is properly written and (optionally) locks are released on the file. If the context manager is not used, then the user must be sure to run the db.sync() at the end of a series of writes to ensure the data has been fully written to disk. And as with other dbm style APIs, the db.close() must be run to close the file and release locks. MultiThreading is safe for multiple readers and writers, but only multiple readers are safe with MultiProcessing.

Benchmarks

Coming soon…

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

islet-0.0.3.dev1.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

islet-0.0.3.dev1-py2.py3-none-any.whl (15.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file islet-0.0.3.dev1.tar.gz.

File metadata

  • Download URL: islet-0.0.3.dev1.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/0.0.0 pkginfo/1.8.2 readme-renderer/27.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.4.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.15

File hashes

Hashes for islet-0.0.3.dev1.tar.gz
Algorithm Hash digest
SHA256 d1acbcb7df38354344f1c37ac87f8ded827cc73925a6541fa3542503bb57c48a
MD5 d8fcc57a3e92f291731e79ba8362000f
BLAKE2b-256 35a39b8e97d91001e4b8825977329774c00c99f9adf93c15ce029ba9444ac9cc

See more details on using hashes here.

File details

Details for the file islet-0.0.3.dev1-py2.py3-none-any.whl.

File metadata

  • Download URL: islet-0.0.3.dev1-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/0.0.0 pkginfo/1.8.2 readme-renderer/27.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.4.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.15

File hashes

Hashes for islet-0.0.3.dev1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9648c70a90952e312796ad2dd18452d792431044e3865973f7a7b116b2f94363
MD5 2ec4b307ba9e61b28d2f21a3a6c90d4f
BLAKE2b-256 7a681d8ff7de5101f363dddad1330edebf2a01c14ae5bcdabfbf46fc4977872f

See more details on using hashes here.

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