gitblobts
gitblobts is an experimental Python package for git-backed time-indexed blob storage.
Even so, a lock-in of the stored files with git is avoided.
If encryption is not enabled, a lock-in of the file contents with this application is also avoided.
Its goal is to ensure availability of data both locally and remotely. It stores each blob as a file in a preexisting local and remote git repository. Each filename contains an encoded nanosecond timestamp and format version number.
Given the pull and push actions of git, collaborative use of the same remote repo is supported. To prevent merge conflicts, there is a one-to-many mapping of timestamp to filenames. This is accomplished by including sufficient random bytes in the filename to ensure uniqueness.
Subsequent retrieval of blobs is by a time range. At this time there is no implemented method to remove or overwrite a blob; this is by design. From the perspective of the package, once a blob is written, it is considered read-only. An attempt to add a blob with the same timestamp as a preexisting blob will result in a new blob.
An effort has been made to keep third-party package requirements to a minimum.
Links
- Code: https://github.com/impredicative/gitblobts/
- Docs: https://gitblobts.readthedocs.io/
- Release: https://pypi.org/project/gitblobts/
Installation
Using Python 3.7+, install the package from PyPI: pip install -U gitblobts.
Usage examples
Storage
from typing import Optional
import datetime, gitblobts, json, time, urllib.request
optional_compression_module_name: Optional[str] = [None, 'bz2', 'gzip', 'lzma'][2]
optional_user_saved_encryption_key: Optional[bytes] = [None, gitblobts.generate_key()][1]
store = gitblobts.Store('/path_to/preexisting_git_repo',
compression=optional_compression_module_name, key=optional_user_saved_encryption_key)
store.addblob('a byte encoded string'.encode())
store.addblob(b'some bytes' * 1000, timestamp=time.time())
store.addblob(blob=json.dumps([0, 1., 2.2, 3]).encode(),
timestamp=datetime.datetime.now(datetime.timezone.utc).timestamp())
store.addblob(blob=urllib.request.urlopen('https://i.imgur.com/3GmPd7O.png').read())
store.addblobs(blobs=[b'first blob', b'another blob'])
store.addblobs(blobs=[b'A', b'B'], timestamps=[time.time(), time.time()])
Retrieval
from typing import List
from gitblobts import Blob, Store
import time
store = Store('/path_to/preexisting_git_repo', compression='gzip', key=b'JVGmuw3wRntCc7dcQHJ5q1noUs62ydR0Nw8HpyllKn8=')
blobs: List[Blob] = list(store.getblobs(pull=False))
blobs_bytes: List[bytes] = [b.blob for b in blobs]
timestamps: List[float] = [b.timestamp for b in blobs]
blobs2_ascending: List[Blob] = list(store.getblobs(start_time='midnight yesterday', end_time='now'))
blobs2_descending: List[Blob] = list(store.getblobs(start_time='now', end_time='midnight yesterday', pull=True))
blobs3_ascending: List[Blob] = list(store.getblobs(start_time=time.time() - 86400, end_time=time.time(), pull=True))
blobs3_descending: List[Blob] = list(store.getblobs(start_time=time.time(), end_time=time.time() - 86400))
Metadata
Release files for gitblobts 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gitblobts-0.0.7.tar.gz | 12.5 kB | Without provenance | Details for gitblobts-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gitblobts-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for gitblobts-0.0.7-py3-none-any.whl |
Total release size: 36.9 kB
Release files / gitblobts-0.0.7.tar.gz
| Download URL | gitblobts-0.0.7.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39aea611f43bd6cb4176f10b8e2dac429d844c3c8593449b0e05d50e4c4eb7ed
|
|
BLAKE2b-256 checksum How to use checksums |
103cbc670f5d98ece07229ddde7539a76033ccbd40dba8b57f4d01ceff5ad2fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2
|
Release files / gitblobts-0.0.7-py3-none-any.whl
| Download URL | gitblobts-0.0.7-py3-none-any.whl |
|---|---|
| Size | 24.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4daef8707264fc30cc07812df93ae4146ce46ab49b560ab57419e72057984f72
|
|
BLAKE2b-256 checksum How to use checksums |
8d71000769f7903060abae0971fd304b1ffab636e6622862eef3f8fac5011ee8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2
|
Security for gitblobts 0.0.7
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.