schedr.types

Types for task outputs: ProcessResult, the Json alias, and size constants.

Json is the bound type checkers use for @task return types; the guarantee is the parse-time check (see archive/PROJECT.md, Output serialization).

schedr.types.KiB = 1024

One kibibyte, in bytes.

schedr.types.MiB = 1048576

One mebibyte, in bytes.

schedr.types.GiB = 1073741824

One gibibyte, in bytes.

class schedr.types.DataclassInstance(*args, **kwargs)

Bases: Protocol

Any dataclass instance (for type checkers).

type schedr.types.Json = bool | int | float | str | datetime | date | timedelta | Sequence[Json] | Mapping[str, object] | DataclassInstance | None

What a @task may return, for type checkers.

Sequence and Mapping (not list / dict, which are invariant) accept e.g. list[int]; Mapping[str, object] accepts TypedDict classes, whose values the type checker can’t check (the parse-time check does).

class schedr.types.ProcessResult(stdout, stderr, exit_code, stdout_truncated=False, stderr_truncated=False)

Bases: object

The output of a command or script task.

Parameters:
  • stdout (str)

  • stderr (str)

  • exit_code (int)

  • stdout_truncated (bool)

  • stderr_truncated (bool)

stdout

The standard output (its last part, if truncated).

Type:

str

stderr

The standard error (its last part, if truncated).

Type:

str

exit_code

The process’s exit code.

Type:

int

stdout_truncated

Whether stdout exceeded the output size limit.

Type:

bool

stderr_truncated

Whether stderr exceeded the output size limit.

Type:

bool