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=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=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=False,        # default
    use_urllib=False,   # default: True uses urllib alternative route
)
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=True to download even when the local output appears aligned
  • set use_urllib=True to use the urllib alternative transport path
  • 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.3.tar.gz (9.0 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.3-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gitstore-0.2.3.tar.gz
  • Upload date:
  • Size: 9.0 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.3.tar.gz
Algorithm Hash digest
SHA256 6608a44f4fd506d3c7513de91681ff6354c790fc844f319080f1c4a6d5b8c664
MD5 a2031ccc2c1721d05f953040ae493717
BLAKE2b-256 ca2a871c1fc47c2b6b587d0b589058b8a7f549032c42a1800ae57adede78c8ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gitstore-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 8.5 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9d989fb6589f52bca1fa4e8bd08602bac554bdeed49f3991e3050c8d70d6b179
MD5 8bbb1364fb403814fbfd825c7788ad75
BLAKE2b-256 42328fec83188257d7a7af70ff6d6740b62fca93ccaee1da8adc48adc0fed0e7

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