Metadata-Version: 2.4
Name: chaquopy-stubgen
Version: 0.1.0
Summary: PEP484 python stub generator for Java classes accessed through Chaquopy on Android
License: MIT
Keywords: stubgen,JPype,Python,Java,Chaquopy,Beeware,briefcase,Android,PEP484
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: JPype1<2,>=1.6.0
Dynamic: license-file

# 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](https://github.com/chaquo/chaquopy) and [briefcase](https://github.com/beeware/).

This is based on [stubgenj](https://gitlab.cern.ch/scripting-tools/stubgenj). Although the tool generates stubs optimized for  `chaquopy`, it still uses [`jpype`](https://github.com/jpype-project/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`
