Skip to main content

A virtualenv Python discovery plugin for pyenv-installed interpreters

Project description

virtualenv-pyenv

A virtualenv Python discovery plugin for pyenv–installed interpreters

Installation

pip install virtualenv-pyenv

Usage

The Python discovery mechanism can be specified by:

  • the CLI option --discovery:

    virtualenv --discovery pyenv -p 3.10 testenv
    
  • the environment variable VIRTUALENV_DISCOVERY:

    export VIRTUALENV_DISCOVERY=pyenv
    virtualenv -p 3.10 testenv
    
  • the config option discovery:

    [virtualenv]
    discovery = pyenv
    
    virtualenv -p 3.10 testenv
    
  • the virtualenvwrapper environment variable VIRTUALENVWRAPPER_VIRTUALENV_ARGS:

    export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--discovery=pyenv'
    mkvirtualenv -p 3.10 testenv
    

Python Specifier Format

The plugin supports two specifier formats informally called “pyenv-style” and “virtualenv-style”.

The version part of both specifier formats can contain either two (major.minor) or three (major.minor.patch) components. When a two–component version is specified, the latest installed final patch release is selected, ignoring pre–/dev–releases. When a three–component version is specified, the exact final release is selected, ignoring pre–/dev–releases. The pre–/dev–release version is installed only if it is explicitly requested.

installed requested selected
3.9.5; 3.9.17 3.9 3.9.17
3.9.5; 3.9.17 3.9.5 3.9.5
3.9.5; 3.9.17 3.9.0
3.12-dev; 3.12.0b3 3.12
3.12-dev; 3.12.0b3 3.12.0
3.12-dev; 3.12.0b3 3.12-dev 3.12-dev
3.12-dev; 3.12.0b3 3.12.0b3 3.12.0b3

pyenv–style

The same format as used by pyenv (pyenv install --list).

  • a final version with 2 version components: 3.11
  • a final version with 3 version components: 3.11.2
  • a pre–release version: 3.13.0a4, 3.12.0b3, 3.11.0rc1
  • a dev version: 3.13-dev

virtualenv–style

The same format as used by virtualenv (docs). A subset of this format is used by tox (docs).

  • a relative or absolute path: /path/to/bin/python (it can be any Python interpreter, not only installed by pyenv)
  • a final version with 2 version components: 311, py311, py3.11, python311, cpython3.11, python3.11-32, py311-64
  • a final version with 3 version components: py3.11.2, python3.11.2, cpython3.11.2, python3.11.2-32, py3.11.2-64

Limitations

  • Only CPython is supported at the moment.
  • The architecture part (-32/-64) of a specifier is ignored. For example, all of the following specifiers match any installed CPython 3.8.1 regardless of the architecture: python3.8.1, python3.8.1-32, python3.8.1-64.
  • pyenv-win is not supported.

Internals

virtualenv-pyenv does not rely on pyenv to discover Python interpreters, that is, it never calls any pyenv command and does not require pyenv to be in PATH. Instead, the plugin uses pyenv-inspect library, which, in turn, inspects $PYENV_ROOT/versions directory contents.

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_pyenv-0.3.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

virtualenv_pyenv-0.3.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file virtualenv_pyenv-0.3.0.tar.gz.

File metadata

  • Download URL: virtualenv_pyenv-0.3.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for virtualenv_pyenv-0.3.0.tar.gz
Algorithm Hash digest
SHA256 40c5563c7abf71e80587e6ad15894807364bc7d8c3949ca64afdd53e4e2034ab
MD5 4b2f7241aef5e91097f83cf0f00018cf
BLAKE2b-256 bd16d738a0beaf6f9885ffc0ecccb2d1e8a957fbe950b63feaa8ad826a1e4c1c

See more details on using hashes here.

File details

Details for the file virtualenv_pyenv-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for virtualenv_pyenv-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b2ca3a9be99028d1510b7bf18e024ba7e4f80d7070a488b40655ac65f2e7671
MD5 5951ffb316b4f67d3526f22cfc1edfe9
BLAKE2b-256 b3df2a76187f5e65779abf1c37ab9d7d0b36e0272026fa10925f0ebfc070d247

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