From a0f42a9989b5c14e1131a6ffaf0313bbf0d665da Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Sun, 1 Mar 2026 19:59:06 +0100 Subject: [PATCH 1/5] Add support for the bool data type for numpy>=2.0 (#71) The fix adds `numpy.bool` to cover numpy>=2.0 data types. (cherry picked from commit 4df73508b29d6e1ab019939c36da667dbf6873c4) --- src/aiida_pythonjob/data/serializer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aiida_pythonjob/data/serializer.py b/src/aiida_pythonjob/data/serializer.py index 8b117c0..e3aeb8c 100644 --- a/src/aiida_pythonjob/data/serializer.py +++ b/src/aiida_pythonjob/data/serializer.py @@ -21,7 +21,8 @@ "numpy.float32": "aiida.orm.nodes.data.float.Float", "numpy.float64": "aiida.orm.nodes.data.float.Float", "numpy.int64": "aiida.orm.nodes.data.int.Int", - "numpy.bool_": "aiida.orm.nodes.data.bool.Bool", + "numpy.bool_": "aiida.orm.nodes.data.bool.Bool", # numpy<2.0 + "numpy.bool": "aiida.orm.nodes.data.bool.Bool", # numpy>=2.0 "numpy.ndarray": "aiida.orm.nodes.data.array.array.ArrayData", } From e5bbda87490d75ad6bdd2ec6b223450105fb8e17 Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Sun, 1 Mar 2026 20:14:11 +0100 Subject: [PATCH 2/5] Make the recursion limit workaround dependent on the aiida-core version (#72) With aiida-core v2.8.0 we switched from nest-asyncio to greenlet and therefore do not need to dynamically increase the recursion limit anymore. (cherry picked from commit 86f21bd4843b5849c9e2822bd3dc6fe696a801ba) --- src/aiida_pythonjob/decorator.py | 41 +++++++++++++++++++------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/src/aiida_pythonjob/decorator.py b/src/aiida_pythonjob/decorator.py index e89b573..1c788b4 100644 --- a/src/aiida_pythonjob/decorator.py +++ b/src/aiida_pythonjob/decorator.py @@ -7,16 +7,24 @@ import typing as t from typing import List -from aiida.engine.processes.functions import FunctionType, get_stack_size +import aiida +from aiida.engine.processes.functions import FunctionType from aiida.manage import get_manager from aiida.orm import ProcessNode from node_graph.socket_spec import SocketSpec +from packaging.version import parse as parse_version from aiida_pythonjob.calculations.pyfunction import PyFunction from aiida_pythonjob.launch import create_inputs, prepare_pyfunction_inputs LOGGER = logging.getLogger(__name__) +_AIIDA_VERSION = parse_version(aiida.__version__) +_NEEDS_RECURSION_LIMIT_WORKAROUND = _AIIDA_VERSION < parse_version("2.8.0") + +if _NEEDS_RECURSION_LIMIT_WORKAROUND: + from aiida.engine.processes.functions import get_stack_size + # The following code is modified from the aiida-core.engine.processes.functions module def pyfunction( @@ -42,25 +50,26 @@ def run_get_node(*args, **kwargs) -> tuple[dict[str, t.Any] | None, "ProcessNode :param kwargs: input keyword arguments to construct the FunctionProcess :return: tuple of the outputs of the process and the process node """ - frame_delta = 1000 - frame_count = get_stack_size() - stack_limit = sys.getrecursionlimit() - LOGGER.info("Executing process function, current stack status: %d frames of %d", frame_count, stack_limit) - - # If the current frame count is more than 80% of the stack limit, or comes within 200 frames, increase the - # stack limit by ``frame_delta``. - if frame_count > min(0.8 * stack_limit, stack_limit - 200): - LOGGER.warning( - "Current stack contains %d frames which is close to the limit of %d. Increasing the limit by %d", - frame_count, - stack_limit, - frame_delta, + if _NEEDS_RECURSION_LIMIT_WORKAROUND: + frame_delta = 1000 + frame_count = get_stack_size() + stack_limit = sys.getrecursionlimit() + LOGGER.info( + "Executing process function, current stack status: %d frames of %d", frame_count, stack_limit ) - sys.setrecursionlimit(stack_limit + frame_delta) + + if frame_count > min(0.8 * stack_limit, stack_limit - 200): + LOGGER.warning( + "Current stack contains %d frames which is close to the limit of %d. Increasing the limit by %d", + frame_count, + stack_limit, + frame_delta, + ) + sys.setrecursionlimit(stack_limit + frame_delta) manager = get_manager() runner = manager.get_runner() - # # Remove all the known inputs from the kwargs + # Remove all the known inputs from the kwargs outputs_spec = kwargs.pop("outputs_spec", None) or outputs inputs_spec = kwargs.pop("inputs_spec", None) or inputs metadata = kwargs.pop("metadata", None) From c0625a2116277b7cd904980fa2f993a48581a158 Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Sun, 1 Mar 2026 20:52:22 +0100 Subject: [PATCH 3/5] Consider pre-release version when disabling recursion limit workaround (#73) The fix in 86f21bd4 only considered 2.8.0 and above, for any pre-release the workaround was not correctly disabled. (cherry picked from commit 42c4da55673bd1034e1c120b4fbb98ec088a8ceb) --- src/aiida_pythonjob/decorator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aiida_pythonjob/decorator.py b/src/aiida_pythonjob/decorator.py index 1c788b4..98528fb 100644 --- a/src/aiida_pythonjob/decorator.py +++ b/src/aiida_pythonjob/decorator.py @@ -20,7 +20,7 @@ LOGGER = logging.getLogger(__name__) _AIIDA_VERSION = parse_version(aiida.__version__) -_NEEDS_RECURSION_LIMIT_WORKAROUND = _AIIDA_VERSION < parse_version("2.8.0") +_NEEDS_RECURSION_LIMIT_WORKAROUND = _AIIDA_VERSION < parse_version("2.8.0rc0") if _NEEDS_RECURSION_LIMIT_WORKAROUND: from aiida.engine.processes.functions import get_stack_size From 309bc7e5308554f871d7dbd3f08eef66580461e9 Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Tue, 3 Mar 2026 11:53:06 +0100 Subject: [PATCH 4/5] Release 0.4.9 --- src/aiida_pythonjob/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aiida_pythonjob/__init__.py b/src/aiida_pythonjob/__init__.py index 6708707..4a3eed0 100644 --- a/src/aiida_pythonjob/__init__.py +++ b/src/aiida_pythonjob/__init__.py @@ -1,6 +1,6 @@ """AiiDA plugin that run Python function on remote computers.""" -__version__ = "0.4.8" +__version__ = "0.4.9" from node_graph import socket_spec as spec From a63da93a4feb925f35fe3c3ef2c1045594769e91 Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Wed, 4 Mar 2026 09:21:26 +0100 Subject: [PATCH 5/5] Test aiida-core v2.8.0rc0 --- .github/workflows/ci-tests.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index a7c6617..0b5e393 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -2,7 +2,7 @@ name: tests on: push: - branches: [main] + branches: ['main', 'support/v*'] pull_request: jobs: diff --git a/pyproject.toml b/pyproject.toml index 2137596..0188007 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ keywords = ["aiida", "plugin"] requires-python = ">=3.9" dependencies = [ - "aiida-core>=2.7.1,<3", + "aiida-core==2.8.0rc0", "ase", "node-graph~=0.5.0", ]