knitout_interpreter.run_knitout module

A Module containing the run_knitout function for running a knitout file through the knitout interpreter.

run_knitout(knitout_file_name, debugger=None, relax_violations=False)[source]

Execute knitout instructions from a given file.

This function provides a convenient interface for processing a knitout file through the knitout interpreter, returning the executed instructions and resulting machine state and knit graph.

Parameters:
  • knitout_file_name (str) – Path to the file that contains knitout instructions.

  • debugger (Knitout_Debugger, optional) – An optional debugger to attach to the knitout process. Defaults to no debugger.

  • relax_violations (bool | Iterable[Violation], optional) – If True, all violations are relaxed. If violations are given, those violations are relaxed. Defaults to False (full validation).

Returns:

A 3-element tuple containing the executed instructions, final machine state, and knit graph. * A list of Knitout_Line objects representing all processed instructions. * A Knitting_Machine object containing the final state of the virtual knitting machine after execution. * A Knit_Graph object representing the resulting fabric structure formed by the knitting operations.

Return type:

tuple[Knitout_Program, Knitting_Machine, Knit_Graph]