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

Add example for embedding simple python scripts and debugging them using VSCode #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

timfel
Copy link
Contributor

@timfel timfel commented Nov 27, 2024

No description provided.

@timfel timfel self-assigned this Nov 27, 2024
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 27, 2024
## 4.3 Calling the Python script from Java

`App.java`
```java
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I want to follow just the guide without looking at the reference solution, then this snippet is not enough. In other guides like the Micronaut/Spring guide we included even the large html listing just so that the guide itself is self-contained. We should probably be consistent in this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll expand the readme


```shell
./mvnw compile
./mvnw javafx:run
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I followed the JavaFX quickstart from https://openjfx.io/openjfx-docs/#maven it did not generate the wrapper. Maybe this should be mvn compiler etc. or mention something like "if you don't use Maven wrapper, the commands would be ...".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch, the project generated by javafx-archetype-simple seem to be broken on many fronts...

  • it sets maven-compiler-plugin to version 3.8.0, but that seems to be broken so one must manually update to at least 3.8.1
  • it generates module-info.java, so javac does module stuff and since polyglot is a proper module, one has to add requires org.graalvm.polyglot; to the generated module-info.java.
  • after fixing all that it fails in runtime on some Java module permission issue

All in all, maybe it's easier to not even mention this Java FX quickstart guide..?


![Gif animation of installing GraalPy with pyenv](./graalpy-vscode-pyenv.gif)
![Gif animation of using GraalPy in VSCode](./graalpy-vscode-select.gif)
![Gif animation of debugging with GraalPy in VSCode](./graalpy-vscode-debug.gif)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am getting this:
image
have you seen anything like that before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh. They haven't pushed the new version out, yet, and I still had my local changes that I pushed upstream. They updated the debugpy version in the extension to one with the fix (microsoft/vscode-python-debugger#505) but haven't pushed a new extension release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants