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. None disables the upper bound.

Returns:
Workspace guardrail

Guardrail consumed by perago.WorkspaceSpec.

Raises:
TaskDefinitionError

If pattern is not workspace-relative, count bounds are invalid, or min_count is greater than max_count.

参数:
返回类型:

_WorkspaceGuardrail

参见

require_file

Require one file.

require_dir

Require one directory.

forbid_glob

Reject files matching a glob.

Examples

>>> WorkspaceSpec(pre=[require_glob("raw/**/*.parquet", min_count=1)])
WorkspaceSpec(...)