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 details)

Uploaded Source

File details

Details for the file xox-0.1.1.tar.gz.

File metadata

  • Download URL: xox-0.1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.46.1 CPython/2.7.17

File hashes

Hashes for xox-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ea6ec1a684ec5def1984bc65a1b9d35eabf208c68986d4cc17f06514dd3bf356
MD5 07f7a7678b92c59e6b592abffe21d205
BLAKE2b-256 c87fa78f0f404a89aa25d18bc56839b99ff23083007d98fa672a837908ada0fa

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