xvik / gradle-use-python-plugin

Use python modules in gradle build

Home Page:https://xvik.github.io/gradle-use-python-plugin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot upgrade pip If pip version is lower than minPythonVersion

stonyw opened this issue · comments

if pip version is lower than minPythonVersion, I cannot upgrade it to latest because checkPython runs first.

task upgradePip1(type: PipInstallTask) {
    pip 'pip:10.0'
    pythonBinary = 'python'
}

task upgradePip2(type: PythonTask) {
    module = 'pip install -U pip'
    pythonBinary = 'python'
}

Exec task is the only way and run before :checkPython or :pipInstall.

task upgradePip3(type:Exec) {
    commandLine 'python', '-m', 'pip', 'install', '-U', 'pip'
}

The walk around is not nice.

Could you plz add flag that let python gradle task try to upgrade pip if its version is lower than minPythonVersion?

Now I remember: I was thinking about it initially, but have to avoid auto pip upgrade because of the linux permission problems.

There is no problem to upgrade pip on user and virtualenv level, but global update most likely will fail. Pip may also be managed as system package (e.g. in ubuntu). Only on windows global pip could be upgraded easily (suppose it's your case because only windows require python -m to work properly).

To avoid all this mess plugin distance from python/pip global installation.

If you work on user or virtualenv level (I'm sure you do) you should be able to request newer pip installation:

python {
   pip 'pip:10.0.1'
   pip 'somethingElse:1.0'
}

Packages are installed sequentially, so after installing pip other packages should be installed with newer pip version.

For minPipVersion I would suggest to consider it as minimal required for setup version, rather than minimal working version. This way, even if you actually need pip 10, you can use default minPipVersion = 9 as minimal required for setup: virtualenv created with pip 9, pip upgraded and other packages installed with correct pip (global system pip is not affected).

Described this case in docs.

Tell me if this is not enough.