Skip to main content

Utilities to encrypt files/directories with utilitz and exchange them through GitHub repositories.

Project description

gitstore

gitstore is a focused Python package for one goal:

  • upload encrypted files/folders to a GitHub-backed repo
  • download and restore encrypted GitHub files later

Installation

pip install gitstore

Dependency on utilitz

This project depends on:

  • utilitz[crypto]
  • requests

Project Structure

gitstore/
  src/gitstore/
    __init__.py
    client.py
    config.py
    crypto_ops.py
    github_ops.py
  pyproject.toml
  README.md

Core API

from gitstore import upload_to_github, restore_from_github, restore_from_file

Upload

from gitstore import upload_to_github

record = upload_to_github(
    source_path="C:/data/documento.pdf",  # file or directory
    name="documento_ventas_q2",           # logical name only
    repo_path="C:/repos/my-publish-repo", # required
    password=None,                        # default: uses GITSTORE_PASSWORD
    vault_dir="vault",                    # default
    request_timeout=60,                   # default
    security_level="high",                # default
    replace_existing=True,                # default
    force_upload=False,                   # default
    commit_message=None,                  # default: automatic message
)
print(record)

Upload behavior:

  • computes source_hash from source content before encryption
  • skips upload if same name already has same source_hash
  • set force_upload=True to upload even when the current source matches the remote metadata
  • stores artifact as vault/<name>.asc
  • stores metadata in vault/index.json
  • removes temporary encrypted file after processing

Valid Names

name is the logical identifier used to upload an artifact. It is intentionally strict to keep Git paths predictable:

  • allowed characters: letters, numbers, dots, underscores, and hyphens
  • must start with a letter or number
  • spaces and path separators are not allowed

Valid examples:

documento_ventas_q2
maindb-version-0.1
backup.2026_05

Invalid examples:

maindb -version 0.1
../secret
folder/documento

Download

from gitstore import restore_from_github

output_path = restore_from_github(
    github_raw_url="https://raw.githubusercontent.com/USER/REPO/main/vault/documento_ventas_q2.asc",
    password=None,      # default: uses GITSTORE_PASSWORD
    output_path=None,   # default: restores in the current working directory
    overwrite=False,    # default
    force_download=False, # default
)
print(output_path)

Local restore (no network):

from gitstore import restore_from_file

output_path = restore_from_file(
    encrypted_file_path="C:/downloads/documento_ventas_q2.asc",
    password=None,      # default: uses GITSTORE_PASSWORD
    output_path=None,   # optional
    overwrite=False,    # default
)
print(output_path)

Tip:

  • use restore_from_file(...) when the target machine has SSL/certificate restrictions and you prefer manual transfer of the .asc file.

Download behavior:

  • expects RAW GitHub URLs (raw.githubusercontent.com/...) as primary input
  • also accepts github.com/.../blob/... and normalizes automatically
  • skips download when output_path already exists and matches the remote source_hash in vault/index.json
  • set force_download=True to download even when the local output appears aligned
  • downloads the encrypted .asc file to a temporary location
  • restores files or directories automatically with utilitz.crypto
  • removes the temporary encrypted file after restore
  • supports local decode with restore_from_file(...) when manual download is preferred

Password Source

upload_to_github, restore_from_github, and restore_from_file auto-detect password from:

  • GITSTORE_PASSWORD

If password is not passed, the environment variable is used.

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

gitstore-0.2.2.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitstore-0.2.2-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file gitstore-0.2.2.tar.gz.

File metadata

  • Download URL: gitstore-0.2.2.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for gitstore-0.2.2.tar.gz
Algorithm Hash digest
SHA256 99955d9034c1ee8b98da6dd6315e3a8bcc9b820a424d3ab24ff436664f83234f
MD5 fbbaf270ccbe5fd2f571ffa9b36aa8c7
BLAKE2b-256 47bbc3f0efd2a5ab059c3cebf318b0447de7fd263a73da756d17c2e6260e3223

See more details on using hashes here.

File details

Details for the file gitstore-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: gitstore-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for gitstore-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a533bbd812de923c7ca0b1c5a05109b5155a7af46a598f3634426bc926f98606
MD5 9b2769d68fbef9aa374d2c3cf006ed72
BLAKE2b-256 1d460b9a21142ac4f7a9064fdad30794be9731cc953fef9ea4726d384aa0c897

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page