intersystems / ipm

InterSystems ObjectScript Package Manager
MIT License
27 stars 19 forks source link

Make pip install process faster/smarter #526

Open isc-tleavitt opened 1 month ago

isc-tleavitt commented 1 month ago

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 commented 1 month ago

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-shuliu commented 1 month ago

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 😄