ipm
ipm copied to clipboard
Make pip install process faster/smarter
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.
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
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 😄