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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ test.test_selectors.DefaultSelectorTestCase.test_modify @ darwin-arm64,linux-aar
test.test_selectors.DefaultSelectorTestCase.test_register @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github
test.test_selectors.DefaultSelectorTestCase.test_select @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github
test.test_selectors.DefaultSelectorTestCase.test_select_interrupt_noraise @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github
test.test_selectors.DefaultSelectorTestCase.test_select_read_write @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github
test.test_selectors.DefaultSelectorTestCase.test_select_read_write @ linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github
# Darwin arm64 kqueue intermittently misses the read event
!test.test_selectors.DefaultSelectorTestCase.test_select_read_write @ darwin-arm64
test.test_selectors.DefaultSelectorTestCase.test_selector @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github
test.test_selectors.DefaultSelectorTestCase.test_timeout @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github
test.test_selectors.DefaultSelectorTestCase.test_unregister @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github
Expand Down
13 changes: 13 additions & 0 deletions graalpython/lib-graalpython/patches/fastparquet-2026.5.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/setup.py b/setup.py
index 11c1228..b51b646 100644
--- a/setup.py
+++ b/setup.py
@@ -40,7 +40,7 @@ else:

import platform
_machine = platform.machine()
- _march = ['-march=x86-64-v2'] if _machine == 'x86_64' else []
+ _march = ['-march=x86-64-v2'] if _machine == 'x86_64' and sys.implementation.name != 'graalpy' else []
modules = [
Extension(mod, fix_exts(sources), extra_compile_args=['-O3'] + _march)
for mod, sources in modules_to_build.items()]
33 changes: 33 additions & 0 deletions graalpython/lib-graalpython/patches/llvmlite-0.47.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/ffi/build.py b/ffi/build.py
index ef0c262..6dc70b8 100755
--- a/ffi/build.py
+++ b/ffi/build.py
@@ -205,5 +205,28 @@ def main():
raise RuntimeError("unsupported platform: %r" % (sys.platform,))


+def build_llvm():
+ import urllib.request
+ import tarfile
+ import shutil
+ llvm_version = '20.1.8'
+ llvm_tag = f'llvmorg-{llvm_version}'
+ llvmdir = f'llvm-project-{llvm_tag}'
+ tarname = f'{llvm_tag}.tar.gz'
+ shutil.rmtree(tarname, ignore_errors=True)
+ shutil.rmtree(llvmdir, ignore_errors=True)
+ print(f"Downloading LLVM {llvm_version}")
+ urllib.request.urlretrieve(f'https://github.com/llvm/llvm-project/archive/refs/tags/{llvm_tag}.tar.gz', tarname)
+ with tarfile.open(tarname) as tar:
+ tar.extractall()
+ print(f"Building LLVM {llvm_version}")
+ subprocess.check_call(['cmake', '-S', f'{llvmdir}/llvm', '-B', 'llvm-build', '-DCMAKE_BUILD_TYPE=Release', '-DLLVM_TARGETS_TO_BUILD=host'])
+ subprocess.check_call(['cmake', '--build', 'llvm-build'])
+ os.environ['LLVM_CONFIG'] = os.path.abspath('llvm-build/bin/llvm-config')
+
+
if __name__ == "__main__":
+ # GraalPy change: fetch and build a supported LLVM rather than relying on
+ # whatever LLVM is available in the system image.
+ build_llvm()
main()
27 changes: 25 additions & 2 deletions graalpython/lib-graalpython/patches/metadata.toml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ patch = 'flake8-6.0.0.patch'
license = 'MIT'
subdir = 'src'

[[fastparquet.rules]]
version = '== 2026.5.0'
patch = 'fastparquet-2026.5.0.patch'
license = 'Apache-2.0'

[[greenlet.rules]]
version = '>= 3.1.1'
patch = 'greenlet-3.1.1.patch'
Expand Down Expand Up @@ -298,8 +303,14 @@ patch = 'lightfm-1.15.patch'
license = 'MIT'

[[llvmlite.rules]]
# llvmlite only supports up to LLVM 14. That's quite old and installing it in the system typically results leads
# to dependency hell because rust requires newer LLVM. We add downloading and building LLVM 14 to the setup script.
version = '>= 0.45'
patch = 'llvmlite-0.47.patch'
license = 'BSD-2-Clause'

[[llvmlite.rules]]
# Older llvmlite versions support up to LLVM 14. Installing it in the system typically leads to dependency hell
# because rust requires newer LLVM. We add downloading and building LLVM 14 to the setup script.
version = '< 0.45'
patch = 'llvmlite.patch'
license = 'BSD-2-Clause'

Expand Down Expand Up @@ -382,6 +393,13 @@ license = 'Apache-2.0'
patch = 'nanobind.patch'
license = 'BSD-3-Clause'

[[numba.rules]]
# Not upstreamable, we disable the JIT
note = "Numba JIT relies on bytecode parsing and is disabled on GraalPy."
version = '== 0.65.1'
patch = 'numba-0.65.1.patch'
license = 'BSD-2-Clause'

[[numba.rules]]
# Not upstreamable, we disable the JIT
note = "Numba JIT relies on bytecode parsing and is disabled on GraalPy."
Expand Down Expand Up @@ -915,6 +933,11 @@ version = '>= 70.1.0'
patch = 'setuptools.patch'
license = 'MIT'

