Skip to main content

Lightweight virtualenv orchestration

Project description

This project helps provision virtualenvs and dependencies for your Python code. It works like tox or nox, but your requirements are declared in your script.

Credit to the nox project for much of the implementation.

Installation

Use pip:

pip install --user xox

Usage

Before you import any other third-party modules, call xox.activate():

import xox

xox.activate("lxml", "requests>=1.0")

import lxml
import requests

This will create a virtualenv, install packages, and call os.exec() to replace the current process. The virtualenv will be re-used in subsequent runs.

You could also pass python='pythonX.Y' to specify a Python version, or silent=False to show output from pip.

… And that’s it! No custom executables or config files needed, just an extra header in your script.

Notes

Any code before your activate() call will be run twice: once without and once within the virtualenv. Any code after your activate() call will run only within the virtualenv.

Each virtualenv is stored in a subdirectory of system’s temporary directory named 'xox-virtualenvs'. No cleanup mechanism is provided - sorry!

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

xox-0.1.1.tar.gz (2.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page