Skip to main content

PVG - pip-via-git: Install Python packages directly from Git repositories

Project description

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

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

pvg-0.0.2.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

pvg-0.0.2-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file pvg-0.0.2.tar.gz.

File metadata

  • Download URL: pvg-0.0.2.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pvg-0.0.2.tar.gz
Algorithm Hash digest
SHA256 e220b245f7591a3020166f3a752016000a7936a5bcaeae84d0c5884d0abcc396
MD5 a08cf9838688a91804cfc46c137e36e9
BLAKE2b-256 b34481f3b6b6862a4a144583d0888848450b55a8afb25d4daf4321a5176e5851

See more details on using hashes here.

File details

Details for the file pvg-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pvg-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pvg-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6836d0541d0d8fbf5be61e9bff021fe347b29d7cb52c0fc13dbadc93bba25835
MD5 dce0f580bef0878b21d3510c7c0a756e
BLAKE2b-256 851ffdeb6373165a60d9c89909acbfa4176cc1e9898d1a9e4f01b1952e4225f4

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