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_url="https://github.com/USER/REPO/blob/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:

  • accepts normal GitHub file URLs (github.com/.../blob/...) and raw URLs
  • 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.1.tar.gz (8.7 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.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gitstore-0.2.1.tar.gz
  • Upload date:
  • Size: 8.7 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.1.tar.gz
Algorithm Hash digest
SHA256 9a47320f0c5a9621a6da3aea82ae949dbf8018209b2cfa075c08baad60e5993f
MD5 28821318fc0dce9419f709098193c53d
BLAKE2b-256 e99b2ad2c36e53104c81d0a513fa999c1a272c607ab9edece4a01141a464c7b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gitstore-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82ae10137b86c7c099fa326ca5365296cc2dfe4a9c5be94d192cacda46bbaed9
MD5 51795cae3f4359f2dfcbd4ffd4ebc0f8
BLAKE2b-256 7f439927b94b14235d2ad8f2c4bf941c1ac438b444c89736a83f6c5f5c58d598

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