# cwltool.main

Entry point for cwltool.

## Attributes

`docker_exe` |

## Classes

`ProvLogFormatter` | Enforce ISO8601 with both T and Z.

## Functions

`append_word_to_default_user_agent`(word) | Append the specified word to the requests http user agent string if it's not already there.
`generate_example_input`(inptype, default) | Convert a single input schema into an example.
`realize_input_schema`(input_types, schema_defs) | Replace references to named typed with the actual types.
`generate_input_template`(tool) | Generate an example input object for the given CWL process.
`load_job_order`(args, stdin, fetcher_constructor, ...) |
`init_job_order`(job_order_object, args, process, ...[, ...]) |
`make_relative`(base, obj) | Relativize the location URI of a File or Directory object.
`printdeps`(obj, document_loader, stdout, relative_deps, uri) | Print a JSON representation of the dependencies of the CWL document.
`prov_deps`(obj, document_loader, uri[, basedir]) |
`find_deps`(obj, document_loader, uri[, basedir, nestdirs]) | Find the dependencies of the CWL document.
`print_pack`(loadingContext, uri) | Return a CWL serialization of the CWL document in JSON.
`supported_cwl_versions`(enable_dev) | Return a list of currently supported CWL versions.
`setup_schema`(args, custom_schema_callback) |
`setup_loadingContext`(loadingContext, runtimeContext, args) | Prepare a LoadingContext from the given arguments.
`make_template`(tool, target) | Make a template CWL input object for the give Process.
`inherit_reqshints`(tool, parent) | Copy down requirements and hints from ancestors of a given process.
`choose_target`(args, tool, loading_context) | Walk the Workflow, extract the subset matches all the args.targets.
`choose_step`(args, tool, loading_context) | Walk the given Workflow and extract just args.single_step.
`choose_process`(args, tool, loadingContext) | Walk the given Workflow and extract just args.single_process.
`check_working_directories`(runtimeContext) | Make any needed working directories.
`print_targets`(tool, stdout, loading_context[, prefix]) | Recursively find targets for --subgraph and friends.
`main`([argsl, args, job_order_object, stdin, stdout, ...]) |
`find_default_container`(builder[, default_container, ...]) | Find a container.
`windows_check`() | See if we are running on MS Windows and warn about the lack of support.
`run`(*args, **kwargs) | Run cwltool.

## Module Contents

cwltool.main.docker_exe: str

cwltool.main.append_word_to_default_user_agent(word)

  Append the specified word to the requests http user agent string if it’s not already there.

  Parameters:

    word (str)

  Return type:

    None

cwltool.main.generate_example_input(inptype, default)

  Convert a single input schema into an example.

  Parameters:

    - inptype (cwl_utils.types.CWLOutputType | None)

    - default (cwl_utils.types.CWLOutputType | None)

  Return type:

    tuple[Any, str]

cwltool.main.realize_input_schema(input_types, schema_defs)

  Replace references to named typed with the actual types.

  Parameters:

    - input_types (collections.abc.MutableSequence[str | cwl_utils.types.CWLObjectType])

    - schema_defs (collections.abc.MutableMapping[str, cwl_utils.types.CWLObjectType])

  Return type:

    collections.abc.MutableSequence[str | cwl_utils.types.CWLObjectType]

cwltool.main.generate_input_template(tool)

  Generate an example input object for the given CWL process.

  Parameters:

    tool (cwltool.process.Process)

  Return type:

    cwl_utils.types.CWLObjectType

cwltool.main.load_job_order(args, stdin, fetcher_constructor, overrides_list, tool_file_uri)
  Parameters:

    - args (argparse.Namespace)

    - stdin (IO[Any])

    - fetcher_constructor (schema_salad.utils.FetcherCallableType | None)

    - overrides_list (list[cwl_utils.types.CWLObjectType])

    - tool_file_uri (str)

  Return type:

    tuple[cwl_utils.types.CWLObjectType | None, str, schema_salad.ref_resolver.Loader]

cwltool.main.init_job_order(job_order_object, args, process, loader, stdout, print_input_deps=False, relative_deps='primary', make_fs_access=StdFsAccess, input_basedir='', secret_store=None, input_required=True, runtime_context=None)
  Parameters:

    - job_order_object (cwl_utils.types.CWLObjectType | None)

    - args (argparse.Namespace)

    - process (cwltool.process.Process)

    - loader (schema_salad.ref_resolver.Loader)

    - stdout (IO[str])

    - print_input_deps (bool)

    - relative_deps (str)

    - make_fs_access (collections.abc.Callable[[str], cwltool.stdfsaccess.StdFsAccess])

    - input_basedir (str)

    - secret_store (cwltool.secrets.SecretStore | None)

    - input_required (bool)

    - runtime_context (cwltool.context.RuntimeContext | None)

  Return type:

    cwl_utils.types.CWLObjectType

cwltool.main.make_relative(base, obj)

  Relativize the location URI of a File or Directory object.

  Parameters:

    - base (str)

    - obj (cwl_utils.types.CWLObjectType)

  Return type:

    None

cwltool.main.printdeps(obj, document_loader, stdout, relative_deps, uri, basedir=None, nestdirs=True)

  Print a JSON representation of the dependencies of the CWL document.

  Parameters:

    - obj (cwl_utils.types.CWLObjectType)

    - document_loader (schema_salad.ref_resolver.Loader)

    - stdout (IO[str])

    - relative_deps (str)

    - uri (str)

    - basedir (str | None)

    - nestdirs (bool)

  Return type:

    None

