linkedin / pygradle

Using Gradle to build Python projects
https://github.com/linkedin/pygradle
Apache License 2.0
588 stars 147 forks source link

Multi-Project-Example: buildPex FAILED when using project dependency #301

Open kKdH opened 5 years ago

kKdH commented 5 years ago

Hey everyone,

i would like to use pygradle in a multi-project setup with project dependencies. To get in touch with pygradle i started with an example which i'm going to share with you by opening a PR later. I hope it will be helpful for #29 #229 #173 #144.

I created two gradle sub-projects. A python-cli project (example-app) and a python-sdist project (example-lib) on which the cli project depends on.

$ tree -L 2
.
|-- README.md
|-- build.gradle
|-- example-app
|   |-- build.gradle
|   |-- setup.py
|   |-- src
|   `-- test
|-- example-lib
|   |-- build.gradle
|   |-- setup.py
|   |-- src
|   `-- test
`-- settings.gradle

You will find the example in my fork of pygradle: https://github.com/kKdH/pygradle/tree/master/examples/multi-project-example


But currently i'm facing the following error (gist) when i try to build the app:

multi-project-example/example-app> gradle build --info

> Task :example-app:buildPex FAILED
Task ':example-app:buildPex' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
Starting process 'command '/home/kkdh/Projects/pygradle/examples/multi-project-example/example-app/build/venv/bin/python''. Working directory: /home/kkdh/Projects/pygradle/examples/multi-project-example/example-app Command: /home/kkdh/Projects/pygradle/examples/multi-project-example/example-app/build/venv/bin/python /home/kkdh/Projects/pygradle/examples/multi-project-example/example-app/build/venv/bin/pip freeze --all --disable-pip-version-check
Successfully started process 'command '/home/kkdh/Projects/pygradle/examples/multi-project-example/example-app/build/venv/bin/python''
/home/kkdh/Projects/pygradle/examples/multi-project-example/example-app/build/deployable/bin/example-app.pex
Starting process 'command '/home/kkdh/Projects/pygradle/examples/multi-project-example/example-app/build/venv/bin/python''. Working directory: /home/kkdh/Projects/pygradle/examples/multi-project-example/example-app Command: /home/kkdh/Projects/pygradle/examples/multi-project-example/example-app/build/venv/bin/python /home/kkdh/Projects/pygradle/examples/multi-project-example/example-app/build/venv/bin/pex --no-pypi --cache-dir /home/kkdh/Projects/pygradle/examples/multi-project-example/example-app/build/pex-cache --output-file /home/kkdh/Projects/pygradle/examples/multi-project-example/example-app/build/deployable/bin/example-app.pex --repo /home/kkdh/Projects/pygradle/examples/multi-project-example/example-app/build/wheel-cache --python-shebang /home/kkdh/.anaconda3/bin/python UNKNOWN==0.0.0 example-app==0.3.0a1
Successfully started process 'command '/home/kkdh/Projects/pygradle/examples/multi-project-example/example-app/build/venv/bin/python''
Could not satisfy all requirements for example-lib:
    example-lib(from: example-app==0.3.0a1)
:example-app:buildPex (Thread[Execution worker for ':',5,main]) completed. Took 1.165 secs.

After reading the log carefully i found the potential problem: pygradle resolves the example-lib dependency (important: when building the cli/app sub-project) as UNKNOWN==0.0.0.


Any pointers to a solution or further troubleshoot steps are appreciated.

joshatcaper commented 4 years ago

Sorry to post on this old issue but I think this is still a problem. Does anyone have a workaround?