VirtualEnvOnDemand.PersistentEnv
index
/home/media/projects/VirtualEnvOnDemand/VirtualEnvOnDemand/PersistentEnv.py

PersistentEnv - "Helper" methods to manage a global persistent environment.
 
  For use in projects, deployments, etc.

 
Modules
       
os
sys

 
Functions
       
setupAndActivateEnv(parentDirectory, name, packages, myVersion=None, forceInstallPackages=False, enableOnDemandImporter=False, printDebug=False)
setupAndActivateEnv - 
 
    @param parentDirectory <str> - This is the directory wherein the virtualenv will be created
    @param name <str> - This is the name of the virtualenv root folder
    @param packages <list/dict/str> - A list of packages to install. You can use pip modifiers, like '==' and '<'. May be any of the following:
 
        List   - A list/tuple/set of package names (optionally including version requirements, e.x. MyPkg==1.2.3)
        Dict   - A dictionary of package names to versions. If no value is present (i.e. evaluates to False, like '' or None), the latest will be fetched.
        String - Directly becomes contents of requirements.txt file to be ingested by pip
 
      Note: if the virtualenv exists already, updates to this field will go unnoticed unless 
        "myVersion" increases, or "forceInstallPackages" is set. @see #myVersion parameter below.
 
        You can also use  " VirtualEnvOnDemand.installPackages( packages, venvInfo ) "  to force install/update of #packages ,
         where "venvInfo" is the return of this function.
        @see #VirtualEnvOnDemand.InstallPackages.installPackages
 
    @param myVersion <str/int> - Any sort of version string. You can use __version__ from your module if you so please. Use None to disable.
 
        When defined, this represents your virtualenv's "version".
 
        If you are inheriting an existing virtualenv, and this method is passed a higher #myVersion than is currently marked in the
          virtualenv directory, this method will attempt to install/update any packages as found in #packages.
 
    @param forceInstallPackages <bool> Default False - If True, will attempt to install/update any packages found in #packages every time.
 
        On production and deployed code, you will likely want to leave this as False, as it carries a performence penality with every script invocation
          to check for updates. Instead, bump the value of "myVersion" e.g. from "1.2.0" to "1.2.0.1" or similar, or 
          explicitly call #VirtualEnvOnDemand.InstallPackages.installPackages from an admin servlet, for example.
 
    @param enableOnDemandImporter <bool> Default False - If True, will use this env as the global "on demand" importer. 
        @see #VirtualEnvOnDemand.GlobalEnv.enableOnDemandImporter
 
    @param printDebug <bool> Default False - If True, will print debug messages about what's going on to stderr.

 
Data
        __all__ = ('setupAndActivateEnv',)