Skip to main content

PVG - pip-via-git

A command-line tool for installing Python packages directly from Git repositories.

Installation

To install the tool for development:

pip install -e .

Requirements

  • Git must be installed and accessible from the command line
  • Python 3.8 or higher
  • pip
  • SSH key configured with GitHub (if using SSH URLs)

Usage

There are several ways to install packages:

Using GitHub repository names

Install a package from GitHub using HTTPS (default):

pvg install username/repository

Install a package using SSH:

pvg install --use-ssh username/repository

Force a fresh clone (deleting cached version if it exists):

pvg install --force username/repository

Using direct Git URLs

You can also use any Git URL directly:

# Using HTTPS URL
pvg install https://github.com/username/repository.git

# Using SSH URL
pvg install git@github.com:username/repository.git

# Using other Git URLs
pvg install https://gitlab.com/username/repository.git
pvg install git://git.example.com/repository.git

Managing the Cache

List all cached repositories and their metadata:

pvg list-cache

Clean all cached repositories:

pvg clean-cache

Examples

Install Click from GitHub using repository name:

pvg install pallets/click

Install Click using direct HTTPS URL with force flag:

pvg install --force https://github.com/pallets/click.git

How it works

The install command:

  1. Accepts either a GitHub repository name or a complete Git URL
  2. For GitHub repository names:
    • Converts them to HTTPS or SSH URLs based on the --use-ssh flag
  3. For Git URLs:
    • Uses the URL as-is without modification
  4. Manages the repository in the cache (~/.pvg-cache/):
    • Creates a unique directory based on the URL's hash
    • Stores metadata in meta.json
    • Clones the repository into the repo subdirectory
    • If it exists: Pulls latest changes (unless --force is used)
    • If --force is used: Deletes and clones fresh
  5. Runs pip install -e . in the cached repository

Commands

  • pvg install [OPTIONS] <package>: Install a Python package from a Git repository
    • <package>: Can be either a GitHub repository name (e.g., username/repository) or a complete Git URL
    • --use-ssh: Optional flag to use SSH URL instead of HTTPS when using GitHub repository names
    • --force: Optional flag to force delete and clone the repository even if it exists in cache
  • pvg list-cache: List all cached repositories and their metadata
  • pvg clean-cache: Clean the package cache directory (~/.pvg-cache)

Cache Directory Structure

The cache is organized in ~/.pvg-cache/ as follows:

~/.pvg-cache/
├── <url-hash-1>/
│   ├── meta.json    # Contains git URL and timestamps
│   └── repo/        # The actual git repository
├── <url-hash-2>/
│   ├── meta.json
│   └── repo/
└── ...

The cache can be:

  • Updated automatically when installing (git pull)
  • Inspected using the list-cache command
  • Cleaned manually using the clean-cache command
  • Bypassed using the --force flag during installation

Metadata

Release files for pvg 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pvg 0.0.2
File Size Uploaded
pvg-0.0.2.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pvg 0.0.2
File Interpreter ABI Platform
pvg-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.5 kB

Release files / pvg-0.0.2.tar.gz

Download URL pvg-0.0.2.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e220b245f7591a3020166f3a752016000a7936a5bcaeae84d0c5884d0abcc396
BLAKE2b-256 checksum
How to use checksums
b34481f3b6b6862a4a144583d0888848450b55a8afb25d4daf4321a5176e5851
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release files / pvg-0.0.2-py3-none-any.whl

Download URL pvg-0.0.2-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6836d0541d0d8fbf5be61e9bff021fe347b29d7cb52c0fc13dbadc93bba25835
BLAKE2b-256 checksum
How to use checksums
851ffdeb6373165a60d9c89909acbfa4176cc1e9898d1a9e4f01b1952e4225f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page