The JPype java.* type definitions. They cover imports like from java.util import ArrayList.
There are two mutually exclusive variants distributed under different names:
java-stubs (no automated Java string to Python string conversions)
java-stubs-converted-strings (with the conversions)
Some details from JPype string conversions documentation:
The convertStrings argument controls whether Java strings are automatically converted to Python strings. By default, this behavior is disabled (convertStrings=False) to preserve Java string methods and avoid unnecessary conversions.
If enabled (convertStrings=True), Java strings are returned as Python strings, but this can impact performance and chaining of Java string methods. This option is consisted a legacy option as it will result in unncessary calls to str() every time a String is passed from Java.
Best practice: Set convertStrings=False unless your application explicitly requires automatic conversion.
Which version you need depends on the convertStrings value used when starting the JVM.
Both of these distributions provide the java-stubs package providing type definitions for the whole java.* namespace.
The stubs are produced with CERN’s stubgenj.
There’s a related JPype discussion.
Known limitations
The types are tied to a specific Java version (currently OpenJDK 25).
The JPype version used when generating the types may affect them, currently only one version is used.
A few Java -> Python stubgenj translation problems have been reported, some are very difficult to resolve in a way that will satisfy all users (more: https://gitlab.cern.ch/scripting-tools/stubgenj/-/issues).
Internal documentation
Run ./generate to regenerate the stubs.
Release files for java-stubs 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| java_stubs-0.1.0.tar.gz | 249.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| java_stubs-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 532.2 kB
Release files / java_stubs-0.1.0.tar.gz
| Download URL | java_stubs-0.1.0.tar.gz |
|---|---|
| Size | 249.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ee445ca76db9817eb0e7e255b48c2181c0c8b9618b9261af04d305b47382898
|
|
BLAKE2b-256 checksum How to use checksums |
927459033d5de913d7cd082f5e4fbf021315b86974014799e05157f46581ec36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / java_stubs-0.1.0-py3-none-any.whl
| Download URL | java_stubs-0.1.0-py3-none-any.whl |
|---|---|
| Size | 282.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
090661c36ac346d9d6f555fd9e1c30ca413b90318631971922cf86c7bb962f6a
|
|
BLAKE2b-256 checksum How to use checksums |
7066c21566a446351c4fda604a05367558864260ca2ca97acf42330145a97ae3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|