[[tables.rules]]
version = '== 3.11.1'
patch = 'tables-3.11.1.patch'
license = 'BSD-3-Clause'

[[tensorflow.rules]]
version = '== 2.15.0'
patch = 'tensorflow-2.15.0.patch'
Expand Down
83 changes: 83 additions & 0 deletions graalpython/lib-graalpython/patches/numba-0.65.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
diff --git a/numba/_dispatcher.cpp b/numba/_dispatcher.cpp
index 0aa4aad..db6243b 100644
--- a/numba/_dispatcher.cpp
+++ b/numba/_dispatcher.cpp
@@ -27,7 +27,11 @@
*
*/

-#if (PY_MAJOR_VERSION >= 3) && ((PY_MINOR_VERSION == 12) || (PY_MINOR_VERSION == 13) || (PY_MINOR_VERSION == 14))
+#if defined(NUMBA_GRAALPY) && (PY_MAJOR_VERSION >= 3) && ((PY_MINOR_VERSION == 12) || (PY_MINOR_VERSION == 13) || (PY_MINOR_VERSION == 14))
+
+#define C_TRACE(x, call, frame) x = call
+
+#elif (PY_MAJOR_VERSION >= 3) && ((PY_MINOR_VERSION == 12) || (PY_MINOR_VERSION == 13) || (PY_MINOR_VERSION == 14))

#ifndef Py_BUILD_CORE
#define Py_BUILD_CORE 1
@@ -791,6 +795,23 @@ call_cfunc(Dispatcher *self, PyObject *cfunc, PyObject *args, PyObject *kws, PyO
}
}

+#elif defined(NUMBA_GRAALPY) && (PY_MAJOR_VERSION >= 3) && ((PY_MINOR_VERSION == 12) || (PY_MINOR_VERSION == 13) || (PY_MINOR_VERSION == 14))
+
+/* GraalPy change: GraalPy does not expose CPython's private sys.monitoring
+ * structures. Since Numba JIT decorators are disabled on GraalPy, use a simple
+ * direct call path here.
+ */
+static PyObject *
+call_cfunc(Dispatcher *self, PyObject *cfunc, PyObject *args, PyObject *kws, PyObject *locals)
+{
+ PyCFunctionWithKeywords fn = NULL;
+
+ assert(PyCFunction_Check(cfunc));
+ assert(PyCFunction_GET_FLAGS(cfunc) == (METH_VARARGS | METH_KEYWORDS));
+ fn = (PyCFunctionWithKeywords) PyCFunction_GET_FUNCTION(cfunc);
+ return fn(PyCFunction_GET_SELF(cfunc), args, kws);
+}
+
#elif (PY_MAJOR_VERSION >= 3) && ((PY_MINOR_VERSION == 12) || (PY_MINOR_VERSION == 13) || (PY_MINOR_VERSION == 14))

// Python 3.12 has a completely new approach to tracing and profiling due to
diff --git a/numba/core/decorators.py b/numba/core/decorators.py
index d70af73..8a46999 100644
--- a/numba/core/decorators.py
+++ b/numba/core/decorators.py
@@ -215,6 +215,10 @@ def _jit(sigs, locals, target, cache, targetoptions, **dispatcher_args):
f"{type(func)})."
)

+ if sys.implementation.name == 'graalpy':
+ if target == 'npyufunc':
+ raise NotImplementedError("Cannot create npyufunc under graalpy")
+ return func
if config.ENABLE_CUDASIM and target == 'cuda':
from numba import cuda
return cuda.jit(func)
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..562214d
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,8 @@
+[build-system]
+requires = ["setuptools >= 40.6.0", "wheel", "llvmlite<0.48,>=0.47.0dev0", "numpy<2.5,>=2.0.0rc1", "versioneer"]
+build-backend = "setuptools.build_meta"
+
+[tool.versioneer]
+VCS = 'git'
+versionfile_source = 'numba/_version.py'
+versionfile_build ='numba/_version.py'
diff --git a/setup.py b/setup.py
index 282b8f4..33ea09e 100644
--- a/setup.py
+++ b/setup.py
@@ -167,6 +167,8 @@ def get_ext_modules():
"numba/_hashtable.h"],
extra_compile_args=['-std=c++11'],
**np_compile_args)
+ if sys.implementation.name == 'graalpy':
+ ext_dispatcher.define_macros.append(('NUMBA_GRAALPY', '1'))

ext_helperlib = Extension(name="numba._helperlib",
sources=["numba/_helpermod.c",
15 changes: 15 additions & 0 deletions graalpython/lib-graalpython/patches/tables-3.11.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/hdf5-blosc2/src/blosc2_filter.c b/hdf5-blosc2/src/blosc2_filter.c
index 03bf789..d3903d4 100644
--- a/hdf5-blosc2/src/blosc2_filter.c
+++ b/hdf5-blosc2/src/blosc2_filter.c
@@ -17,6 +17,10 @@
#include "blosc2_filter.h"
#include "b2nd.h"

+#ifndef BLOSC2_MAX_DIM
+#define BLOSC2_MAX_DIM B2ND_MAX_DIM
+#endif
+
#if defined(__GNUC__)
#define PUSH_ERR(func, minor, str, ...) H5Epush(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLINE, minor, str, ##__VA_ARGS__)
#elif defined(_MSC_VER)
Loading