Skip to main content

A virtualenv seeder to seed wheels from a folder

Project description

virtualenv-seedhelper

A virtualenv seeder to seed wheels from a folder

Quick start

Install in system python environment

python3 -m pip install virtualenv-seedhelper

Configure virtualenv to always use seedhelper

seedhelper config

Note that this overwrites virtualenv.ini if it already exists.

Add wheels to SEEDHELPER_WHEELS_DIR one at a time by URL

seedhelper download https://files.pythonhosted.org/packages/f1/13/63c0a02c44024ee16f664e0b36eefeb22d54e93531630bd99e237986f534/cowsay-6.1-py3-none-any.whl

Create a new virtualenv

python3 -m virtualenv venv

Verify that the new virtualenv has the wheels installed in it

$ venv/bin/pip list
Package    Version
---------- -------
cowsay     6.1
pip        23.2.1
setuptools 68.2.2
wheel      0.41.2

What if we want to seed a package with dependencies?

Instead of looking up and downloading wheel URLs one by one, we can use seedhelper require to download the wheels for all the dependencies of a requirement, placing all of their wheels in the SEEDHELPER_WHEELS_DIR so that they all get seeded into newly-created virtualenvs.

seedhelper require requests==2.31.0

After this, we can make a new virtualenv

python3 -m virtualenv venv

and verify that it has all the dependencies installed

$ venv/bin/pip list
Package            Version
------------------ ---------
certifi            2023.7.22
charset-normalizer 3.3.0
idna               3.4
pip                23.2.1
requests           2.31.0
setuptools         68.2.2
urllib3            2.0.7
wheel              0.41.2

and we can import the package in the venv

venv/bin/python -c 'import requests'

Config

SEEDHELPER_WHEELS_DIR

This is where seedhelper will download wheels to. It defaults to ~/Library/Application Support/virtualenv/seedhelper_wheels (or the corresponding location on your specific platform as provided by platformdirs.user_config_dir()). You can override it by setting an environment variable called SEEDHELPER_WHEELS_DIR.

VIRTUALENV_CONFIG_FILE

This is where virtualenv (and seedhelper) will look for virtualenv.ini. It defaults to ~/Library/Application Support/virtualenv/virtualenv.ini (or the corresponding location on your specific platform as provided by platformdirs.user_config_dir()). You can override it by setting an environment variable called VIRTUALENV_CONFIG_FILE.

Motivation

The goal is to make it possible to include a set of wheels in every virtualenv created. This is especially useful when the system-wide pip configuration assumes that certain packages, such as keyring backends needed to interact with a private package index, will always be available before pip runs. Without a seeder, you cannot use pip to install the keyring because pip itself needs the keyring to be already installed in order to function at all.

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

virtualenv-seedhelper-0.0.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

virtualenv_seedhelper-0.0.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file virtualenv-seedhelper-0.0.1.tar.gz.

File metadata

  • Download URL: virtualenv-seedhelper-0.0.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for virtualenv-seedhelper-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2ba0699cab9f5adea88602c90e5df600c16e1eeb049af2b832473586443a47e9
MD5 557f12d7edd68556079a61b7cb3ce8d9
BLAKE2b-256 8fe4836c290abbab7c6f442715f28d43e0275f1c59c58a19ec4c62d573c965b4

See more details on using hashes here.

File details

Details for the file virtualenv_seedhelper-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for virtualenv_seedhelper-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 115e8f0d3528586c9d2f9a91f34823912421341430133380e45785542e231eda
MD5 a67d108eaede1d2a093ebe6f7eaad04e
BLAKE2b-256 455c8148fc327ecb5492aeec89c58966ff9825afb1498f8805293a20fd475ac3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page