Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include local python/jar libraries #16

Open
tobiasBayha opened this issue Oct 14, 2020 · 2 comments
Open

include local python/jar libraries #16

tobiasBayha opened this issue Oct 14, 2020 · 2 comments

Comments

@tobiasBayha
Copy link

Hi rzabini,

I am probably a little bit late to the discussion, but I will try it nevertheless.

Your plugin makes it possible to add python packages (from a remote) via pypackage
jython { pypackage 'python-dateutil:2.4.2','arrow:0.7.0', 'six:1.10.0' }

In my project i have some local packages I need to add to the classpath:
MyProject
├── dir1
│ ├── lib1.py
│ └── lib2.jar
└── dir2
└── lib3.py`

Is there any possibility to specify a local repository for pypackage to use?
Using pypackage with local files does result in an error (not surprisingly):
jython { pypackage 'resources\activation.py' }

Execution failed for task ':createClassPath'. Could not find method pypackage() for arguments [resources\activation.py] on extension 'jython' of type jython.JythonExtension.

Kind regards
Tobias

@rzabini
Copy link
Owner

rzabini commented Oct 17, 2020

Hi Tobias,
pypackage specifies a name and version of an external module which is available in the public Python repository. So its role is to specifiy what is needed, and not where it is. In this perspective, allowing something like pypackage '<local file path>' would drastically change the intent of the instruction.

However, if you have the source of your package inside your project, you should not need to refer to it in the build script: it should be enough to put the source code into src/main/jython directory, and import it in the main script.

On the other hand, if you have your own package that you use in several projects, and do not want to replicate its source in each project, I suggest you use a self-hosted repository, and use the standard pypackage declaration. At present, this still would not work in the current version of the plugin, as the url of the Python repository is hardcoded by design. However I might add the option to override this url (or to add another url to it, and search the repositories in order).

Thank you,
Romano

@tobiasBayha
Copy link
Author

Great! Thanks for the reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants