Skip to content

Chi-Re/Javathon

Repository files navigation

Javathon

English | 简体中文

A cross-language interaction framework based on Java ASM for static translation and dynamic loading of Python.


Development

  • Dependencies

    Use the core module for custom compilation and loading.
    dependencies {
        implementation 'com.github.Chi-Re.Javathon:core:0.1.2'
    }
    If you only want to load compiled bytecode, just import the lib module and write your own loader.
    dependencies {
        implementation 'com.github.Chi-Re.Javathon:lib:0.1.2'
    }

  • Project

    If you wish to use it in project development, you can use the Gradle plugin for mixed Python and Java development.

    plugins {
        id 'io.github.Chi-Re.javathon' version '0.0.1'
    }

    Specify the source code folder and the compiled output folder.

    pythonGen {
        outputDir = file("build/generated/output") // The specified folder will be automatically implemented
        sourceDir = file("pySrc")
    }

    Note:

    • If you want mixed development, the project must add the lib module as a dependency.
    • The packaging part during build only supports customization, so pay attention when building a jar.

Building

Building: gradlew core:dist

After the build is complete, the result is located at ~/core/build/libs/Javathon.jar


Usage

Run the built Javathon.jar file in the following way.

If you want to build a Python project, run:

java -cp Javathon.jar chire.python.PyCompiler input output

If you only want to run a Python project, run:

java -cp Javathon.jar chire.python.PyInterpreter input classPath

Note:

  • input must be the root directory of the Python project source code.
  • output will automatically detect whether it is a file or a folder, but if it is a file, it must end with .jar.
  • classPath is the entry path, in the format xxx.xxx.xxx. For inner classes, use $ to connect (consistent with Java's Class.forName syntax).

About

Currently not stable enough; the interfaces exposed by the lib module are subject to change.


Note: The above is an AI translation. If there are any mistakes, I apologize. You can provide feedback in the issues. Thank you.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors