perago.require_glob#
- perago.require_glob(pattern, *, min_count=1, max_count=None)[源代码]#
Require a bounded number of workspace files matching a glob pattern.
The pattern is evaluated with
pathlib.Path.glob()inside the local attempt workspace when guardrails run. The default lower bound requires at least one match.- Parameters:
- patternstr or os.PathLike[str]
Workspace-relative glob pattern using
/separators.- min_countint, default=1
Minimum number of matches required for the guardrail to pass.
- max_countint or None, default=None
Maximum number of matches allowed.
Nonedisables the upper bound.
- Returns:
- Workspace guardrail
Guardrail consumed by
perago.WorkspaceSpec.
- Raises:
- TaskDefinitionError
If
patternis not workspace-relative, count bounds are invalid, ormin_countis greater thanmax_count.
- 参数:
- 返回类型:
_WorkspaceGuardrail
参见
require_fileRequire one file.
require_dirRequire one directory.
forbid_globReject files matching a glob.
Examples
>>> WorkspaceSpec(pre=[require_glob("raw/**/*.parquet", min_count=1)]) WorkspaceSpec(...)