Skip to content

Mention new feature of process functions accepting base Python types #459

@sphuber

Description

@sphuber

AiiDA v2.1 added a feature where inputs of process functions are automatically serialized (aiidateam/aiida-core#5688). See the docs.
Essentially, what used to be written as:

from aiida.engine import calcfunction
from aiida.orm import Int

@calcfunction
def add(x, y):
    return x + y

add(Int(1), Int(2))

can now be written as

from aiida.engine import calcfunction

@calcfunction
def add(x, y):
    return x + y

add(1, 2)

We should update the tutorials to explain this. Probably still first show the original version, making it clear that the function is a process and requires inputs as nodes, but then showing that for base types, there is a shortcut.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions