Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-python programs in a virtualenv

I just started using virtualenv to develop my Django applications and I really like it so far. One question that came up now is how I install programs, that are non-python, into my virtualenv.

I have for example a fabric script that lints all my code. In there I have a task which uses csslint for linting my css files. But csslint is a npm package. So how do I handle my virtualenv dependencies that are not a python package?

like image 638
tyrondis Avatar asked Nov 30 '12 10:11

tyrondis


People also ask

Should you always use virtual environment in Python?

Virtual Environment should be used whenever you work on any Python based project. It is generally good to have one new virtual environment for every Python based project you work on. So the dependencies of every project are isolated from the system and each other.

Should I use venv or virtualenv?

These are almost completely interchangeable, the difference being that virtualenv supports older python versions and has a few more minor unique features, while venv is in the standard library.

Can virtualenv access global packages?

By default, virtualenv will not give access to the global site-packages . Running python after deactivating will use your system installation of Python again.

Is virtualenv a Python package?

virtualenv is used to manage Python packages for different projects. Using virtualenv allows you to avoid installing Python packages globally which could break system tools or other projects. You can install virtualenv using pip.


1 Answers

I've done this once (while ago), and it worked quite good. The trick is to install node.js and npm to virtualenv:

workon myenv
cd node-v0.4.8
./configure –prefix=“/path/to/myenv/”
make
make install

and then

workon myenv
git clone git://github.com/isaacs/npm.git
cd npm
make
make install

This exact commands above are outdated, but I think it should be possible to do something similar with modern node.js and npm.

like image 107
Mikhail Korobov Avatar answered Sep 17 '22 18:09

Mikhail Korobov