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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.