Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ uv add arcadedb-jvm # JVM, for heavy long-running loads

> Old names: `arcadedb-jvm` was formerly `arcadedb-embedded`, and `arcadedb` was formerly `arcadedb-embedded-native` (archived on PyPI). The last `arcadedb-embedded` release, 26.11.1, is a deprecation shim: it installs `arcadedb`, the native build, and warns once at import. It does not install `arcadedb-jvm`.

- Python: `arcadedb` (native) is tested on 3.11 to 3.14 and also installs on 3.15 (`requires-python` is `>=3.11` with no upper bound; the CI runs a subset of the tests on 3.15). `arcadedb-jvm` needs 3.11 to 3.14 (`requires-python` is `>=3.11,<3.15`; its dependency JPype has no 3.15 wheel yet). Each release builds and tests both packages on Python 3.11 to 3.14 on all four platforms below. Between releases, `main` and the nightly run test `arcadedb` on 3.12 and 3.14 on every platform (with a short subset on 3.11, 3.13 and 3.15), and `arcadedb-jvm` on 3.11 to 3.14 on Linux x86-64 and on 3.11 and 3.14 on the other three. A pull request runs Linux x86-64 only, and the other platforms when it carries the label `ci:full` ([CONTRIBUTING](https://github.com/ArcadeData/arcadedb-python/blob/main/CONTRIBUTING.md#what-ci-runs)).
- Python: `arcadedb` (native) is tested on 3.11 to 3.14 and also installs on 3.15 (`requires-python` is `>=3.11` with no upper bound; the CI runs a subset of the tests on 3.15). `arcadedb-jvm` needs 3.11 to 3.14 (`requires-python` is `>=3.11,<3.15`; its dependency JPype has no 3.15 wheel yet). On Python 3.11 it installs JPype below 1.8, because 1.8.0 can crash the process there; with a release up to 26.11.1.post4, run `uv add "jpype1<1.8"` in your project. Each release builds and tests both packages on Python 3.11 to 3.14 on all four platforms below. Between releases, `main` and the nightly run test `arcadedb` on 3.12 and 3.14 on every platform (with a short subset on 3.11, 3.13 and 3.15), and `arcadedb-jvm` on 3.11 to 3.14 on Linux x86-64 and on 3.11 and 3.14 on the other three. A pull request runs Linux x86-64 only, and the other platforms when it carries the label `ci:full` ([CONTRIBUTING](https://github.com/ArcadeData/arcadedb-python/blob/main/CONTRIBUTING.md#what-ci-runs)).
- Linux x86_64 and ARM64, macOS on Apple Silicon, Windows x86_64, for both packages. The Windows wheel of `arcadedb` is the newest.
- Import name: `arcadedb`. Check which package you have with `python -c "import arcadedb; print(arcadedb.__backend__)"`. It prints `native` or `jvm`.
- Optional extras: `arrow`, `pandas`, `polars`, `vector` for `arcadedb-jvm`; `numpy`, `arrow`, `pandas`, `polars` for `arcadedb`.
Expand Down
5 changes: 4 additions & 1 deletion docs/modules/ROOT/pages/installation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ NOTE: *First release.* The first release of this layout is 26.11.1, and both pac
// REMOVE WHEN: the old arcadedb-embedded* shims are retired and two releases have shipped with the two-package layout allow-old-name
NOTE: *Old names.* The JVM package was formerly `arcadedb-embedded`. It is now `{jvm-pkg-name}`, the same build. The native package was formerly `arcadedb-embedded-native`. It is now `{native-pkg-name}`, and the old project is archived. The last `arcadedb-embedded` release, 26.11.1, is a shim that installs `{native-pkg-name}` and warns once at import. It does not install `{jvm-pkg-name}`. See xref:which-package.adoc#old-names[Old names].

The JVM package is self-contained. It carries a Java 25 runtime for its platform, so you do not install Java. Its only Python dependency is `JPype1` 1.5.0 or later (the Java-Python bridge), which `uv add` installs with it. The native package needs no Java and no JPype. Optional extras install the columnar helpers of the native package: `[numpy]`, `[arrow]`, `[pandas]` and `[polars]`.
The JVM package is self-contained. It carries a Java 25 runtime for its platform, so you do not install Java. Its only Python dependency is `JPype1` 1.5.0 or later (the Java-Python bridge), which `uv add` installs with it. On Python 3.11 it stays below 1.8: there `JPype1` 1.8.0 ends the process with a segmentation fault when Python raises certain exceptions inside it, for example when Ctrl-C arrives during a query. The native package needs no Java and no JPype. Optional extras install the columnar helpers of the native package: `[numpy]`, `[arrow]`, `[pandas]` and `[polars]`.

// REMOVE WHEN: 26.12.1 is old enough that no supported release accepts JPype1 1.8 on Python 3.11
NOTE: *Releases up to 26.11.1.post4 on Python 3.11.* These releases of `{jvm-pkg-name}`, the 26.12.1 pre-releases up to 26.12.1.dev2, and the releases under the former JVM package name (xref:which-package.adoc#old-names[Old names]) up to 26.10.2.post1 (also on Python 3.10) accept `JPype1` 1.8.0. Add the limit to your own project with `uv add "jpype1<1.8"`. Python 3.12 and later do not need it.

[[requirements]]
== Requirements
Expand Down
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
]

# CAP on CPython 3.11: jpype1 1.8.0 ends the process with a segmentation fault there when an exception that CPython
# holds without an instance goes through JPype, such as the KeyboardInterrupt of a Ctrl-C while a query calls a Python
# function, or the StopIteration of next(). CPython 3.12 and later always hold an instance and are not affected.
# REMOVE THE CAP when a newer jpype1 passes tests/test_jpype_bare_exceptions.py on Python 3.11.
dependencies = [
"jpype1>=1.5.0",
"jpype1>=1.5.0,<1.8; python_version < '3.12'",
"jpype1>=1.5.0; python_version >= '3.12'",
]

[tool.uv]
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"test_jar_provenance.py": "jar fingerprint of the JVM wheel",
"test_jar_closure.py": "jar closure of the JVM wheel",
"test_java_package_shadowing.py": "JPype package import hooks",
"test_jpype_bare_exceptions.py": "the installed JPype of the JVM wheel",
"test_wheel_platform_tag.py": "JVM wheel tag",
"test_wheel_tags.py": "JVM wheel tag (py3-none-<platform>)",
"test_wheel_size.py": "JVM wheel size",
Expand Down
83 changes: 83 additions & 0 deletions tests/test_jpype_bare_exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
"""The installed JPype survives an exception that CPython holds without an instance.

jpype1 1.8.0 on CPython 3.11 ends the process with a segmentation fault when such an exception
goes through JPype's own code: the ``KeyboardInterrupt`` of a Ctrl-C, or the ``StopIteration`` of
``next()``. CPython 3.12 and later always hold an instance. ``pyproject.toml`` keeps jpype1 below
1.8 on CPython 3.11, and this test fails when the installed JPype has the fault.

Each case runs in a child process, because the fault ends the process it happens in. Nothing
depends on timing: ``signal.raise_signal`` and ``next()`` raise at a fixed point.
"""

import subprocess # nosec B404 - test-controlled child process
import sys

import pytest

_CHILD = r"""
import signal
import sys

import jpype

from arcadedb.jvm import start_jvm

start_jvm(heap_size="256m")
# a parent that ignores SIGINT hands that to its child, and Python then installs no handler
signal.signal(signal.SIGINT, signal.default_int_handler)


def exhausted_iterator():
next(iter([]))


def ctrl_c():
signal.raise_signal(signal.SIGINT)


class Number:
def __index__(self):
signal.raise_signal(signal.SIGINT)
return 1

__int__ = __index__


case = sys.argv[1]
print("jpype", jpype.__version__, flush=True)
try:
if case == "conversion":
jpype.JInt(Number())
else:
function = {"stop_iteration": exhausted_iterator, "ctrl_c": ctrl_c}[case]
supplier = jpype.JProxy("java.util.function.Supplier", dict={"get": function})
jpype.JClass("java.util.Optional").empty().orElseGet(supplier)
except BaseException as exc:
print("raised", type(exc).__name__, flush=True)
"""


@pytest.mark.parametrize(
"case, expected",
[
# a Java method calls a Python function
("stop_iteration", "StopIteration"),
("ctrl_c", "KeyboardInterrupt"),
# no Java-to-Python call: JPype converts a Python object for Java
("conversion", "KeyboardInterrupt"),
],
)
def test_jpype_raises_instead_of_ending_the_process(case, expected):
result = (
subprocess.run( # nosec B603 - fixed argv, no shell, test-owned code string
[sys.executable, "-c", _CHILD, case],
capture_output=True,
text=True,
timeout=300,
check=False,
)
)
said = f"exit {result.returncode}\n{result.stdout}\n{result.stderr[-2000:]}"
# the crash ends the child process, so its exit code is not 0
assert result.returncode == 0, said
assert result.stdout.split()[-2:] == ["raised", expected], said
Loading