Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Positional argument does not work anymore using run #6246

Open
superstar54 opened this issue Jan 5, 2024 · 1 comment
Open

Positional argument does not work anymore using run #6246

superstar54 opened this issue Jan 5, 2024 · 1 comment
Labels

Comments

@superstar54
Copy link
Member

aiida-core: 2.5.0

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

@calcfunction
def add(x, y):
    return Int(x * y)

run(add, 1, 2)

will raise

TypeError: run() takes from 1 to 2 positional arguments but 3 were given

Same to run_get_node etc.

This does not happened before v2.5.0. This is introduced by #6202 .

@superstar54 superstar54 changed the title Position argument does not work anymore using run Positional argument does not work anymore using run Jan 5, 2024
@sphuber
Copy link
Contributor

sphuber commented Jan 5, 2024

This came up during the discussion in on of the AiiDA core meetings. We realized that #6202 would indeed break positional arguments for run, but we accepted this breaking change as the changes in #6202 were overall an improvement and had become necessary due to another breaking change. Since this only affects process functions, I think this is ok. There is no real reason to use run for process functions. You can still directly call them, e.g., add(1, 2).

Now, if we can find a workaround to keep support for positional arguments in run without reverting the changes of #6202 , then that would be great. But I am not sure it is possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants