Skip to content

Commit 4e1a5d4

Browse files
committed
Upgrade graalpy-openai-starter to openai==1.107.3.
1 parent 425e800 commit 4e1a5d4

File tree

5 files changed

+211
-196
lines changed

5 files changed

+211
-196
lines changed

graalpy/graalpy-openai-starter/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ To build and test the demo, run:
2525
To execute the main method, run:
2626

2727
```bash
28-
./mvnw exec:java -Dexec.args="'Say Hello from GraalPy'"
28+
./mvnw exec:exec -Duser.input="'How can I check if my code runs on GraalPy?'"
2929
```
3030

3131
## Run the Application Using Gradle
@@ -39,7 +39,7 @@ To build and test the demo, run:
3939
To execute the main method, run:
4040

4141
```bash
42-
./gradlew run --args="'Say Hello from GraalPy'"
42+
./gradlew run --args="'How can I check if my code runs on GraalPy?'"
4343
```
4444

4545
## Implementation Details

graalpy/graalpy-openai-starter/build.gradle.kts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,7 @@ dependencies {
1919

2020
graalPy {
2121
packages = setOf(
22-
"annotated-types==0.7.0",
23-
"anyio==4.6.0",
24-
"certifi==2024.8.30",
25-
"distro==1.9.0",
26-
"h11==0.14.0",
27-
"hpy==0.9.0",
28-
"httpcore==1.0.5",
29-
"httpx==0.27.2",
30-
"idna==3.10",
31-
"jiter==0.5.0", // uses a native extension
32-
"openai==1.47.1",
33-
"pydantic==2.4.2",
34-
"pydantic_core==2.10.1", // uses a native extension
35-
"sniffio==1.3.1",
36-
"tqdm==4.66.5",
37-
"typing_extensions==4.12.2"
22+
"openai==1.107.3",
3823
)
3924
}
4025

@@ -43,7 +28,14 @@ application {
4328
mainClass = "com.example.App"
4429
}
4530

31+
val truffleJvmArgs = listOf("--enable-native-access=ALL-UNNAMED", "--sun-misc-unsafe-memory-access=allow")
32+
33+
tasks.named<JavaExec>("run") {
34+
jvmArgs = truffleJvmArgs
35+
}
36+
4637
tasks.named<Test>("test") {
38+
jvmArgs = truffleJvmArgs
4739
// Use JUnit Platform for unit tests.
4840
useJUnitPlatform()
4941
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# This file was generated by maven goal 'org.graalvm.python:graalpy-maven-plugin:lock-packages'.
2+
#
3+
# WARNING: Any manual changes are done at your own risk and will be overwritten when the goal is executed.
4+
#
5+
# This file is meant to be tracked in a version control system.
6+
#
7+
# This file contains a list of all required Python packages with their specific versions,
8+
# based on the packages defined in the plugin configuration and their dependencies.
9+
# graalpy-version: 25.0.0
10+
# input-packages: openai==1.107.3
11+
annotated-types==0.7.0
12+
anyio==4.10.0
13+
certifi==2025.8.3
14+
distro==1.9.0
15+
h11==0.16.0
16+
httpcore==1.0.9
17+
httpx==0.28.1
18+
idna==3.10
19+
jiter==0.11.0
20+
openai==1.107.3
21+
pydantic==2.11.9
22+
pydantic_core==2.33.2
23+
sniffio==1.3.1
24+
tqdm==4.67.1
25+
typing-inspection==0.4.1
26+
typing_extensions==4.15.0
Lines changed: 156 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,157 +1,167 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>com.example</groupId>
7-
<artifactId>demo</artifactId>
8-
<version>1.0-SNAPSHOT</version>
6+
<groupId>com.example</groupId>
7+
<artifactId>demo</artifactId>
8+
<version>1.0-SNAPSHOT</version>
99

10-
<name>demo</name>
11-
<url>https://www.example.com</url>
10+
<name>demo</name>
11+
<url>https://www.example.com</url>
1212

13-
<properties>
14-
<graalpy.version>25.0.0</graalpy.version>
15-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16-
<maven.compiler.release>21</maven.compiler.release>
17-
</properties>
13+
<properties>
14+
<user.input>How can I check if my code runs on GraalPy?</user.input>
15+
<graalpy.version>25.0.0</graalpy.version>
16+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17+
<maven.compiler.release>21</maven.compiler.release>
18+
<truffle.jvm.arg1>--enable-native-access=ALL-UNNAMED</truffle.jvm.arg1>
19+
<truffle.jvm.arg2>--sun-misc-unsafe-memory-access=allow</truffle.jvm.arg2>
20+
</properties>
1821

19-
<dependencyManagement>
20-
<dependencies>
21-
<dependency>
22-
<groupId>org.junit</groupId>
23-
<artifactId>junit-bom</artifactId>
24-
<version>5.11.0</version>
25-
<type>pom</type>
26-
<scope>import</scope>
27-
</dependency>
28-
</dependencies>
29-
</dependencyManagement>
22+
<dependencyManagement>
23+
<dependencies>
24+
<dependency>
25+
<groupId>org.junit</groupId>
26+
<artifactId>junit-bom</artifactId>
27+
<version>5.11.0</version>
28+
<type>pom</type>
29+
<scope>import</scope>
30+
</dependency>
31+
</dependencies>
32+
</dependencyManagement>
3033

31-
<dependencies>
32-
<dependency>
33-
<groupId>org.graalvm.polyglot</groupId>
34-
<artifactId>polyglot</artifactId>
35-
<version>${graalpy.version}</version>
36-
</dependency>
37-
<dependency>
38-
<groupId>org.graalvm.polyglot</groupId>
39-
<artifactId>python</artifactId>
40-
<version>${graalpy.version}</version>
41-
<type>pom</type>
42-
</dependency>
43-
<dependency>
44-
<groupId>org.graalvm.python</groupId>
45-
<artifactId>python-embedding</artifactId>
46-
<version>${graalpy.version}</version>
47-
</dependency>
34+
<dependencies>
35+
<dependency>
36+
<groupId>org.graalvm.polyglot</groupId>
37+
<artifactId>polyglot</artifactId>
38+
<version>${graalpy.version}</version>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.graalvm.polyglot</groupId>
42+
<artifactId>python</artifactId>
43+
<version>${graalpy.version}</version>
44+
<type>pom</type>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.graalvm.python</groupId>
48+
<artifactId>python-embedding</artifactId>
49+
<version>${graalpy.version}</version>
50+
</dependency>
4851

49-
<dependency>
50-
<groupId>org.junit.jupiter</groupId>
51-
<artifactId>junit-jupiter-api</artifactId>
52-
<scope>test</scope>
53-
</dependency>
54-
<!-- Optionally: parameterized tests support -->
55-
<dependency>
56-
<groupId>org.junit.jupiter</groupId>
57-
<artifactId>junit-jupiter-params</artifactId>
58-
<scope>test</scope>
59-
</dependency>
60-
</dependencies>
52+
<dependency>
53+
<groupId>org.junit.jupiter</groupId>
54+
<artifactId>junit-jupiter-api</artifactId>
55+
<scope>test</scope>
56+
</dependency>
57+
<!-- Optionally: parameterized tests support -->
58+
<dependency>
59+
<groupId>org.junit.jupiter</groupId>
60+
<artifactId>junit-jupiter-params</artifactId>
61+
<scope>test</scope>
62+
</dependency>
63+
</dependencies>
6164

62-
<build>
63-
<plugins>
64-
<plugin>
65-
<groupId>org.graalvm.python</groupId>
66-
<artifactId>graalpy-maven-plugin</artifactId>
67-
<version>${graalpy.version}</version>
68-
<configuration>
69-
<packages>
70-
<package>annotated-types==0.7.0</package>
71-
<package>anyio==4.6.0</package>
72-
<package>certifi==2024.8.30</package>
73-
<package>distro==1.9.0</package>
74-
<package>h11==0.14.0</package>
75-
<package>hpy==0.9.0</package>
76-
<package>httpcore==1.0.5</package>
77-
<package>httpx==0.27.2</package>
78-
<package>idna==3.10</package>
79-
<package>jiter==0.5.0</package> <!-- uses a native extension -->
80-
<package>openai==1.47.1</package>
81-
<package>pydantic==2.4.2</package>
82-
<package>pydantic_core==2.10.1</package> <!-- uses a native extension -->
83-
<package>sniffio==1.3.1</package>
84-
<package>tqdm==4.66.5</package>
85-
<package>typing_extensions==4.12.2</package>
86-
</packages>
87-
</configuration>
88-
<executions>
89-
<execution>
90-
<goals>
91-
<goal>process-graalpy-resources</goal>
92-
</goals>
93-
</execution>
94-
</executions>
95-
</plugin>
96-
</plugins>
65+
<build>
66+
<plugins>
67+
<plugin>
68+
<groupId>org.graalvm.python</groupId>
69+
<artifactId>graalpy-maven-plugin</artifactId>
70+
<version>${graalpy.version}</version>
71+
<configuration>
72+
<packages>
73+
<package>openai==1.107.3</package>
74+
</packages>
75+
</configuration>
76+
<executions>
77+
<execution>
78+
<goals>
79+
<goal>process-graalpy-resources</goal>
80+
</goals>
81+
</execution>
82+
</executions>
83+
</plugin>
84+
<plugin>
85+
<groupId>org.apache.maven.plugins</groupId>
86+
<artifactId>maven-surefire-plugin</artifactId>
87+
<configuration>
88+
<argLine>${truffle.jvm.arg1} ${truffle.jvm.arg2}</argLine>
89+
</configuration>
90+
</plugin>
91+
<plugin>
92+
<groupId>org.codehaus.mojo</groupId>
93+
<artifactId>exec-maven-plugin</artifactId>
94+
<configuration>
95+
<executable>java</executable>
96+
<arguments>
97+
<argument>-classpath</argument>
98+
<classpath/>
99+
<argument>${truffle.jvm.arg1}</argument>
100+
<argument>${truffle.jvm.arg2}</argument>
101+
<argument>com.example.App</argument>
102+
<argument>${user.input}</argument>
103+
</arguments>
104+
</configuration>
105+
</plugin>
106+
</plugins>
97107

98-
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
99-
<plugins>
100-
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
101-
<plugin>
102-
<artifactId>maven-clean-plugin</artifactId>
103-
<version>3.4.0</version>
104-
</plugin>
105-
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
106-
<plugin>
107-
<artifactId>maven-resources-plugin</artifactId>
108-
<version>3.3.1</version>
109-
</plugin>
110-
<plugin>
111-
<artifactId>maven-compiler-plugin</artifactId>
112-
<version>3.13.0</version>
113-
</plugin>
114-
<plugin>
115-
<artifactId>maven-surefire-plugin</artifactId>
116-
<version>3.3.0</version>
117-
</plugin>
118-
<plugin>
119-
<groupId>org.codehaus.mojo</groupId>
120-
<artifactId>exec-maven-plugin</artifactId>
121-
<version>1.2.1</version>
122-
<executions>
123-
<execution>
124-
<goals>
125-
<goal>java</goal>
126-
</goals>
127-
</execution>
128-
</executions>
129-
<configuration>
130-
<mainClass>com.example.App</mainClass>
131-
</configuration>
132-
</plugin>
133-
<plugin>
134-
<artifactId>maven-jar-plugin</artifactId>
135-
<version>3.4.2</version>
136-
</plugin>
137-
<plugin>
138-
<artifactId>maven-install-plugin</artifactId>
139-
<version>3.1.2</version>
140-
</plugin>
141-
<plugin>
142-
<artifactId>maven-deploy-plugin</artifactId>
143-
<version>3.1.2</version>
144-
</plugin>
145-
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
146-
<plugin>
147-
<artifactId>maven-site-plugin</artifactId>
148-
<version>3.12.1</version>
149-
</plugin>
150-
<plugin>
151-
<artifactId>maven-project-info-reports-plugin</artifactId>
152-
<version>3.6.1</version>
153-
</plugin>
154-
</plugins>
155-
</pluginManagement>
156-
</build>
108+
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
109+
<plugins>
110+
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
111+
<plugin>
112+
<artifactId>maven-clean-plugin</artifactId>
113+
<version>3.4.0</version>
114+
</plugin>
115+
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
116+
<plugin>
117+
<artifactId>maven-resources-plugin</artifactId>
118+
<version>3.3.1</version>
119+
</plugin>
120+
<plugin>
121+
<artifactId>maven-compiler-plugin</artifactId>
122+
<version>3.13.0</version>
123+
</plugin>
124+
<plugin>
125+
<artifactId>maven-surefire-plugin</artifactId>
126+
<version>3.3.0</version>
127+
</plugin>
128+
<plugin>
129+
<groupId>org.codehaus.mojo</groupId>
130+
<artifactId>exec-maven-plugin</artifactId>
131+
<version>1.2.1</version>
132+
<executions>
133+
<execution>
134+
<goals>
135+
<goal>java</goal>
136+
</goals>
137+
</execution>
138+
</executions>
139+
<configuration>
140+
<mainClass>com.example.App</mainClass>
141+
</configuration>
142+
</plugin>
143+
<plugin>
144+
<artifactId>maven-jar-plugin</artifactId>
145+
<version>3.4.2</version>
146+
</plugin>
147+
<plugin>
148+
<artifactId>maven-install-plugin</artifactId>
149+
<version>3.1.2</version>
150+
</plugin>
151+
<plugin>
152+
<artifactId>maven-deploy-plugin</artifactId>
153+
<version>3.1.2</version>
154+
</plugin>
155+
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
156+
<plugin>
157+
<artifactId>maven-site-plugin</artifactId>
158+
<version>3.12.1</version>
159+
</plugin>
160+
<plugin>
161+
<artifactId>maven-project-info-reports-plugin</artifactId>
162+
<version>3.6.1</version>
163+
</plugin>
164+
</plugins>
165+
</pluginManagement>
166+
</build>
157167
</project>

0 commit comments

Comments
 (0)