Skip to content

Commit 114ea37

Browse files
committed
pin termcolor version in jbang hello.java example
1 parent 95b9693 commit 114ea37

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

graalpython/graalpy-jbang/examples/hello.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
///usr/bin/env jbang "$0" "$@" ; exit $?
4242
//JAVA 17+
4343
//DEPS org.graalvm.python:graalpy-jbang:${env.GRAALPY_VERSION:24.2.0}
44-
//PIP termcolor
44+
// specify python packages and their versions as if used with pip
45+
//PIP termcolor==2.2
4546

4647
import org.graalvm.polyglot.Context;
4748
import org.graalvm.polyglot.PolyglotException;
@@ -53,7 +54,7 @@ public static void main(String[] args) {
5354
try (Context context = GraalPyResources.createContext()) {
5455
switch (args.length) {
5556
case 0:
56-
context.eval("python", "print('Hello from Python')");
57+
context.eval("python", "from termcolor import colored; print(print(colored('hello java', 'red', attrs=['reverse', 'blink'])))");
5758
break;
5859
case 1:
5960
context.eval("python", args[0]);

graalpython/graalpy-jbang/templates/graalpy-template.java.qute

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
{#if dependencies.isEmpty()}// //DEPS <dependency1> <dependency2>{/if}
77
{|
88
//DEPS org.graalvm.python:graalpy-jbang:${env.GRAALPY_VERSION:24.2.0}
9-
//PIP termcolor
9+
// specify python packages and their versions as if used with pip
10+
//PIP termcolor==2.2
1011
|}
1112
import org.graalvm.polyglot.Context;
1213
import org.graalvm.polyglot.Context.Builder;

graalpython/graalpy-jbang/templates/graalpy-template_local_repo.java.qute

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
//REPOS local=file://{path_to_local_repo}
1010
{|
1111
//DEPS org.graalvm.python:graalpy-jbang:${env.GRAALPY_VERSION:24.2.0}
12-
//PIP termcolor
12+
// specify python packages and their versions as if used with pip
13+
//PIP termcolor==2.2
1314
|}
1415
import org.graalvm.polyglot.Context;
1516
import org.graalvm.polyglot.Context.Builder;

0 commit comments

Comments
 (0)