• This repository has been archived on 04/Feb/2019
  • Stars
    star
    115
  • Rank 305,916 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Combine your Python virtualenvs.

envplus

Combine your Python virtualenvs into unlimited configurations.

Developed at BuzzFeed.

Why Combine Virtualenvs?

Most of my projects are modular in nature. Yours probably are too. The large bulk of my projects involve some combination of:

  • Web-scraping and data-fetching
  • Data analysis
  • Web development

For each of these tasks, I've found a set of Python libraries that fit my needs well. Rather than download and install SciPy for the nth time, wouldn't it be nice just to build on top of already-installed versions? Enter envplus.

How It Works

envplus takes advantage of Python's .pth file convention. It creates (and manipulates) a special file, _envplus.pth, in the site-packages directory of your current virtualenv.

Installation

pip install envplus

Walkthrough

If you're like me, a lot of your projects involve fetching and parsing web pages. So let's build a virtualenv that contains a handy trio of packages for this task.

mkvirtualenv scraping
pip install requests
pip install lxml
pip install cssselect

For a lot of projects, you'll probably also want to store information in some sort of database. Let's make a bare-bones virtualenv for this task, too.

mkvirtualenv dbstorage
pip install dataset

Now let's say you're working on a project to scrape cat GIFs from BuzzFeed and store them in a database. Rather than reinstall all the packages above, you can just do this:

mkvirtualenv buzzcats
envplus add scraping dbstorage

Now you can use requests, lxml, cssselect, and dataset in your buzzcats virtualenv. The actions you take in the buzzcats virtualenv will not harm or alter your other virtualenvs. (Even if you run pip uninstall.) And upgrades to scraping and other envplus add'ed virtualenvs will become immediately available to buzzcats.

Usage

To use envplus, virtualenvwrapper must be installed and your target virtualenv must be currenlty activated.


envplus add [envs]

Make another virtualenv's packages available to your current virtualenv. Accepts multiple, space-separated virtualenv names.

envplus add scraping dbstorage

envplus rm [envs]

Remove a previously added virtualenv from your current virtualenv. Accepts multiple, space-separated virtualenv names.

envplus rm scraping dbstorage

envplus pause [envs]

"Pauses" previously added virtualenvs, so that they remain in _envplus.pth (as commented lines) but do not effect the current virtualenv. If virtualenv names are provided, only those are paused. Otherwise, all previously added virtualenvs are paused.

# To pause all
envplus pause
# To pause just one
envplus pause dbstorage

envplus resume [envs]

Un-pauses previously added virtualenvs. If virtualenv names are provided, only those are resumed. Otherwise, all previously added virtualenvs are resumed.

# To resume all
envplus resume
# To resume just one
envplus resume dbstorage

envplus ls [-p] [-a]

List added virtualenvs. By default, lists only non-paused additions. -p will list only paused additions, and -a will list all additions.


envplus run [command]

Temporarily adds your virtualenvs' bin-paths to your current PATH before running command. Lets you use other virtualenvs' command-line programs.

# Create a dummy virtualenv with csvkit
mkvirtualenv csvtest
pip install csvkit

# Create newenv and add csvtest
mkvirtualenv newenv
envplus add csvtest

# While in newenv, run csvkit's csvcut command-line utility
echo "a,b,c" | envplus run csvcut -c 2

envplus path

Print the path of the active virtualenv's _envplus.pth file.

envplus path

envplus cat

Print the contents of the active virtualenv's _envplus.pth file.

envplus cat

envplus edit

Open the active virtualenv's _envplus.pth file in your default editor. You probably shouldn't do this. Mostly for debugging purposes.

envplus edit

Todos

  • Add tests.
  • Test on wider variety of systems and virtualenv(wrapper) versions.

More Repositories

1

pdfplumber

Plumb a PDF for detailed information about each char, rectangle, line, et cetera β€”Β and easily extract text and tables.
Python
6,285
star
2

markovify

A simple, extensible Markov chain generator.
Python
3,292
star
3

waybackpack

Download the entire Wayback Machine archive for a given URL.
Python
2,841
star
4

nbpreview

Render Jupyter/IPython notebooks without running a notebook server.
CSS
289
star
5

notebookjs

