Skip to main content

A fabric utility for creating remote virtual environments, and installing and updating packages.

Project description

# fabvenv

A fabric utility for creating remote virtual environments, and installing and
updating packages.

The basic use case this covers is logging into a remote host, downloading
virtualenv.py, using it to create a virtual environment for a project,
including installing `pip`, and then installing packages, based on a
"requirements.txt" file.

## Installation

```
pip install fabvenv
```

## Usage

Here is how I define Fabric tasks to create a virtual environment, install
packages, add a directory to the `sys.path` of the python executable, etc.:

```
@task
def venv_create():
require('configured')
venv = fabvenv.Venv(config.venv, config.requirements)
if not venv.exists():
venv.create(config.system_python)


@task
def venv_install():
require('configured')
fabvenv.Venv(config.venv, config.requirements).install()


@task
def venv_upgrade():
require('configured')
fabvenv.Venv(config.venv, config.requirements).upgrade()


@task
def venv_freeze():
require('configured')
fabvenv.Venv(config.venv, config.requirements).freeze()


@task
def venv_remove():
require('configured')
venv = fabvenv.Venv(config.venv, config.requirements)
if venv.exists():
venv.remove()


@task
def venv_pth():
'''
Add the code directory to the virtualenv sys.path.
'''
require('configured')
fabvenv.Venv(config.venv, config.requirements).venv_pth([config.code])
```

## Contribute

Pull requests and issues are welcomed.

## Testing

The file `tests/fabfile.py` is a basic test of using fabric and fabvenv to
create a virtual environment, install a package, upgrade a package, and remove
the virtual environment.

To run this test, you must have fabric installed, and you must be able to
do passwordless (keypair) ssh into localhost as `$USER`, I assume.

Run the tests as follows:

cd tests/
fab test_fabvenv

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

fabvenv-0.2.0.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file fabvenv-0.2.0.tar.gz.

File metadata

  • Download URL: fabvenv-0.2.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fabvenv-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5babc5fbfce6944f812cc62054ba69304f5c72ed9302d6c137096c54b1e6e440
MD5 1b8457699b3bc4f58224c7e728ef4ed3
BLAKE2b-256 fa79d63912feffb63e36a4453dd2fc4cf43eaea1ad2fcfe3c5140e23fab066e1

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