Skip to main content

PEP484 python stub generator for Java classes accessed through Chaquopy on Android

Project description

chaquopy-stubgen

This tool is a python type stub generator from java classes. It is optimized for the usage with Android via chaquopy v16.1 and briefcase.

This is based on stubgenj. Although the tool generates stubs optimized for chaquopy, it still uses jpype internally to parse the Java files.

The generated stubs can be used with Python 3.8 or higher.

CLI Usage

Example call python -m chaquopy_stubgen java android --classpath android.jar

$ python -m chaquopy_stubgen --help
usage: __main__.py [-h] [--jvmpath JVMPATH] [--classpath CLASSPATH] [--output-dir OUTPUT_DIR] [--no-javadoc] prefixes [prefixes ...]

Generate Python Type Stubs for Java classes that are optimized for chaquopy.

positional arguments:
  prefixes              package prefixes to generate stubs for (e.g. org.myproject)

options:
  -h, --help            show this help message and exit
  --jvmpath JVMPATH     path to the JVM ("libjvm.so", "jvm.dll", ...) (default: use system default JVM)
  --classpath CLASSPATH
                        java class path to use, separated by ":". glob-like expressions (e.g. dir/*.jar) are supported (default: .)
  --output-dir OUTPUT_DIR
                        path to write stubs to (default: .)
  --no-javadoc          do not generate docstrings from JavaDoc where available

Development

  • Create venv: uv sync
  • Test: uv run pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chaquopy_stubgen-0.1.0.tar.gz (24.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chaquopy_stubgen-0.1.0-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file chaquopy_stubgen-0.1.0.tar.gz.

File metadata

  • Download URL: chaquopy_stubgen-0.1.0.tar.gz
  • Upload date:
  • Size: 24.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for chaquopy_stubgen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 431ca15c684e92a848c44fca8ed2cfb5c484498cce179295043e0ded3887ea4c
MD5 f157c9891552b8f188b8366fb66e896d
BLAKE2b-256 1cb1e4d04b81b37781f00713b2a9cd35117887d5e86480c5b805737be8d8e80f

See more details on using hashes here.

Provenance

The following attestation bundles were made for chaquopy_stubgen-0.1.0.tar.gz:

Publisher: python-publish.yml on timrid/chaquopy-stubgen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chaquopy_stubgen-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chaquopy_stubgen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e3d6030db0671c70e0232d5d6aeea25663fe9525833089adddd5dff043867e2
MD5 4046242eea41883ac8e8bc82adef2385
BLAKE2b-256 519cc9482ded805bf61fbd8e629b6eb212fd0bc1e2a083751849cd1b0c68684b

See more details on using hashes here.

Provenance

The following attestation bundles were made for chaquopy_stubgen-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on timrid/chaquopy-stubgen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page