oracle / graalpython

A Python 3 implementation built on GraalVM
Other
1.17k stars 101 forks source link

Documentation on how to use the JVM standalone build with Java interop is not clear / does not work #377

Closed mikehearn closed 5 months ago

mikehearn commented 5 months ago

I tried the following:

  1. Go to the releases page.
  2. Download the mac amd64 -jvm standalone build.
  3. Untar, remove quarantine etc.
  4. ./bin/graalpy
  5. import java
  6. Tried to test an example:
from java.util import Random
rg = Random(99)

Result: TypeError: invalid instantiation of foreign object

From the startup time and feel, it appears that graalpy in this download is native only, though I can see a jvm in the jvm subdirectory. For example, when running graalpy --help I see --native but not --jvm.

Additionally, there are binaries with names like graalpy-managed and graalpy-lt which aren't documented. What do these do?

I wasn't able to get any Java interop examples working with the -jvm download.

mikehearn commented 5 months ago

Oh, I see that this is a release error that was never fixed:

https://github.com/oracle/graalpython/issues/357

It would be good to add a notice to the docs to tell people to use CE until the next release.

msimacek commented 5 months ago

Hi @mikehearn, it should be fixed in the latest release. It was released last weeek, did you try that one? It works for me on Linux.

Additionally, there are binaries with names like graalpy-managed and graalpy-lt which aren't documented. What do these do?

They are described in https://github.com/oracle/graalpython/blob/master/docs/user/FAQ.md#can-i-use-the-graalvm-sandboxing-features-with-graalpy

mikehearn commented 5 months ago

Ah, sorry! I didn't find that FAQ in my search for some reason. Maybe it could be mentioned in the README?

I didn't try with that release, because the release title suggested to me that it's the Community Edition, so I went to the next release down in the list which didn't say CE in the title. But I see now that the linked release assets contain both CE and non-CE builds. I think the - in the title is meant to imply "and" but I read it as a sub-division. I'll try again with the latest release.

msimacek commented 5 months ago

Ah, sorry! I didn't find that FAQ in my search for some reason. Maybe it could be mentioned in the README?

It's linked from the start of the reference manual. But that manual is not well linked from the repository README, so yes, we can improve it.

I didn't try with that release, because the release title suggested to me that it's the Community Edition, so I went to the next release down in the list which didn't say CE in the title. But I see now that the linked release assets contain both CE and non-CE builds. I think the - in the title is meant to imply "and" but I read it as a sub-division. I'll try again with the latest release.

Ah, right, that seems wrong. I just renamed the release.