cwltool.main.prov_deps(obj, document_loader, uri, basedir=None)
  Parameters:

    - obj (cwl_utils.types.CWLObjectType)

    - document_loader (schema_salad.ref_resolver.Loader)

    - uri (str)

    - basedir (str | None)

  Return type:

    cwl_utils.types.CWLFileType

cwltool.main.find_deps(obj, document_loader, uri, basedir=None, nestdirs=True)

  Find the dependencies of the CWL document.

  Parameters:

    - obj (cwl_utils.types.CWLObjectType)

    - document_loader (schema_salad.ref_resolver.Loader)

    - uri (str)

    - basedir (str | None)

    - nestdirs (bool)

  Return type:

    cwl_utils.types.CWLFileType

cwltool.main.print_pack(loadingContext, uri)

  Return a CWL serialization of the CWL document in JSON.

  Parameters:

    - loadingContext (cwltool.context.LoadingContext)

    - uri (str)

  Return type:

    str

cwltool.main.supported_cwl_versions(enable_dev)

  Return a list of currently supported CWL versions.

  Parameters:

    enable_dev (bool)

  Return type:

    list[str]

cwltool.main.setup_schema(args, custom_schema_callback)
  Parameters:

    - args (argparse.Namespace)

    - custom_schema_callback (collections.abc.Callable[[], None] | None)

  Return type:

    None

class cwltool.main.ProvLogFormatter

  Bases: `logging.Formatter`

  Enforce ISO8601 with both T and Z.

  formatTime(record, datefmt=None)

    Override the default formatTime to include the timezone.

    Parameters:

      - record (logging.LogRecord)

      - datefmt (str | None)

    Return type:

      str

cwltool.main.setup_loadingContext(loadingContext, runtimeContext, args)

  Prepare a LoadingContext from the given arguments.

  Parameters:

    - loadingContext (cwltool.context.LoadingContext | None)

    - runtimeContext (cwltool.context.RuntimeContext)

    - args (argparse.Namespace)

  Return type:

    cwltool.context.LoadingContext

cwltool.main.make_template(tool, target)

  Make a template CWL input object for the give Process.

  Parameters:

    - tool (cwltool.process.Process)

    - target (IO[str])

  Return type:

    None

cwltool.main.inherit_reqshints(tool, parent)

  Copy down requirements and hints from ancestors of a given process.

  Parameters:

    - tool (cwltool.process.Process)

    - parent (cwltool.process.Process)

  Return type:

    None

cwltool.main.choose_target(args, tool, loading_context)

  Walk the Workflow, extract the subset matches all the args.targets.

  Parameters:

    - args (argparse.Namespace)

    - tool (cwltool.process.Process)

    - loading_context (cwltool.context.LoadingContext)

  Return type:

    cwltool.process.Process | None

cwltool.main.choose_step(args, tool, loading_context)

  Walk the given Workflow and extract just args.single_step.

  Parameters:

    - args (argparse.Namespace)

    - tool (cwltool.process.Process)

    - loading_context (cwltool.context.LoadingContext)

  Return type:

    cwltool.process.Process | None

cwltool.main.choose_process(args, tool, loadingContext)

  Walk the given Workflow and extract just args.single_process.

  Parameters:

    - args (argparse.Namespace)

    - tool (cwltool.process.Process)

    - loadingContext (cwltool.context.LoadingContext)

  Return type:

    cwltool.process.Process | None

cwltool.main.check_working_directories(runtimeContext)

  Make any needed working directories.

  Parameters:

    runtimeContext (cwltool.context.RuntimeContext)

  Return type:

    int | None

cwltool.main.print_targets(tool, stdout, loading_context, prefix='')

  Recursively find targets for –subgraph and friends.

  Parameters:

    - tool (cwltool.process.Process)

    - stdout (IO[str])

    - loading_context (cwltool.context.LoadingContext)

    - prefix (str)

  Return type:

    None

cwltool.main.main(argsl=None, args=None, job_order_object=None, stdin=sys.stdin, stdout=None, stderr=sys.stderr, versionfunc=versionstring, logger_handler=None, custom_schema_callback=None, executor=None, loadingContext=None, runtimeContext=None, input_required=True)
  Parameters:

    - argsl (list[str] | None)

    - args (argparse.Namespace | None)

    - job_order_object (cwl_utils.types.CWLObjectType | None)

    - stdin (IO[Any])

    - stdout (IO[str] | None)

    - stderr (IO[Any])

    - versionfunc (collections.abc.Callable[[], str])

    - logger_handler (logging.Handler | None)

    - custom_schema_callback (collections.abc.Callable[[], None] | None)

    - executor (cwltool.executors.JobExecutor | None)

    - loadingContext (cwltool.context.LoadingContext | None)

    - runtimeContext (cwltool.context.RuntimeContext | None)

    - input_required (bool)

  Return type:

    int

cwltool.main.find_default_container(builder, default_container=None, use_biocontainers=None, container_image_cache_path=None)

  Find a container.

  Parameters:

    - builder (cwltool.utils.HasReqsHints)

    - default_container (str | None)

    - use_biocontainers (bool | None)

    - container_image_cache_path (str | None)

  Return type:

    str | None

cwltool.main.windows_check()

  See if we are running on MS Windows and warn about the lack of support.

  Return type:

    None

cwltool.main.run(*args, **kwargs)

  Run cwltool.

  Parameters:

    - args (Any)

    - kwargs (Any)

  Return type:

    int