Package: virtual-node
virtual-nodeContinuous integration status:This package is a wrapper around thenode.jssources and provides a
convenient way to install it directly into yourvirtualenvinstead
of globally. I created this package to play around with a simple
installation for Django projects that usedjango-compressor’s
precompiler to generate CSS fromlessfiles.The install routine used insetup.pyis adapted from thenodeenvpackage provided by Eugene Kalinin. The difference is that I want
to install node.js into an existingvirtualenvinstead of creating
a specific environment for node.I am using this in combination withvirtual-lesswhich installs thelessccommandline tool into a virtual environment.InstallationWarningThis will download the node.js sources and compile it into your
virtualenv. Make sure that you have all required build dependencies for
node.js installed before installing virtual-node. The installation will
take quite a long time to run for the first time around, so have a coffee
or a beer handy.Installing thenodeinto your virtual environment is as easy as:$ pip install virtual-nodeIf you had node.js installed globally previous to installingvirtual-node,
runningnpmornodewill still point to your global installation.
To make sure you’re using the newly installednode, deactivate your
virtualenv and re-activate it.You can check thatvirtual-nodehasnodepointing to the right place by
runningwhich nodein your virtual environment:$ which nodeYour output should look something like:/home/elbaschid/.virtualenvs/lessc-test/bin/nodeNotevirtual-node is explicitly meant to be installed into a virtualenv
and not into your global environment. This has not been tested and will
most likely not work or cause problems. Only try it if you know what you
are doing.Install specific version ofnodeVersion0.1.0add support for the environmental variableNODE_VERSIONthat make it possible to specify the node version to be installed. If you want
to install version0.10.0, simply setNODE_VERSION=0.10.0and runpip installafterwards:$ export NODE_VERSION=0.10.0
$ pip install virtual-nodeor even just:$ NODE_VERSION=0.10.0 pip install virtual-nodeIn addition,it is possible to specify the version ofnodeusing theNPMpackaging formatpackage.json(support added in version0.0.3).
To use this feature you need to specify the current project directory in the
environment variablePROJECT_DIRbeforeyou installvirtual-node.
You can simply export it on the commandline:$ export PROJECT_DIR=/path/to/my/projector define it in yourvirtualenv/virtualenvwrapperscripts.During installation, the setup script will attempt to retrieve the desired
version of node from a file namedpackage.jsonwhich is also used byNPM[and is explained in detail on their website](https://npmjs.org/doc/json.html).A sample file to specify version0.10.0would look like this:{
  "name": "my-project",
  "version": "0.0.1",
  "engines": {
    "node": "==0.10.0"
  }
}The version of the engine to be used is the version thatvirtual-nodewill use to installnode.Note:you have to specify an exact version
(using==) otherwise the version will be ignored.Issues & ContributionsPlease let me know if you have any issues, please raise an issue
here on the github project.If you want to contribute, fork this repository and open a pull
request with your changes. I’d be happy to include them.LicenseThis package is released under the permissiveNew BSD license.Changelog0.1.0Add the ability to specify the version of node as an environmental variable
usingNODE_VERSION. This makes it a lot easier to define the version of
node that will be installed.Update the default version of node to0.10.26, the most recent version at
the time of writing.0.0.4Adds strict version checking to prevent some version comparison issues.Corrects issue withos.path.joinwhenPROJECT_DIRis not specified.0.0.3Drop calls of commandscurlandtarin favour of python modules to
make sure that this still works on machines without those commands installed.Add support forpackage.jsonfile to specify a custom version ofnode. This allows to re-align the versioning ofvirtual-nodewith
python conventions.0.0.2Adds check for existing version of virtual-nodeFix issues when used as dependency insetup.pySwitch from usinginstalltobuildcommand0.0.1Initial release