(self)
Creates a virtual environment for this tool
Creates a virtual environment for this tool
Creates a virtual environment for this tool
def venv_create(self) -> None:
        """
        Creates a virtual environment for this tool
        """
        if not self.venv_dir().exists():
            logging.info(f"Creating virtual environment for {self.tool_id()}")
            # If we are already in a virtual environment, venv.create() will fail to install pip,
            # but we probably have virtualenv in the path, so try that first.
            try:
                # Don't litter stdout with virtualenv spam
                # Create virtualenv using same version as currently running executable
                subprocess.run(
                    ["virtualenv", f"--python={sys.executable}", self.venv_dir()],
                    stdout=subprocess.DEVNULL,
                    check=True,
                )
            except Exception:
                venv.create(str(self.venv_dir()), with_pip=True)
def venv_create ( self ) -> None : if not self . venv_dir ( ) . exists ( ) : logging . info ( f"Creating virtual environment for {self.tool_id()}" ) # If we are already in a virtual environment, venv.create() will fail to install pip, # but we probably have virtualenv in the path, so try that first. try : # Don't litter stdout with virtualenv spam # Create virtualenv using same version as currently running executable subprocess . run ( [ "virtualenv" , f"--python={sys.executable}" , self . venv_dir ( ) ] , stdout = subprocess . DEVNULL , check = True , ) except Exception : venv . create ( str ( self . venv_dir ( ) ) , with_pip = True )