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

Stub generator #514

Open
timwoocker opened this issue Mar 18, 2023 · 3 comments
Open

Stub generator #514

timwoocker opened this issue Mar 18, 2023 · 3 comments

Comments

@timwoocker
Copy link

The biggest problem I'm having with using py4j is that there is no autocompletion for the java classes.
It would be a great addition to have a tool that converts a java project into stub files for py4j. It could be created in a separate repository as it would be a standalone tool.

What do you guys think about that? A tool like ANTLR could be used for the syntax parsing, creating python stub files out of that shouldn't be too hard as the implementation isn't relevant and the generated stub project structure could be pretty much the same as the java project.

An alternative approach would be to write a plugin for IDEs (PyCharm or VS Code) that provides autocompletion based on .java source files for classes accessed through the gateway.

@HyukjinKwon
Copy link
Member

I don't think we can do a static analysis there because we can only access to the Java instances when the server is up (runtime).

@HyukjinKwon
Copy link
Member

in PySpark case (that uses Py4J), we just manually type all cases that we expose as an API.

@HyukjinKwon
Copy link
Member

Other notebooks like Jupyter IIRC support the automcompletion by doing dir(...) under the hood so that might be one example that we can follow.

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