pySimBlocks.project.generate_run_script

pySimBlocks.project.generate_run_script.generate_python_content(project_yaml_path: str, enable_plots: bool = True) str[source]

Render the run script template for a given project YAML path.

Parameters:
  • project_yaml_path – Path string to the project YAML file, embedded verbatim into the generated script.

  • enable_plots – Whether to include the plotting call in the script.

Returns:

The rendered run script as a string.

pySimBlocks.project.generate_run_script.generate_run_script(*, project_dir: Path | None = None, project_yaml: Path | None = None, output: Path | None = None) None[source]

Generate a canonical run.py script for a pySimBlocks project.

Exactly one of project_dir or project_yaml must be provided.

Parameters:
  • project_dir – Path to a project folder containing project.yaml. The output script defaults to <project_dir>/run.py.

  • project_yaml – Explicit path to a project.yaml file.

  • output – Output path for the generated script. Defaults to <project_dir>/run.py in project_dir mode or run.py in the current directory in project_yaml mode.

Raises:
  • ValueError – If both project_dir and project_yaml are given, or if neither is given.

  • FileNotFoundError – If the resolved project YAML file does not exist.