Skip to main content

Simple Miniature key-value datastore

Project description

kvault

License Tests Lint Docker Version Codacy Badge

kvault is a simple Miniature Key-Value Datastore in Python with a Redis-like interface.

Requirements

  1. Python 3.10+

    Python is the programming language of choice for this project, therefore, will be required to be available in the system. One can download and setup Python in their local development environment following the steps provided in the link.

  2. Poetry

    Poetry is the dependency manager & packaging tool used for this project and can be installed following the setup provided in the link as well.

  3. virtualenv

    Used to create virtual environments for installing & setting up Python dependencies.

Setup

Running locally, will require a virtualenv setup and that can be done by following the instructions:

virtualenv .venv

This will create a virtual environment in the current root directory of the project.

Next, install the required dependencies:

poetry install

This installs the dependencies for the project.

Running

by default, the kvault server runs on localhost:31337.

The following options are supported:

Usage: kvault.py [options]

Options:
  -h, --help            show this help message and exit
  -d, --debug           Log debug messages.
  -e, --errors          Log error messages only.
  -t, --use-threads     Use threads instead of gevent.
  -H HOST, --host=HOST  Host to listen on.
  -m MAX_CLIENTS, --max-clients=MAX_CLIENTS
                        Maximum number of clients.
  -p PORT, --port=PORT  Port to listen on.
  -l LOG_FILE, --log-file=LOG_FILE
                        Log file.
  -x EXTENSIONS, --extension=EXTENSIONS
                        Import path for Python extension module(s).

Note that the above output can be obtained from the below command:

python cli.py -h

To run with debug logging on port 31339, for example:

python kvault.py -d -p 31339

This will result in an output like below:

  .--.
 /( @ >    ,-.  KVault 127.0.0.1:31339
/ ' .'--._/  /
:   ,    , .'
'. (___.'_/
 ((-((-''

This indicates that the server is running and awaiting client connections

Client setup should be simple, in another terminal, open a new Python console to interact with the kvault server:

from client import Client

client = Client()
client.set('key', {'name': 'Charlie', 'pets': ['mickey', 'huey']})

print(client.get('key'))  # {'name': 'Charlie', 'pets': ['mickey', 'huey']}

A sample of the expected interaction of a client and kvault server

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

kvault-0.1.0.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

kvault-0.1.0-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file kvault-0.1.0.tar.gz.

File metadata

  • Download URL: kvault-0.1.0.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for kvault-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a4c588360309b0d0085fb5ea01364549e9349d5638a62a32d9cc760f3e3cc195
MD5 f56aef6e79e0fda32abcf6f06096a24a
BLAKE2b-256 771a82e672090af6c208829d335dfcdceeeca7a1e75737b9b8844bf731c7d0fe

See more details on using hashes here.

File details

Details for the file kvault-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kvault-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for kvault-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 758bebf758cf0ad6c586f8cb8c7ca587081954a043ff3e652d23d1a1a8ede665
MD5 f4874511443375835bf6f7ba9a930cfa
BLAKE2b-256 a9d5ceb304dbe9d90ddca62622fb40749eeb039f6504fa6e2963387761536817

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