#5795·kedro

Node without an explicit name raises AttributeError when its function is a callable object

Author: MohammadHijjawi97Created Sep 28, 2026Updated Sep 28, 2026
LabelsCommunity

Description

Creating a node from a callable object (an instance of a class that defines __call__) without a name fails as soon as the node's name is used, for example when building a Pipeline:

python
from kedro.pipeline import node, Pipeline

class Double:
    def __call__(self, x):
        return x * 2

Pipeline([node(Double(), "a", "b")])
# AttributeError: 'Double' object has no attribute '__name__'

The same happens with functools.partial(Double(), ...). Node._set_unique_name reads func.__name__ directly, but callable objects have no __name__. This worked before 1.0, when the default name was built from str(node).

Expected

A default name based on the class name, e.g. Double__<hash>.

Possible fix

Fall back to type(func).__name__ when __name__ is missing; names for plain functions, lambdas and partials would stay the same.

Environment

kedro main (1.7.0), Python 3.13