Skip to content

API

tsk.monster - A cute little tsk runner

Cmd

A cmd is an action that is conditionally run based on a predicate.

Parameters:

Name Type Description Default
action Action

The action that needs to be run.

required
need_to_run Predicate

A predicate that determines if the action needs to be run.

required

Job dataclass

A job is a set of commands that need to be run in order to produce a set of artifacts. Artifacts can be files, directories, or any other kind of object. A job can also depend on other artifacts that are produced by other jobs.

Parameters:

Name Type Description Default
needs Set[Any]

A set of artifacts that are required by this job.

required
prods Set[Any]

A set of artifacts that are produced by this job.

required
cmds Generator[Cmd, None, None]

A generator of commands that need to be run in order to produce the artifacts.

required

exist(*paths)

Signal that a set of paths already exist.

Parameters:

Name Type Description Default
paths Path | str

A set of paths that already exist.

()

Returns:

Type Description

A dummy job that does nothing.

monster(*jobs, pool)

Executes a set of jobs in parallel.

Parameters:

Name Type Description Default
jobs Job

A set of jobs that need to be run.

()

run(*actions, needs=[], prods=[])

Create a job that always runs a set of actions.

Parameters:

Name Type Description Default
actions Action | str

A set of actions that need to be run.

()
needs Paths

A set of artifacts that are required by this job.

[]
prods Paths

A set of artifacts that are produced by this job.

[]

tsk(*actions, desc='', needs=[], prods=[], updts=[])

Create a job. The job will only run if any of the following conditions are met: - Any of the artifacts in needs has been updated since the last run. - Any of the artifacts in prods does not exist. - The updts list is not empty.

Parameters:

Name Type Description Default
actions Action | str

A set of actions that need to be run.

()
desc str

A description of the job.

''
needs Paths

A set of artifacts that are required by this job.

[]
prods Paths

A set of artifacts that are produced by this job.

[]
updts Paths

A set of artifacts that are updated by this job.

[]