Skip to main content

Python bindings for Vegh - The Snapshot Tool.

Project description

🥬 PyVegh

PyVegh is the official Python binding for the Vegh snapshot engine, developed by CodeTease.

It delivers the raw performance of Rust (Zstd multithreaded compression, Tar archiving, Blake3 hashing) wrapped in a modern, flexible Python interface.

"Tight packing, swift unpacking, no nonsense."

Features

  • Blazing Fast: Core logic is implemented in Rust using PyO3, utilizing Zstd Multithreading and the next-gen Blake3 hashing algorithm.
  • AI-Ready Context: Generate clean, token-optimized XML prompts for ChatGPT/Claude in milliseconds.
  • Analytics Dashboard: Instantly visualize your project's Lines of Code (LOC) with a beautiful terminal dashboard, no extraction required.
  • Dry-Run Mode: Simulate snapshot creation to check file sizes and detect sensitive data risks before packing.
  • Integrity v2: Verify data integrity at lightning speed with Blake3 and inspect metadata (author, timestamp, tool version) without unpacking.
  • Smart Upload: Built-in send command supporting concurrent Chunked Uploads for large files.
  • Smart Filtering: Automatically respects .veghignore and .gitignore rules.
  • Vegh Hooks: Allow you to custom automation shell command while snapping.
  • Deep Inspection: Peek into files (cat) and compare snapshots (diff) without unpacking.

Installation

Install directly from PyPI:

pip install pyvegh

Or build from source (requires Rust):

maturin develop --release

CLI Usage

PyVegh provides a powerful command-line interface via the vegh (or pyvegh) command.

1. Configuration

Set up your default server URL and Auth Token so you don't have to type them every time.

vegh config
# Or one-liner:
vegh config send --url https://api.teaserverse.online/test --auth YOUR_TOKEN

# List current configuration
vegh config list

# Reset configuration to defaults
vegh config reset

2. Create Snapshot

Pack a directory into a highly compressed snapshot.

# Basic snapshot
vegh snap ./my-project --output backup.vegh

# Dry-Run (Simulation) - Check for large/sensitive files
vegh snap ./my-project --dry-run

3. LOC

View the Analytics Dashboard to break down your project by language and lines of code.

vegh loc backup.vegh

# Show Source Lines of Code (SLOC) instead of total LOC
# Excludes blank lines and comments
vegh loc backup.vegh --sloc

4. Prompt

Generate a structured XML context of your codebase to feed directly into ChatGPT, Claude, or Gemini.

# Generate XML context to stdout
vegh prompt .

# Clean Mode (Recommended):
# Removes lock files (package-lock.json, Cargo.lock), logs, secrets and other unnecessary files.
vegh prompt . --clean

# Copy to Clipboard (One-shot):
vegh prompt . --clean --copy

# Save to file
vegh prompt . --clean --output context.xml

5. Prune

Clean up old snapshots to free disk space.

# Keep only the 5 most recent snapshots in the current directory
vegh prune --keep 5

# Force clean without confirmation (useful for CI/CD)
vegh prune --keep 1 --force

6. Check

Check file integrity (Blake3) and view embedded metadata.

vegh check backup.vegh

7. Restore

Restore the snapshot to a target directory. Supports Partial Restore.

# Full restore
vegh restore backup.vegh ./restored-folder

# Partial restore (Specific files or folders)
vegh restore backup.vegh ./restored-folder --path src/main.rs --path config/

# Flatten directory structure (Extract files directly to output dir)
vegh restore backup.vegh ./restored-folder --flatten

8. Cat & Diff

Inspect content without extracting.

# View a file's content inside the snapshot
vegh cat backup.vegh src/main.rs

# View raw content (Useful for piping binary files)
vegh cat backup.vegh image.png --raw > extracted_image.png

# Compare snapshot with a directory
vegh diff backup.vegh ./current-project

9. Send

Send the snapshot to a remote server. Supports Chunked Uploads for reliability.

# Auto-detects if chunking is needed, or force it:
vegh send backup.vegh --force-chunk

10. Doctor

Check your environment and installation health.

vegh doctor

11. Hooks example

Create a .veghhooks.json in your workspace.

{
  "hooks": {
    "pre": [
      "echo '🚀 Pre-snap hook started...'",
      "echo 'Preparing to backup...'",
      "echo 'Backing up database...'",
      "echo 'Backup completed.'"
    ],
    "post": [
      "echo '🎉 Snapshot completed!'",
      "echo 'Cleaning up...'"
    ]
  }
}

Library Usage

You can also use PyVegh as a library in your own Python scripts:

import json
from vegh import create_snap, restore_snap, check_integrity, get_metadata

# 1. Create a snapshot
# Returns the number of files compressed
count = create_snap("src_folder", "backup.vegh", comment="Automated backup")
print(f"Compressed {count} files.")

# 2. Check integrity (Now uses Blake3)
checksum = check_integrity("backup.vegh")
print(f"Blake3 Hash: {checksum}")

