Skip to content

Automatically coerce string/PathLike objects to File/Directory objects when passed to Any-typed fields #816

Open
@tclose

Description

@tclose

I'm not 100% on this, but think it is probably a good idea. When using properly typed tasks, if you pass a string to a File/Directory-typed field, it will be coerced to a fileformats object and then properly checked for existence/format and have its contents hashed. However, if you don't type your task and just leave the field as typing.Any, the string representing the file path will be just treated as a string and the node won't be rerun if its contents change.

To avoid this, for typing.Any-typed fields, we could check all strings and see if they correspond to an existing file path, and if so implicitly convert it to a File/Directory object before passing it the task, in which its contents will be hashed when building the task checksum.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

v1.0

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions