ipm icon indicating copy to clipboard operation
ipm copied to clipboard

Make pip install process faster/smarter

Open isc-tleavitt opened this issue 1 year ago • 2 comments

I'm working on a project with a large number of large Python dependencies in requirements.txt and installation takes forever.

It would be nice if there was a way to bypass processing requirements.txt OR a way to say "only process if it's changed since last time" to avoid this overhead every time zpm "load" is called.

isc-tleavitt avatar Jul 26 '24 18:07 isc-tleavitt

My quick solution for this in my local base lifecycle class:

Method InstallPythonRequirements(pRoot As %String = "", ByRef pParams)
{
  Set cmd = $Get(pParams("cmd"))
  If '$ListFind($ListBuild("install", "load"), cmd) {
    Quit $$$OK
  }
  Set tVerbose = $Get(pParams("Verbose"))
  Set pythonRequirements = ##class(%File).NormalizeFilename("requirements.txt", pRoot)
  If '##class(%File).Exists(pythonRequirements) {
    Quit $$$OK
  }
  If $Data(pParams("BypassPython"),bypass)#2 && bypass {
    Do ..Log("requirements.txt SKIPPED")
	Quit $$$OK
  }

Then run load with -DBypassPython=1

isc-tleavitt avatar Jul 26 '24 21:07 isc-tleavitt

It looks great and I suggest using -DBypassPython to -DBypassPythonDeps or -DBypassPythonReqs. After all, who knows where else we need to use Python in the future 😄

isc-shuliu avatar Jul 29 '24 19:07 isc-shuliu