Render Jupyter/IPython notebooks on the fly, in the browser. (Or on the command line, if you'd like.)
JavaScript
272
star
6

spectra

Easy color scales and color conversion for Python.
Python
257
star
7

weightedcalcs

Pandas-based utility to calculate weighted means, medians, distributions, standard deviations, and more.
Python
103
star
8

reporter

Literate data analysis with iPython notebooks and Jekyll.
Ruby
92
star
9

twick

Twitter, quick. Fetch and store tweets on short notice.
Python
80
star
10

intro-to-visidata

Source files for "An Introduction to VisiData"
HTML
70
star
11

visidata-plugins

A place for me to share VisiData plugins I've written.
Python
36
star
12

mplstyle

A simple API for setting matplotlib styles, as well as a repository of nice styles.
Python
32
star
13

visidata-cheat-sheet

A one-page cheat sheet for VisiData, available in multiple languages.
HTML
26
star
14

gekyll

A Jekyll plugin for using Git repositories as posts, giving you access to a post's commits, diffs, and more.
Ruby
25
star
15

nbexec

A dead-simple tool for executing Jupyter notebooks from the command line.
Python
20
star
16

Backbone.Table

Render any Backbone.js Collection as an HTML table.
JavaScript
20
star
17

buzzfeed-news-trending-strip

Dataset: BuzzFeed News β€œTrending” Strip, 2018–2023
Python
19
star
18

tab-bankrupter

A Chrome extension for declaring "tab bankruptcy" without losing all your links.
JavaScript
18
star
19

astronomer

Fetch information about the users who've starred a given GitHub repository.
Python
17
star
20

txtbirds

β€Ύβ€Ύ\/β€Ύβ€Ύ
JavaScript
14
star
21

tinyapi

Python wrapper around TinyLetter's publicly accessible β€” but undocumented β€” API.
Python
13
star
22

fbpagefeed

A library and command-line tool for fetching Facebook Pages' published posts.
Python
12
star
23

virtualenv-recipes

Recipes for useful Python virtualenvs.
Shell
12
star
24

data-tactics

Half-baked idea: Conceptual building blocks for data analysis.
11
star
25

tinystats

Command-line tool for fetching message, URL, and subscriber data for the TinyLetter newsletters you own.
Python
11
star
26

vinejs

Somewhere between a total joke and a useful library for fetching Vine.co videos.
JavaScript
11
star
27

nicar-2024-pdfplumber-workshop

Jupyter Notebook
11
star
28

mta-colors

CSS & JSON files to help developers use the official colors of New York's Metropolitan Transportation Authority.
CSS
10
star
29

compleat

Fetch autocomplete suggestions from Google Search.
Python
9
star
30

google-table-converter

A browser-based tool for converting Google Spreadsheets into responsive HTML <table>s.
HTML
9
star
31

lede-2023

Jupyter Notebook
8
star
32

nicar-2015-schedule

NICAR 2015 conference schedule as CSV and JSON, plus the underlying Python scraper.
Python
8
star
33

gifparse

[Work in progress.] Parse the GIF 89a file format, down to the minor details. Pure Python, no dependencies.
Python
8
star
34

WRIT1-CE9741

WRIT1-CE9741, Fall 2013, NYU School of Continuing and Professional Studies
Ruby
6
star
35

nicar-2023-pdfplumber-workshop

Jupyter Notebook
6
star
36

csvcat

Efficiently concatenate CSVs (or other tabular text files), stripping extra header lines.
Shell
6
star
37

nicar-2017-schedule

NICAR 2017 conference schedule as JSON and CSV, plus the underlying Python scraper.
Python
6
star
38

babynames

CSVs and parsers for the Social Security Administration's historical baby name data.
Python
5
star
39

minicard

A bare-bones CSS stylesheet for creating "card"-style elements.
CSS
4
star
40

macmailer

Command-line utility and Ruby library for creating/sending messages in OSX's Mail.app program.
Ruby
4
star
41

nicar-now

Your unofficial guide to what's happening next at NICAR 2020.
3
star
42

text-toggle

Let readers toggle between two versions of a text.
JavaScript
3
star
43

fidget

Fidget.js is a small, configurable JavaScript library that resizes blocks of text to fit their containers.
JavaScript
3
star
44

statusfiles

IDEA: A simple, structured, standardized, technology-agnostic way to represent the status of things.
3
star
45

nicar-2018-schedule

Your unofficial guide to what's happening next at NICAR 2018.
Python
3
star
46

glat-glong

Find the precise latitude and longitude of any point on Google Maps. A Chrome extension.
JavaScript
3
star
47

lede-2024

Jupyter Notebook
3
star
48

gmap-button

A JavaScript library for adding buttons to embedded Google Maps.
JavaScript
2
star
49

crochet

Hook into and/or monkeypatch any Ruby class- or instance-method. Provides 'before' and 'after' hooks, plus their destructive evil twins.
Ruby
2
star
50

jub

As in, "get the jub done." Or as in, "jQuery, Underscore, Backbone." It's a shell script that automatically grabs the latest versions of those libraries, so that you can get on with prototyping.
Shell
2
star
51

download-all-attachments-from-a-gmail-conversation

Two methods that *seem* to work...
1
star
52

fbiter

A simple library for iterating through paginated Facebook API endpoints.
Python
1
star
53

weddingroulette

The code behind http://weddingroulette.com/
Ruby
1
star
54

jekyll-auto-s3

Automatically sync your Jekyll project to S3 on every (re)build.
Ruby
1
star
55

griddle

Griddle.js is lightweight tool for creating and manipulating programmable, fluid, shift-able grids.
JavaScript
1
star
56

linstapaper

Article-list and site files for linstapaper.com
JavaScript
1
star
57

nbtemplate

Render iPython notebooks to other layouts, via templates. Library and command-line tool.
Python
1
star
58

nicar-2019-schedule

The NICAR 2019 conference schedule as JSON and CSV files, plus the underlying Python scraper.
Python
1
star
59

parabear

An experiment in stupid-simple HTML article text extraction.
JavaScript
1
star