Problem
When passing a pathlib.Path as an input to a WorkGraph task (e.g., via shelljob nodes), serialization fails with:
ValueError: Cannot serialize the provided object.
Type: pathlib.PosixPath
Tried entry-point key: 'pathlib.PosixPath' -- not found in provided serializers.
Current workaround
Users must manually convert Path objects before passing them:
script_node = orm.SinglefileData(SCRIPT_PATH)
Expected behavior
pathlib.Path is a common Python type. WorkGraph (or aiida-pythonjob's serializer) should serialize it automatically, similar to how launch_shell_job from aiida-shell already handles Path inputs.
Context
This came up while writing the AiiDA core tutorials (Module 3: WorkGraph workflows). The simulation script path is a pathlib.Path from a constants file, and passing it to a shelljob inside @task.graph() fails at serialization time.
Problem
When passing a
pathlib.Pathas an input to a WorkGraph task (e.g., viashelljobnodes), serialization fails with:Current workaround
Users must manually convert
Pathobjects before passing them:Expected behavior
pathlib.Pathis a common Python type. WorkGraph (oraiida-pythonjob's serializer) should serialize it automatically, similar to howlaunch_shell_jobfromaiida-shellalready handlesPathinputs.Context
This came up while writing the AiiDA core tutorials (Module 3: WorkGraph workflows). The simulation script path is a
pathlib.Pathfrom a constants file, and passing it to ashelljobinside@task.graph()fails at serialization time.