Skip to content

Commit 44b4f30

Browse files
committed
[GR-76450] Move JBang catalog out of GraalPython
PullRequest: graalpython/4632
2 parents 38f595c + 07648de commit 44b4f30

10 files changed

Lines changed: 25 additions & 201 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ language runtime. The main focus is on user-observable behavior of the engine.
55

66
## Version 25.1.0
77
* The standalone artifacts now include the Python version name before the Graal version. The new artifacts now start with `graalpy<PYTHON_VERSION>-<GRAAL_VERSION>-<OPERATING_SYSTEM>-<ARCHITECTURE>`.
8-
* Standalone JVM artifacts are no longer released as separate distributions. For standalone deployments, use the GraalPy native artifacts. If you require Java interoperability, use a custom embedding.
8+
* Standalone JVM artifacts are no longer released as separate distributions. For standalone deployments, use the GraalPy native artifacts. If you require Java interoperability, use our jbang launcher (`jbang graalpy@oracle/graalpython -c "print('hello from GraalPy')"`) or a custom embedding.
99
* Add `-X jit=0|1|2` presets to tune startup-heavy or throughput-oriented workloads, and make the GraalPy launcher default to the `jit=1` preset.
1010
* Treat foreign buffer objects as Python buffer-compatible binary objects, so APIs like `memoryview`, `bytes`, `bytearray`, `binascii.hexlify`, and `io.BytesIO` work naturally on them when embedding GraalPy in Java. This allows passing binary data between Python and Java's `ByteBuffer` and `ByteSequence` types with minimal (sometimes zero) copies.
1111
* Add support for [Truffle source options](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/source/Source.SourceBuilder.html#option(java.lang.String,java.lang.String)):

docs/site/Gemfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GIT
22
remote: https://github.com/graalvm/graal-languages-jekyll-theme.git
3-
revision: 1e8d5b675768ea158684474ef7a32a6ed8ce9baf
3+
revision: 6ae97469860513f340ee832c7b84be81c43d52ad
44
branch: main
55
specs:
66
graal-languages-jekyll-theme (0.2.0)
@@ -43,10 +43,10 @@ GEM
4343
fiber-storage
4444
fiber-storage (1.0.1)
4545
forwardable-extended (2.6.0)
46-
google-protobuf (4.34.1-arm64-darwin)
46+
google-protobuf (4.35.0-arm64-darwin)
4747
bigdecimal
4848
rake (~> 13.3)
49-
google-protobuf (4.34.1-x86_64-linux-gnu)
49+
google-protobuf (4.35.0-x86_64-linux-gnu)
5050
bigdecimal
5151
rake (~> 13.3)
5252
hashery (2.1.2)
@@ -140,9 +140,9 @@ GEM
140140
rouge (4.7.0)
141141
ruby-rc4 (0.1.5)
142142
safe_yaml (1.0.5)
143-
sass-embedded (1.99.0-arm64-darwin)
143+
sass-embedded (1.100.0-arm64-darwin)
144144
google-protobuf (~> 4.31)
145-
sass-embedded (1.99.0-x86_64-linux-gnu)
145+
sass-embedded (1.100.0-x86_64-linux-gnu)
146146
google-protobuf (~> 4.31)
147147
siteleaf (2.3.0)
148148
httparty (>= 0.16.0)

docs/user/Python-on-JVM.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ While GraalPy offers similar capabilities to Jython, there are important differe
88

99
This guide shows you how to migrate from Jython to GraalPy.
1010

11+
For a lightweight command-line JVM launcher similar to the Jython launcher, use the JBang recipe from the GraalPy catalog:
12+
13+
```bash
14+
jbang graalpy@oracle/graalpython -c "print('hello from GraalPy')"
15+
```
16+
1117
### Prerequisites
1218

13-
- To migrate Jython scripts to GraalPy, you first need to create a GraalPy embedding. For more information, see [Embedding Python in Java](Embedding-Getting-Started.md).
19+
- To migrate plain Jython command-line scripts, you can create a custom embedding or run GraalPy with the JBang recipe.
20+
- To migrate applications that embed Jython, create a GraalPy embedding. For more information, see [Embedding Python in Java](Embedding-Getting-Started.md).
1421
- Make sure to migrate code from Python 2 (as supported by Jython) to Python 3 (the major version GraalPy is compatible with) following [the official guide from the Python community](https://docs.python.org/3/howto/pyporting.html)
1522

1623
## GraalPy Java Interoperability Overview

graalpython/com.oracle.graal.python.test/src/tests/conftest.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ run_top_level_functions = true
33

44
[[test_rules]]
55
selector = [
6-
"standalone/test_jbang_integration.py",
76
"standalone/test_standalone.py"]
87
per_test_timeout = 2400
98
partial_splits_individual_tests = true

graalpython/graalpy-jbang/examples/hello.java

Lines changed: 0 additions & 74 deletions
This file was deleted.

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

Lines changed: 0 additions & 42 deletions
This file was deleted.

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

Lines changed: 0 additions & 46 deletions
This file was deleted.

graalpython/lib-python/3/venv/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ def create_if_needed(d):
161161
'Python interpreter. Provide an explicit path or '
162162
'check that your PATH environment variable is '
163163
'correctly set.')
164+
if not os.path.exists(executable):
165+
raise ValueError(
166+
"GraalPy cannot create or populate a virtual environment, because the currently "
167+
"running executable is not a single binary file. Create and populate the venv "
168+
f"using a native GraalPy standalone {__graalpython__.get_graalvm_version()} "
169+
"instead. You can then use the venv with the currently running executable by "
170+
"setting the option `python.Executable` either as a Context option (if this is "
171+
"an embedding) or as the commandline flag "
172+
"`--python.Executable=<venv>/bin/python`."
173+
)
164174
dirname, exename = os.path.split(os.path.abspath(executable))
165175
context.executable = executable
166176
context.python_dir = dirname

jbang-catalog.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

mx.graalpython/mx_graalpython.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def get_boolean_env(name, default=False):
107107
RUNNING_ON_LATEST_JAVA = os.environ.get("LATEST_JAVA_HOME", os.environ.get("JAVA_HOME")) == mx.get_jdk().home
108108

109109

110-
# this environment variable is used by some of our maven projects and jbang integration to build against the unreleased master version during development
110+
# this environment variable is used by some of our maven projects to build against the unreleased master version during development
111111
os.environ["GRAALPY_VERSION"] = GRAAL_VERSION
112112

113113
MAIN_BRANCH = 'master'

0 commit comments

Comments
 (0)