perago.require_file#
- perago.require_file(path)[源代码]#
Require one workspace-relative file to exist.
require_filecreates a guardrail object forWorkspaceSpec.preorWorkspaceSpec.post. Paths are interpreted inside the task's workspace prefix and must use portable POSIX-style relative syntax.- Parameters:
- pathstr or os.PathLike[str]
Workspace-relative file path. Absolute paths,
..segments, backslash-separated strings, and drive-qualified paths are rejected.
- Returns:
- Workspace guardrail
Guardrail consumed by
perago.WorkspaceSpec.
- Raises:
- TaskDefinitionError
If
pathis empty or is not a valid workspace-relative path.
- 参数:
- 返回类型:
_WorkspaceGuardrail
参见
require_dirRequire one directory.
require_globRequire files matching a glob.
forbid_globReject files matching a glob.
Examples
>>> WorkspaceSpec(prefix="/", pre=[require_file("input/data.csv")]) WorkspaceSpec(...)