Metadata-Version: 2.4
Name: orjp
Version: 0.1.1
Summary: Call static Java methods from Python as if they were Python functions. Converts Java source files to reflection-friendly classes automatically.
Author-email: orjp <anonymous@example.com>
License: MIT
Keywords: java,python,interop,reflection,JVM
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# orjp - Python & Java Interop

## Overview

**orjp** (Java & Python Interop) is a Python package that allows you to call static Java methods directly from Python code, making Java interoperability seamless and intuitive.

## Features

- Call static Java methods as if they were Python functions
- Automatically converts Java source files to reflection-friendly classes
- Support for all Java primitive types (int, double, float, boolean, long, String)
- Reflection-based approach that doesn't require JNI or external JVM libraries

## Quick Start

### 1. Installation

```bash
pip install orjp
```

### 2. Import and Use

```python
from orjp import subject

# Call static methods like Python functions
result = subject.test()                # Calls into Java
result = subject.greet("world", 3)     # Calls into the matching Java overload

# Or use the call API
from orjp import call
call("subject.java", "test")
```

### 3. Creating Java Source Files

Create a `.java` file in the `orjp/jvm/` directory:

```java
public class Subject {
    public static String greet(String name, int times) {
        return String.format("Hello %s (x%s)", name, times);
    }
    
    public static void test() {
        System.out.println("Test method called");
    }
}
```

The package will automatically convert this to a reflection-friendly class available in Python.

## Implementation Details

The package works by:

1. Accepting Java source code as input
2. Parsing and extracting static method signatures using regex
3. Generating reflection-compatible wrapper classes that use Java's reflection APIs
4. Creating Python classes that map directly to these generated Java classes

This approach eliminates the need for JNI (Java Native Interface) and complex JVM native libraries, while providing a clean, Pythonic interface for Java interop.

## Advantages

- **No JNI required** - Uses pure Java reflection
- **Clean API** - Java methods look and behave like Python functions
- **Type-safe** - Maintains Java type checking while providing Python-like syntax
- **Simple setup** - No external JVM installation needed
- **Automatic conversion** - Java files are transformed transparently

## Supported Types

- `int`, `double`, `float`, `boolean`, `long` - converted to appropriate Java types
- `String` - passed through directly
- Other types - supported through reflection

## Note on Licensing

This package is intended for development and demonstration purposes. For commercial use or production environments, consider the associated licensing terms.

## Project Links

- GitHub: https://github.com/your-username/python-java-connect
- PyPI: https://pypi.org/project/orjp/
