-
Notifications
You must be signed in to change notification settings - Fork 0
Description
In #69 and #89, I model function references and exception classes as a str presumed to hold the fully qualified name (i.e. f"{obj.__module__}.{obj.__qualname__}"). My main rationale here is to have import-free recipe models, which can be directly and fully used without the security risk of importing arbitrary python objects. @XzzX, do you see this being useful, e.g. for the node store?
The alternative would be to replace AtomicNode.fully_qualified_name: str with AtomicNode.function: typing.FunctionType, and ExceptionCase.exceptions: list[str] with ExceptionCase.exceptions: list[type[BaseException]]. These would then need pydantic (de)serializers, but this is super straightforward with the f-string above and with pyiron_snippets.retrieve.import_from_string.
So if there isn't any real benefit to having them fully stringified even in the python object form, I'd be happy to go back and replace the strings with the living python objects. I just don't feel like I'm in a good position to evaluate how big the utility is of keeping them stringified. If it's helpful, I can live with it a-ok.