gradle-use-python-plugin
gradle-use-python-plugin copied to clipboard
pipInstall up-to-date fails when deferring to `pip install -r`
First of all thanks for the great plugin!
We configured pipInstall
to use native requirements.txt
file. This gives devs the opportunity to work pip install -r requirements.txt
on the command line when sourcing the corresponding venv
. Unfortunately this leads to pipInstall
being always up-to-date after the first run. I believe the issue is with this code, i.e. modulesToInstall
is never populated with pip install -r
deferred installs. Also, since a requriements.txt
can include other requirements.txt files a potential solution ideally also deals with this. Maybe one way to solve is by using pip list
to list all installed dependencies when directReqsInstallRequired
is true and use that to populate modulesToInstall
?
python plugin config:
configure(pythonProjects + listOf(rootProject)) {
apply(plugin = "ru.vyarus.use-python")
configure<PythonExtension> {
pythonBinary = "python3.11"
scope = PythonExtension.Scope.VIRTUALENV
installVirtualenv = true
requirements.use = true
requirements.file = "requirements.txt"
requirements.strict = false
envPath = ".venv"
// alwaysInstallModules = true // while not really a fix this solves the problem for the time being.
}
}
and the corresponding requirements.txt
files:
> cat requirement.txt
-r requirements-prod.txt
pytest==7.3.1
pytest-asyncio==0.21.0
pytest-mock==3.10.0
httpx==0.24.1
testcontainers[postgres]==3.7.1
> cat requirements-prod.txt
cachetools==5.3.1
CacheControl==0.13.0
dependency-injector==4.41.0
fastapi==0.95.2
matplotlib==3.7.1
numpy==1.24.3
pandas==2.0.2
scipy==1.10.1
pg8000==1.29.4
Pillow==9.5.0
pyaml-env==1.2.1
pydantic-collections==0.4.0
pydantic-yaml==0.11.2
pydantic==1.10.8
python-multipart==0.0.6
SQLAlchemy==2.0.15
starlette==0.27.0
uvicorn[standard]==0.22.0
yoyo-migrations==8.2.0
google-auth==2.19.1
google-cloud-storage==2.9.0
google-cloud-logging==3.5.0
google-cloud-secret-manager==2.16.1
cloud-sql-python-connector[pg8000]==1.2.3
thanks!@