# 3. Read Metadata (Fast, no unpacking)
raw_meta = get_metadata("backup.vegh")
meta = json.loads(raw_meta)
print(f"Snapshot created by: {meta.get('author')}")

# 4. Restore
restore_snap("backup.vegh", "dest_folder")

License

This project is under the MIT License.

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

pyvegh-0.6.0.tar.gz (52.4 kB view details)

Uploaded Source

Built Distributions

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

pyvegh-0.6.0-pp311-pypy311_pp73-manylinux_2_24_x86_64.whl (1.6 MB view details)

Uploaded PyPymanylinux: glibc 2.24+ x86-64

pyvegh-0.6.0-cp38-abi3-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.8+Windows x86-64

pyvegh-0.6.0-cp38-abi3-manylinux_2_24_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.24+ x86-64

pyvegh-0.6.0-cp38-abi3-manylinux_2_24_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.24+ ARM64

pyvegh-0.6.0-cp38-abi3-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

pyvegh-0.6.0-cp38-abi3-macosx_10_12_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file pyvegh-0.6.0.tar.gz.

File metadata

  • Download URL: pyvegh-0.6.0.tar.gz
  • Upload date:
  • Size: 52.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyvegh-0.6.0.tar.gz
Algorithm Hash digest
SHA256 dfb87645d5cfd3e8406bf43e7989b614af7a40584869d7f35d4dbb0ebe830c67
MD5 c30806ace7aa67cc0035d0dd32975e65
BLAKE2b-256 c13baf99f72267d825cb008ef21c4ac504d3ad021dab01d861e399f16e706919

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvegh-0.6.0.tar.gz:

Publisher: release.yml on CodeTease/pyvegh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvegh-0.6.0-pp311-pypy311_pp73-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for pyvegh-0.6.0-pp311-pypy311_pp73-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f0f25aaabe52709bd896573e2ea3b916f86612ab0901b7db59ea9ece4729d2c4
MD5 78244d070bbced29bf9dbfe8d0d3a3cc
BLAKE2b-256 f084b9e61adf4d725a34bd4946f13fd9495c01f59457fabd63ea906d39385718

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvegh-0.6.0-pp311-pypy311_pp73-manylinux_2_24_x86_64.whl:

Publisher: release.yml on CodeTease/pyvegh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvegh-0.6.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: pyvegh-0.6.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyvegh-0.6.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 cf73b65d2c28e314286e5b43223c594b0e09cbc946d7ce3495e951de27b7979f
MD5 96d8df1b16bc6ab5330b4c94dff6c4b6
BLAKE2b-256 2053e8d2126f34ad4b28706a107e53fdce4fe30605a1a7149695758d021e041b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvegh-0.6.0-cp38-abi3-win_amd64.whl:

Publisher: release.yml on CodeTease/pyvegh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvegh-0.6.0-cp38-abi3-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for pyvegh-0.6.0-cp38-abi3-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 0fa15642e99c916f947878bb8067955b9e6617163f4b376de8308fe548e096e7
MD5 c438faeeac539bfe3290e6c1a82ffb1a
BLAKE2b-256 39e530d4d30be9c4daadbd122c47b5a08f5efc7cccb6cf20d9dcf7f30f1fe778

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvegh-0.6.0-cp38-abi3-manylinux_2_24_x86_64.whl:

Publisher: release.yml on CodeTease/pyvegh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvegh-0.6.0-cp38-abi3-manylinux_2_24_aarch64.whl.

File metadata

File hashes

Hashes for pyvegh-0.6.0-cp38-abi3-manylinux_2_24_aarch64.whl
Algorithm Hash digest
SHA256 ee74718ab420156064714aa9dadc26dd64c4b933677c4c0a292c90f99e26f368
MD5 8893f51f1e2c58959849cec54d1b8014
BLAKE2b-256 474ffcee13bb8660907e2c396d9ca6cdc94b5ef150cc4d0c0ab52447c3b0de02

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvegh-0.6.0-cp38-abi3-manylinux_2_24_aarch64.whl:

Publisher: release.yml on CodeTease/pyvegh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvegh-0.6.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyvegh-0.6.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 50d7f3bfa204a5755bfeab7b9f67b654224c0213da9f19f299de22931b29db4f
MD5 acf1342ff4e84fb7db09a73609bf89d9
BLAKE2b-256 39bee7bbedb6dc52b9835023dde8cfd1f63b68ec9198ca810b0285dcd68f7b74

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvegh-0.6.0-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on CodeTease/pyvegh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvegh-0.6.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyvegh-0.6.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 bbabcb857f8935fe83cd17b1f8af10238dfe995fcbbdbb6675860fabc20829a7
MD5 f18407ba513681dac5d49b3960bb5bb9
BLAKE2b-256 e7bcd81e587931283c368251a9a7b1770c350ef74c4daed78acb47be1b7c28eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvegh-0.6.0-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on CodeTease/pyvegh

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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