Skip to main content

ViperDB

codecov

ViperDB is a lightweight embedded key-value store written in pure Python. It has been designed for being extremely simple while efficient.

Features

  • tiny: the main db file consists of just ~300 lines of code.
  • highly coverage: thanks to the small codebase, every single line of code is tested.
  • log-structured: ViperDB takes design concepts by log-structured databases such as Bitcask.
  • written in pure Python: no external dependency needed.

Database layout

ViperDB simply consists of two files: a key log file and a value log file. The first is used to maintain information about values (e.g. offset, size, etc...) which are actually stored in the value log. This layout allows to speed-up db initialization, which consists in loading the pointers to the entire key-space from the key-file to a dictionary. For simplicity, the key file is treated as a text file, with each line containing a json-encoded entry. The value file is viewed as a raw sequence of bytes. Before being written to the value file, each value is encoded according to the following scheme: builtin types (except for the bytes type) are json-encoded, while user-defined classes are pickled.

To keep logic simple, no automatic compaction is performed in the background: unused space must be reclaimed explicitly through the reclaim function.

API usage

from viperdb import ViperDB

db = ViperDB('./db')
# db can be used as a simple dictionary
db['hello'] = 'ViperDB!'
assert db['hello'] == 'ViperDB'

del db['hello']
assert 'hello' not in db

db.reclaim() # call this method periodically to free unused space.
db.close() # flush any pending write and close the database.

Contribute

ViperDB is a very recent project and, as such, it comes with no warranty. If you find any bug, or have some suggestion, feel free to contribute by opening a new issue or making a pull request.

Metadata

Release files for viperdb 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for viperdb 1.0.0
File Size Uploaded Provenance
viperdb-1.0.0.tar.gz 4.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for viperdb 1.0.0
File Interpreter ABI Platform
viperdb-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / viperdb-1.0.0.tar.gz

Download URL viperdb-1.0.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e0d54080e3f43565cd8a8cc3016b09203b983f2bc13a70badcbe236eb660e7be
BLAKE2b-256 checksum
How to use checksums
10d934aa0dc6c2d2288506872039c1e3f67568463bffcf9ed2e25ac4d24b6159
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

Release files / viperdb-1.0.0-py3-none-any.whl

Download URL viperdb-1.0.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee4a978802aba556c6127f168ed5092d300e43653751625ea39785b153b53196
BLAKE2b-256 checksum
How to use checksums
16f63914f385bd87ff5530b6db3f5757a60b2d749b0a338211eb6d843e1b2d35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

Security for viperdb 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page