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 details)

Uploaded Source

Built Distribution

python_gitdb-0.0.4-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file python_gitdb-0.0.4.tar.gz.

File metadata

  • Download URL: python_gitdb-0.0.4.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Darwin/23.2.0

File hashes

Hashes for python_gitdb-0.0.4.tar.gz
Algorithm Hash digest
SHA256 11b346d638533018239ef94a8bc1b674e4a17865eba5a44dc716c5e450c85222
MD5 71a3970699e20d9a21c635a959a384b9
BLAKE2b-256 58430512eb051702c1e04b7543814499f42772efa3efc9819029106c06946974

See more details on using hashes here.

File details

Details for the file python_gitdb-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: python_gitdb-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Darwin/23.2.0

File hashes

Hashes for python_gitdb-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 db2fc4b028abb325864cea1dd1971dfbfc3a0513f5d308df119d5dbd9a11f956
MD5 5d4ebc12390659ba725ddaf4e04abd41
BLAKE2b-256 568cf41c18e522c780d118df2ea806f50d8c747fa4f6c17fcabbe34ac1038633

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