Premade Usage Drivers

These drivers serve as reference implementations and may be convenient for your own purposes.

Debug Driver

class qiime2.sdk.usage.DiagnosticUsage
__init__()

Constructor for DiagnosticUsage. No parameters.

Warning

For SDK use only. Do not use in a written usage example.

render(flush: bool = False) List[qiime2.sdk.usage.DiagnosticUsage.DiagnosticUsageRecord]

Produce a list of DiagnosticUsage.DiagnosticUsageRecord’s for testing.

Warning

For SDK use only. Do not use in a written usage example.

Parameters

flush (bool) – Whether to reset the current state of the records.

class qiime2.sdk.usage.DiagnosticUsage.DiagnosticUsageRecord(source: str, variable: Any)

A dataclass storing the invoked method name and variable/param.

Execution Driver

class qiime2.sdk.usage.ExecutionUsage(asynchronous=False)
__init__(asynchronous=False)

Constructor for ExecutionUsage.

Warning

For SDK use only. Do not use in a written usage example.

Parameters

asynchronous (bool) – Whether to execute actions via qiime2.sdk.Action.asynchronous() or qiime2.sdk.Action.__call__()

render(flush: bool = False) dict

Produce a dict of cannonically named, evaluated usage variables.

Warning

For SDK use only. Do not use in a written usage example.

Parameters

flush (bool) – Whether to reset the current state of the dict.

Returns

Evaluated variables named by their variable’s cannonical name.

Return type

dict

class qiime2.sdk.usage.ExecutionUsageVariable(name: str, factory: Callable[[], Any], var_type: Literal['artifact', 'visualization', 'metadata', 'column', 'format'], usage: qiime2.sdk.usage.Usage)

A specialized implementation for ExecutionUsage.

Artifact API Driver

class qiime2.plugins.ArtifactAPIUsage(enable_assertions: bool = False, action_collection_size: int = 3)
__init__(enable_assertions: bool = False, action_collection_size: int = 3)

Constructor for ArtifactAPIUsage

Warning

For SDK use only. Do not use in a written usage example.

Parameters
  • enable_assertions (bool) – Whether qiime2.sdk.usage.UsageVariable assertions should be rendered. Note that these are not executed, rather code that would assert is templated by render().

  • action_collection_size (int) – The maximum number of outputs to automatically desctructure before creating seperate lines with output property access. e.g. x, y, z = foo() vs results = foo() with results.x etc.

render(flush: bool = False) str

Return a newline-seperated string of Artifact API python code.

Warning

For SDK use only. Do not use in a written usage example.

Parameters

flush (bool) – Whether to ‘flush’ the current code. Importantly, this will clear the top-line imports for future invocations.

class qiime2.plugins.ArtifactAPIUsageVariable(name: str, factory: Callable[[], Any], var_type: Literal['artifact', 'visualization', 'metadata', 'column', 'format'], usage: qiime2.sdk.usage.Usage)

A specialized implementation for ArtifactAPIUsage.