Skip to content

Commit 53299d7

Browse files
committed
Add GraalPy-based Python executor module with autoconfigure, core, and Spring Boot starter support.
1 parent 614cc9e commit 53299d7

File tree

46 files changed

+2304
-60
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2304
-60
lines changed

.idea/compiler.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package io.maksymuimanov.python.executor;
2+
3+
import io.maksymuimanov.python.exception.PythonExecutionException;
4+
import io.maksymuimanov.python.interpreter.PythonInterpreterFactory;
5+
import io.maksymuimanov.python.response.PythonExecutionResponse;
6+
import io.maksymuimanov.python.script.PythonScript;
7+
import org.jspecify.annotations.Nullable;
8+
9+
10+
public abstract class InterpretablePythonExecutor<I extends AutoCloseable> implements PythonExecutor {
11+
private final PythonInterpreterFactory<I> interpreterFactory;
12+
13+
protected InterpretablePythonExecutor(PythonInterpreterFactory<I> interpreterFactory) {
14+
this.interpreterFactory = interpreterFactory;
15+
}
16+
17+
public <R> PythonExecutionResponse<R> execute(PythonScript script, @Nullable Class<? extends R> resultClass) {
18+
try (I interpreter = interpreterFactory.create()) {
19+
return execute(script, resultClass, interpreter);
20+
} catch (Exception e) {
21+
throw new PythonExecutionException(e);
22+
}
23+
}
24+
25+
protected abstract <R> PythonExecutionResponse<R> execute(PythonScript script, @Nullable Class<? extends R> resultClass, I interpreter);
26+
}
27+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package io.maksymuimanov.python.interpreter;
2+
3+
public interface PythonInterpreterFactory<I extends AutoCloseable> {
4+
I create();
5+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@NullMarked
2+
package io.maksymuimanov.python.interpreter;
3+
4+
import org.jspecify.annotations.NullMarked;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/mvnw text eol=lf
2+
*.cmd text eol=crlf
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
HELP.md
2+
target/
3+
.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
!**/src/main/**/build/
30+
!**/src/test/**/build/
31+
32+
### VS Code ###
33+
.vscode/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
wrapperVersion=3.3.4
2+
distributionType=only-script
3+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip

0 commit comments

Comments
 (0)