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

Install artifact from another project

mceste-volume opened this issue · comments

It would be nice if it were possible to specify a file as a module to install so that we can share modules between projects in a multi module project. I’m not a seasoned Python developer therefore they may be a better way to achieve this, ideally without sharing a virtual environment in the root project.

For context, we have a pythonBuild task that creates a source distribution that we’d like to pip install in a downstream project. Another option is add the source to the PYTHONPATH for the downstream project.

For context, we have a pythonBuild task that creates a source distribution that we’d like to pip install in a downstream project. Another option is add the source to the PYTHONPATH for the downstream project.

This should be already possible with process-specific environment variables:

python {
   environment 'PYTHONPATH', project.file('path to file').getAbsolutePath()
}

This way it would be applied for all executed python tasks (including pipInstall). But maybe it should be put directly to pipInstall task only (pipInstall.environment 'PYTHONPATH', project.file('path to file').getAbsolutePath()): don't know if PYTHONPATH required only for module installation.


It would be nice if it were possible to specify a file as a module to install so that we can share modules between projects in a multi module project.

I suppose you refer to installation from local source tree.
It should be easy to support (not supported now!) it with something like:

python.pip file('path to file')

which will become: python -m pip install <path to file>

But I need to know if -e (dev mode) could be ignored or it might be useful too.
Also, I will need some hello world module (local dir to use as a module) which I can use for tests (I don't use python at all, and I, of course, could read docs and find out how to write such module, but it would be super awesome if real python user could save my time).

So if you need this feature, I'm open to discussion (of how it should be) and need some help (with a real case, I can test against).

In case if anyone else needs local modules support, please provide a sample usage example (complete simplified use-case).

Released version 3.0.0 with requirements file support.

It should be possible now to use any modules using native requirements syntax.

To enable native mode:

python.requirements.strict = false

(this way file would be loaded with pip: pip -r requirements.txt)

Requirements file, I suppose, would be like this (requirements.txt):

./submodule/build/something-1.0-cp34-none-win32.whl

Assuming to be solved. Please reopen if required features still missed.