Skip to main content

Simple Python module to use git as key-value database.

Project description

python-gitdb is a small Python module that allows to use a git repository as key-value-store. The data can be serialized by different Serializers.

Attention! The integration of a remote repository is rudimental, i.e., push and pull currently only works via soft resets.

Serializers

There are several serializers provided to store the data:

  • JsonSerializer (included without further modules)

  • BJsonSerializer

  • YamlSerializer

  • MsgPackSerializer

Depending on the selected serializer, the corresponding module must be installed.

Setup

poetry install python-gitdb

Usage

from gitdb import GitDb
from gitdb.serializers.jsonserializer import JsonSerializer

# git repository that is used as database
REPO = "/your/path/to/the/repository"

# prepare the git repository database
gitdb = GitDb(REPO, serializer=JsonSerializer)

# add two entries
gitdb.set("key_a", "test")
gitdb.set("key_b", {"a": 1, "b": 2})

# load two entries
print(gitdb.get("key_a"))
print(gitdb.get("key_b"))

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

python_gitdb-0.0.4.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

python_gitdb-0.0.4-py3-none-any.whl (7.8 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