Generate a Python module into JAR files#838
Draft
mikehearn wants to merge 3 commits into
Draft
Conversation
Contributor
|
@mikehearn can you show what you did to test Micronaut SQL, I want to test this against some modules. Thanks |
c3a247f to
08734f0
Compare
Contributor
Author
|
I've added a typecheck task. Note that this doesn't work yet because to type check the Python requires resolving the Python/Micronaut dependency graph. However, it is forward progress and lets us rule out syntax errors etc. To test, use something like this: cd micronaut-build
./gradlew publishToMavenLocal
cd ../micronaut-sql
cat << 'EOF' | patch -p1
diff --git a/settings.gradle b/settings.gradle
index 39bbb6109..90ef9848d 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,5 +1,9 @@
pluginManagement {
+ // Include the local micronaut-build so all io.micronaut.build.* plugins resolve from our working copy
+ includeBuild("../micronaut-build")
repositories {
+ // Prefer local builds if we ever need to publishToMavenLocal as a fallback
+ mavenLocal()
gradlePluginPortal()
mavenCentral()
}
EOF
./gradlew jar
tree jdbc/build/graalpy-module
jar tf jdbc/build/libs/micronaut-jdbc-7.0.0-SNAPSHOT.jar|grep graalpy |
08734f0 to
980a29d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds usage of the new j2pyi tool in https://github.com/oracle/graalpy-extensions/tree/main/pyinterfacegen to Micronaut Build such that projects get a Python module containing .pyi stubs for GraalPy included into the JAR.
It's not ready to merge yet because the j2pyi tool needs to be released to Maven Central first, and we may need to do more work on the bindings generation to make them high quality enough.
The idea is that some kind of tool can take the Python module out of the JARs and merge them together into a venv.
Testing
I tested
micronaut-sqlwith this new set of plugins locally and it worked. I haven't tested any other module.