gxformat2 package#
Subpackages#
- gxformat2.normalized package
ExpandedFormat2ExpandedNativeStepExpandedNativeWorkflowExpandedWorkflowStepNormalizedFormat2NormalizedFormat2.class_NormalizedFormat2.commentsNormalizedFormat2.creatorNormalizedFormat2.docNormalizedFormat2.inputsNormalizedFormat2.known_labelsNormalizedFormat2.labelNormalizedFormat2.licenseNormalizedFormat2.model_configNormalizedFormat2.outputsNormalizedFormat2.releaseNormalizedFormat2.reportNormalizedFormat2.resolve_source()NormalizedFormat2.stepsNormalizedFormat2.tagsNormalizedFormat2.unique_toolsNormalizedFormat2.uuid
NormalizedNativeStepNormalizedNativeStep.annotationNormalizedNativeStep.connected_pathsNormalizedNativeStep.content_idNormalizedNativeStep.content_sourceNormalizedNativeStep.errorsNormalizedNativeStep.idNormalizedNativeStep.in_NormalizedNativeStep.inline_tool_classNormalizedNativeStep.input_connectionsNormalizedNativeStep.inputsNormalizedNativeStep.is_inline_tool_stepNormalizedNativeStep.is_input_stepNormalizedNativeStep.is_pause_stepNormalizedNativeStep.is_pick_value_stepNormalizedNativeStep.is_subworkflow_stepNormalizedNativeStep.is_tool_stepNormalizedNativeStep.labelNormalizedNativeStep.model_configNormalizedNativeStep.nameNormalizedNativeStep.outputsNormalizedNativeStep.positionNormalizedNativeStep.post_job_actionsNormalizedNativeStep.subworkflowNormalizedNativeStep.tool_idNormalizedNativeStep.tool_representationNormalizedNativeStep.tool_shed_repositoryNormalizedNativeStep.tool_stateNormalizedNativeStep.tool_uuidNormalizedNativeStep.tool_versionNormalizedNativeStep.type_NormalizedNativeStep.uuidNormalizedNativeStep.whenNormalizedNativeStep.workflow_outputs
NormalizedNativeWorkflowNormalizedNativeWorkflow.a_galaxy_workflowNormalizedNativeWorkflow.annotationNormalizedNativeWorkflow.commentsNormalizedNativeWorkflow.creatorNormalizedNativeWorkflow.doiNormalizedNativeWorkflow.format_versionNormalizedNativeWorkflow.helpNormalizedNativeWorkflow.licenseNormalizedNativeWorkflow.logo_urlNormalizedNativeWorkflow.model_configNormalizedNativeWorkflow.nameNormalizedNativeWorkflow.readmeNormalizedNativeWorkflow.releaseNormalizedNativeWorkflow.reportNormalizedNativeWorkflow.source_metadataNormalizedNativeWorkflow.stepsNormalizedNativeWorkflow.subworkflowsNormalizedNativeWorkflow.tagsNormalizedNativeWorkflow.unique_toolsNormalizedNativeWorkflow.uuidNormalizedNativeWorkflow.version
NormalizedWorkflowStepNormalizedWorkflowStep.connected_pathsNormalizedWorkflowStep.docNormalizedWorkflowStep.errorsNormalizedWorkflowStep.idNormalizedWorkflowStep.in_NormalizedWorkflowStep.inline_tool_representationNormalizedWorkflowStep.is_inline_tool_stepNormalizedWorkflowStep.is_pause_stepNormalizedWorkflowStep.is_pick_value_stepNormalizedWorkflowStep.is_subworkflow_stepNormalizedWorkflowStep.is_tool_stepNormalizedWorkflowStep.labelNormalizedWorkflowStep.model_configNormalizedWorkflowStep.outNormalizedWorkflowStep.positionNormalizedWorkflowStep.post_job_actionsNormalizedWorkflowStep.runNormalizedWorkflowStep.runtime_inputsNormalizedWorkflowStep.stateNormalizedWorkflowStep.tool_idNormalizedWorkflowStep.tool_shed_repositoryNormalizedWorkflowStep.tool_stateNormalizedWorkflowStep.tool_versionNormalizedWorkflowStep.type_NormalizedWorkflowStep.uuidNormalizedWorkflowStep.when
SourceReferenceToolReferenceensure_format2()ensure_native()expanded_format2()expanded_native()native_input_to_format2_type()normalized_format2()normalized_native()resolve_source_reference()to_format2()to_native()- gxformat2.normalized._format2 module
GalaxyUserToolStubImportReferenceNormalizedFormat2NormalizedFormat2.class_NormalizedFormat2.commentsNormalizedFormat2.creatorNormalizedFormat2.docNormalizedFormat2.inputsNormalizedFormat2.known_labelsNormalizedFormat2.labelNormalizedFormat2.licenseNormalizedFormat2.model_configNormalizedFormat2.outputsNormalizedFormat2.releaseNormalizedFormat2.reportNormalizedFormat2.resolve_source()NormalizedFormat2.stepsNormalizedFormat2.tagsNormalizedFormat2.unique_toolsNormalizedFormat2.uuid
NormalizedWorkflowStepNormalizedWorkflowStep.connected_pathsNormalizedWorkflowStep.docNormalizedWorkflowStep.errorsNormalizedWorkflowStep.idNormalizedWorkflowStep.in_NormalizedWorkflowStep.inline_tool_representationNormalizedWorkflowStep.is_inline_tool_stepNormalizedWorkflowStep.is_pause_stepNormalizedWorkflowStep.is_pick_value_stepNormalizedWorkflowStep.is_subworkflow_stepNormalizedWorkflowStep.is_tool_stepNormalizedWorkflowStep.labelNormalizedWorkflowStep.model_configNormalizedWorkflowStep.outNormalizedWorkflowStep.positionNormalizedWorkflowStep.post_job_actionsNormalizedWorkflowStep.runNormalizedWorkflowStep.runtime_inputsNormalizedWorkflowStep.stateNormalizedWorkflowStep.tool_idNormalizedWorkflowStep.tool_shed_repositoryNormalizedWorkflowStep.tool_stateNormalizedWorkflowStep.tool_versionNormalizedWorkflowStep.type_NormalizedWorkflowStep.uuidNormalizedWorkflowStep.when
SourceReferencenormalized_format2()resolve_source_reference()
- gxformat2.normalized._native module
NormalizedNativeStepNormalizedNativeStep.annotationNormalizedNativeStep.connected_pathsNormalizedNativeStep.content_idNormalizedNativeStep.content_sourceNormalizedNativeStep.errorsNormalizedNativeStep.idNormalizedNativeStep.in_NormalizedNativeStep.inline_tool_classNormalizedNativeStep.input_connectionsNormalizedNativeStep.inputsNormalizedNativeStep.is_inline_tool_stepNormalizedNativeStep.is_input_stepNormalizedNativeStep.is_pause_stepNormalizedNativeStep.is_pick_value_stepNormalizedNativeStep.is_subworkflow_stepNormalizedNativeStep.is_tool_stepNormalizedNativeStep.labelNormalizedNativeStep.model_configNormalizedNativeStep.nameNormalizedNativeStep.outputsNormalizedNativeStep.positionNormalizedNativeStep.post_job_actionsNormalizedNativeStep.subworkflowNormalizedNativeStep.tool_idNormalizedNativeStep.tool_representationNormalizedNativeStep.tool_shed_repositoryNormalizedNativeStep.tool_stateNormalizedNativeStep.tool_uuidNormalizedNativeStep.tool_versionNormalizedNativeStep.type_NormalizedNativeStep.uuidNormalizedNativeStep.whenNormalizedNativeStep.workflow_outputs
NormalizedNativeWorkflowNormalizedNativeWorkflow.a_galaxy_workflowNormalizedNativeWorkflow.annotationNormalizedNativeWorkflow.commentsNormalizedNativeWorkflow.creatorNormalizedNativeWorkflow.doiNormalizedNativeWorkflow.format_versionNormalizedNativeWorkflow.helpNormalizedNativeWorkflow.licenseNormalizedNativeWorkflow.logo_urlNormalizedNativeWorkflow.model_configNormalizedNativeWorkflow.nameNormalizedNativeWorkflow.readmeNormalizedNativeWorkflow.releaseNormalizedNativeWorkflow.reportNormalizedNativeWorkflow.source_metadataNormalizedNativeWorkflow.stepsNormalizedNativeWorkflow.subworkflowsNormalizedNativeWorkflow.tagsNormalizedNativeWorkflow.unique_toolsNormalizedNativeWorkflow.uuidNormalizedNativeWorkflow.version
load_native()normalized_native()
- gxformat2.normalized._expanded module
- gxformat2.schema package
- Submodules
- gxformat2.schema.v19_09 module
AnyLoaderArraySchemaBaseCommentBaseCreatorBaseDataParameterBaseInputParameterCreatorOrganizationCreatorOrganizationTypeLoaderCreatorPersonCreatorPersonTypeLoaderDocumentedEnumSchemaFrameCommentFreehandCommentGalaxyTypeLoaderGalaxyWorkflowHasStepErrorsHasStepPositionHasUUIDIdentifiedInputParameterLabeledLoadingOptionsLoadingOptions.addl_metadataLoadingOptions.baseuriLoadingOptions.cacheLoadingOptions.containerLoadingOptions.fetcherLoadingOptions.fileuriLoadingOptions.graphLoadingOptions.idxLoadingOptions.importsLoadingOptions.includesLoadingOptions.namespacesLoadingOptions.no_link_checkLoadingOptions.original_docLoadingOptions.rvocabLoadingOptions.schemasLoadingOptions.vocab
MarkdownCommentMinMaxOutputParameterParameterPrimitiveTypeLoaderProcessRecordFieldRecordFieldDefinitionRecordSchemaReferencesToolReportSampleSheetColumnDefinitionSaveableSinkStepPositionTextCommentToolShedRepositoryWorkflowBooleanParameterWorkflowCollectionParameterWorkflowDataParameterWorkflowFloatParameterWorkflowInputParameterWorkflowIntegerParameterWorkflowOutputParameterWorkflowStepWorkflowStepInputWorkflowStepOutputWorkflowStepTypeLoaderWorkflowTextOptionWorkflowTextParameterconvert_typing()expand_url()extract_type()file_uri()load_document()load_document_by_string()load_document_by_yaml()load_document_with_metadata()load_field()parse_errors()parser_info()prefix_url()save()save_relative_uri()save_with_metadata()shortname()
- Module contents
Submodules#
gxformat2.abstract module#
Module for exporting Galaxy workflows to CWL abstract interface.
gxformat2.converter module#
Functionality for converting a Format 2 workflow into a standard Galaxy workflow.
This module provides dict-returning wrapper functions used by Galaxy and
Planemo. The typed API is gxformat2.normalized.to_native().
- gxformat2.converter.main(argv=None)[source]#
Entry point for script to conversion from Format 2 interface.
gxformat2.cytoscape module#
Cytoscape.js visualization for Galaxy workflows.
- class gxformat2.cytoscape.CytoscapeEdge(*, group: Literal['edges'] = 'edges', data: CytoscapeEdgeData)[source]#
Bases:
BaseModelA Cytoscape.js edge element.
- data: CytoscapeEdgeData#
- group: Literal['edges']#
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gxformat2.cytoscape.CytoscapeEdgeData(*, id: str, source: str, target: str, input: str, output: str | None = None)[source]#
Bases:
BaseModelData payload for a Cytoscape edge (step connection).
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gxformat2.cytoscape.CytoscapeElements(*, nodes: list[CytoscapeNode] = <factory>, edges: list[CytoscapeEdge] = <factory>, layout: CytoscapeLayout | None = None)[source]#
Bases:
BaseModelComplete set of Cytoscape.js elements for a workflow visualization.
- edges: list[CytoscapeEdge]#
- layout: CytoscapeLayout | None#
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- nodes: list[CytoscapeNode]#
- class gxformat2.cytoscape.CytoscapeLayout(*, name: str)[source]#
Bases:
BaseModelLayout hint emitted on non-default layouts.
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gxformat2.cytoscape.CytoscapeNode(*, group: Literal['nodes'] = 'nodes', data: CytoscapeNodeData, classes: list[str] = <factory>, position: CytoscapePosition | None = None)[source]#
Bases:
BaseModelA Cytoscape.js node element.
- data: CytoscapeNodeData#
- group: Literal['nodes']#
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- position: CytoscapePosition | None#
- class gxformat2.cytoscape.CytoscapeNodeData(*, id: str, label: str, doc: str | None = None, tool_id: str | None = None, step_type: str = 'tool', repo_link: str | None = None)[source]#
Bases:
BaseModelData payload for a Cytoscape node (input or step).
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gxformat2.cytoscape.CytoscapePosition(*, x: int = 0, y: int = 0)[source]#
Bases:
BaseModelCytoscape node position (x/y coordinates).
- model_config = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- gxformat2.cytoscape.bakes_coordinates(layout: str) bool[source]#
Layouts that bake coordinates into
data.position.All other layouts are hint-only and rely on the runtime renderer.
- gxformat2.cytoscape.cytoscape_elements(workflow: dict[str, Any] | str | Path | GalaxyWorkflow | NormalizedFormat2, *, layout: str = 'preset') CytoscapeElements[source]#
Build Cytoscape visualization elements from a Galaxy workflow.
Accepts anything
normalized_format2()supports, plus an already normalizedNormalizedFormat2instance.layoutselects the placement strategy (defaultpreset); see_layout.pyand the cross-language spec for details.
- gxformat2.cytoscape.is_layout_name(value: str) bool[source]#
Return True if
valueis one of the supported Cytoscape layout names.
- gxformat2.cytoscape.main(argv=None)[source]#
Entry point for building Cytoscape visualizations of Galaxy workflows.
- gxformat2.cytoscape.render_html(elements: CytoscapeElements, layout: str = 'preset') str[source]#
Return a standalone HTML page visualizing the workflow with Cytoscape.js.
The returned string is a complete HTML document suitable for writing to a file or embedding in a Jupyter notebook.
- gxformat2.cytoscape.to_cytoscape(workflow_path: str, output_path=None, layout: str = 'preset')[source]#
Produce cytoscape output for supplied workflow path.
- gxformat2.cytoscape.topological_positions(elements: CytoscapeElements) dict[str, CytoscapePosition][source]#
Compute positions per the topological layering spec.
Returns a mapping keyed by node
data.id.
gxformat2.export module#
Functionality for converting a standard Galaxy workflow into a format 2 workflow.
This module provides dict-returning wrapper functions used by Galaxy and
Planemo. The typed API is gxformat2.normalized.to_format2().
- gxformat2.export.from_galaxy_native(native_workflow_dict: dict[str, Any] | NativeGalaxyWorkflow, tool_interface=None, json_wrapper: bool = False, compact: bool = False, convert_tool_state: Callable[[dict], Dict[str, Any] | None] | None = None)[source]#
Convert native .ga workflow definition to a format2 workflow.
If
convert_tool_stateis provided it should be a callable accepting a native step dict and returning an optional dict representing the format2statefor that step. When the callable returns a dict, the step will carrystateinstead oftool_state; when it returnsNonethe defaulttool_statepassthrough is used.
gxformat2.interface module#
Compatibility shim for gxformat2.interface.
Deprecated since version 0.26.0: This module was removed in gxformat2 0.23 (PR #161) and has been restored solely as a compatibility shim for downstream consumers (notably Planemo). It may be removed again in a future release. New code should implement its own Galaxy importer interface or depend on Galaxy / BioBlend directly.
bioblend is no longer a hard dependency of gxformat2. Install the
bioblend extra (pip install gxformat2[bioblend]) or install
bioblend separately to use BioBlendImporterGalaxyInterface.
- class gxformat2.interface.BioBlendImporterGalaxyInterface(**kwds)[source]#
Bases:
ImporterGalaxyInterfaceImplementation of
ImporterGalaxyInterfaceusing bioblend.bioblendis imported lazily so importinggxformat2.interfacedoes not require it to be installed.
gxformat2.lint module#
Workflow linting entry point - main script.
- gxformat2.lint.lint_best_practices(lint_context, nf2: NormalizedFormat2)[source]#
Lint best practices for a Format2 workflow (top-level + format2 step-level).
- gxformat2.lint.lint_best_practices_format2(lint_context, workflow_dict)[source]#
Lint best practices for a Format2 Galaxy workflow.
- gxformat2.lint.lint_best_practices_ga(lint_context, workflow_dict)[source]#
Lint best practices for a native Galaxy workflow.
Runs top-level checks on NormalizedFormat2 (for shared doc/creator/license interpretation) plus step-level checks on NormalizedNativeWorkflow so step messages reference native ids / labels / annotations rather than format2 sentinels like
_unlabeled_step_1.
- gxformat2.lint.lint_format2(lint_context, nf2, raw_dict: dict | None = None, path=None)[source]#
Lint a Format 2 Galaxy workflow and populate the corresponding LintContext.
Backward-compat:
nf2may be a raw dict (legacy Planemo signature), in which case it is expanded toNormalizedFormat2internally.pathis accepted for Planemo compatibility and currently ignored.
- gxformat2.lint.lint_ga(lint_context, nnw, raw_dict: dict | None = None, path=None)[source]#
Lint a native Galaxy workflow and populate the corresponding LintContext.
Backward-compat:
nnwmay be a raw dict (legacy Planemo signature), in which case it is expanded toNormalizedNativeWorkflowinternally.pathis accepted for Planemo compatibility and currently ignored.
- gxformat2.lint.lint_pydantic_validation(lint_context, workflow_dict, format2=False)[source]#
Validate workflow dict against pydantic schema models.
Tries strict model (extra=forbid) first. If strict fails, falls back to the lax model (extra=allow) to distinguish fundamental type errors from merely having extra/unknown fields.
gxformat2.linting module#
Generic utilities for linting.
Largely derived from galaxy.tool_util.lint. LintMessage is a str
subclass so existing code that treats warn_messages / error_messages
as lists of strings keeps working; new metadata (level, linter,
json_pointer) is accessible as attributes.
- class gxformat2.linting.LintContext(level='warn', training_topic=None, _pointer: str = '')[source]#
Bases:
objectTrack running status (state) of linting.
- child(pointer_segment) LintContext[source]#
Create child context whose default json_pointer is prefixed.
- class gxformat2.linting.LintLevel(*values)[source]#
-
Lint severity levels.
- ALL = 'all'#
- ERROR = 'error'#
- WARN = 'warn'#
- class gxformat2.linting.LintMessage(message: str, *, level: str = 'warn', linter: str | None = None, json_pointer: str = '')[source]#
Bases:
strA single lint emission: prose + structured metadata.
Subclassing
strkeeps"substring" in messageandstr(message)working for existing callers/tests.
gxformat2.main module#
gxformat2.markdown_parse module#
Utilities for parsing “Galaxy Flavored Markdown”.
See markdown_util.py for loading objects and interacting with the rest of Galaxy. This file is meant to be relatively self contained and just used to “parse” and validate Galaxy Markdown. Keeping things isolated to allow re-use of these utilities in other projects (e.g. gxformat2).
gxformat2.model module#
Abstractions for dealing with Format2 data.
- gxformat2.model.ensure_step_position(step: dict, order_index: int)[source]#
Ensure step contains a position definition.
Modifies the input step dictionary.
- gxformat2.model.get_native_step_type(gxformat2_step_dict: dict) Literal['subworkflow', 'data_input', 'data_collection_input', 'tool', 'pause', 'pick_value', 'parameter_input'][source]#
Infer native galaxy step type from the gxformat2 step as a dict.
- gxformat2.model.resolve_source_reference(value: str, known_labels: set | dict) tuple[source]#
Parse a source reference into (step_label_or_id, output_name).
Deprecated: use
gxformat2.normalized.resolve_source_referencedirectly.
- gxformat2.model.setup_connected_values(value, key: str = '', append_to: dict[str, list] | None = None) Any[source]#
Replace links with connected value.
- gxformat2.model.steps_as_list(format2_workflow: dict, add_ids: bool = False, inputs_offset: int = 0, mutate: bool = False) list[dict[str, Any]][source]#
Return steps as a list, converting ID map to list representation if needed.
This method does mutate the supplied steps, try to make progress toward not doing this.
Add keys as labels instead of IDs. Why am I doing this?
gxformat2.normalize module#
Convenience functions for accessing normalized workflow components.
steps(), inputs(), and outputs() return typed Pydantic
model lists from any workflow representation. The _normalized variants
return plain dicts for backward compatibility (used by Planemo).
- gxformat2.normalize.inputs(workflow_dict: dict[str, Any] | str | PathLike | NormalizedFormat2 | NormalizedNativeWorkflow | GalaxyWorkflow | NativeGalaxyWorkflow | None = None, workflow_path: str | PathLike | None = None, options: ConversionOptions | None = None, expand: bool = False) list[BaseInputParameter][source]#
Return normalized inputs as typed models.
- gxformat2.normalize.inputs_normalized(workflow_dict: dict[str, Any] | str | PathLike | NormalizedFormat2 | NormalizedNativeWorkflow | GalaxyWorkflow | NativeGalaxyWorkflow | None = None, workflow_path: str | PathLike | None = None, options: ConversionOptions | None = None, expand: bool = False) list[dict[str, Any]][source]#
Return normalized input steps as dicts.
Deprecated since version Use:
inputs()for typed model access.
- gxformat2.normalize.outputs(workflow_dict: dict[str, Any] | str | PathLike | NormalizedFormat2 | NormalizedNativeWorkflow | GalaxyWorkflow | NativeGalaxyWorkflow | None = None, workflow_path: str | PathLike | None = None, options: ConversionOptions | None = None, expand: bool = False) list[WorkflowOutputParameter][source]#
Return normalized outputs as typed models.
- gxformat2.normalize.outputs_normalized(workflow_dict: dict[str, Any] | str | PathLike | NormalizedFormat2 | NormalizedNativeWorkflow | GalaxyWorkflow | NativeGalaxyWorkflow | None = None, workflow_path: str | PathLike | None = None, options: ConversionOptions | None = None, expand: bool = False) list[dict[str, Any]][source]#
Return normalized outputs as dicts.
Deprecated since version Use:
outputs()for typed model access.
- gxformat2.normalize.steps(workflow_dict: dict[str, Any] | str | PathLike | NormalizedFormat2 | NormalizedNativeWorkflow | GalaxyWorkflow | NativeGalaxyWorkflow | None = None, workflow_path: str | PathLike | None = None, options: ConversionOptions | None = None, expand: bool = False) list[BaseInputParameter | NormalizedWorkflowStep][source]#
Return input parameters followed by steps as typed models.
- gxformat2.normalize.steps_normalized(workflow_dict: dict[str, Any] | str | PathLike | NormalizedFormat2 | NormalizedNativeWorkflow | GalaxyWorkflow | NativeGalaxyWorkflow | None = None, workflow_path: str | PathLike | None = None, options: ConversionOptions | None = None, expand: bool = False) list[dict[str, Any]][source]#
Walk over a normalized step rep. across workflow formats.
Deprecated since version Use:
steps()for typed model access.Returns a list of dicts — input steps followed by tool/subworkflow steps.
gxformat2.options module#
Conversion options and URL resolution for workflow format conversion.
- class gxformat2.options.ConversionOptions(workflow_directory: str | Path | None = None, encode_tool_state_json: bool = True, deduplicate_subworkflows: bool = False, state_encode_to_native: Callable[[dict, Dict[str, Any]], Dict[str, Any] | None] | None = None, state_encode_to_format2: Callable[[dict], Dict[str, Any] | None] | None = None, compact: bool = False, url_resolver: Callable[[str], dict[str, Any]] | None = None, strict_structure: bool = False)[source]#
Bases:
objectOptions for workflow format conversion and expansion.
Controls native↔Format2 conversion, subworkflow expansion, and URL resolution.
- gxformat2.options.StateEncodeToFormat2Fn#
Callback to convert a native tool step’s tool_state to format2 state.
Accepts a native step dict (with tool_id, tool_version, tool_state). Returns a format2 state dict, or None to fall back to default tool_state passthrough.
- gxformat2.options.StateEncodeToNativeFn#
Callback to encode format2 state back to native tool_state.
Accepts (step, state) where step is the partially-built native step dict and state is the format2 state dict after setup_connected_values processing. Returns {param_name: encoded_value} as clean dicts for native tool_state, or None to fall back to default dict passthrough (no JSON encoding).
alias of
Callable[[dict,Dict[str,Any]],Dict[str,Any] |None] |None
- gxformat2.options.UrlResolverFn#
Callback to fetch a URL and return a parsed workflow dict.
Accepts a URL string, returns a parsed dict (native or format2). Galaxy provides its own with allowlists/policy; gxformat2 provides a default via
default_url_resolver().
gxformat2.to_format2 module#
Convert a native Galaxy workflow to Format2.
Returns NormalizedFormat2 by default, or
ExpandedFormat2 when expand=True.
gxformat2.to_native module#
Convert a Format2 workflow to native Galaxy format.
Returns NormalizedNativeWorkflow by default, or
ExpandedNativeWorkflow when expand=True (resolving
all URL/TRS/@import subworkflow references).
gxformat2.yaml module#
YAML loading utilities for gxformat2.
- gxformat2.yaml.ordered_dump(data, stream=None, Dumper=<class 'yaml.dumper.SafeDumper'>, **kwds)[source]#
Safe and ordered dump of YAML to stream.
- gxformat2.yaml.ordered_dump_to_path(as_dict: dict, path: str)[source]#
Safe and ordered dump of YAML to path.
Module contents#
The public interface or entry point for the Format 2 workflow code.
- class gxformat2.ConversionOptions(workflow_directory: str | Path | None = None, encode_tool_state_json: bool = True, deduplicate_subworkflows: bool = False, state_encode_to_native: Callable[[dict, Dict[str, Any]], Dict[str, Any] | None] | None = None, state_encode_to_format2: Callable[[dict], Dict[str, Any] | None] | None = None, compact: bool = False, url_resolver: Callable[[str], dict[str, Any]] | None = None, strict_structure: bool = False)[source]
Bases:
objectOptions for workflow format conversion and expansion.
Controls native↔Format2 conversion, subworkflow expansion, and URL resolution.
- gxformat2.from_galaxy_native(native_workflow_dict: dict[str, Any] | NativeGalaxyWorkflow, tool_interface=None, json_wrapper: bool = False, compact: bool = False, convert_tool_state: Callable[[dict], Dict[str, Any] | None] | None = None)[source]
Convert native .ga workflow definition to a format2 workflow.
If
convert_tool_stateis provided it should be a callable accepting a native step dict and returning an optional dict representing the format2statefor that step. When the callable returns a dict, the step will carrystateinstead oftool_state; when it returnsNonethe defaulttool_statepassthrough is used.
- gxformat2.python_to_workflow(as_python, galaxy_interface=None, workflow_directory=None, import_options=None)[source]
Convert a Format 2 workflow into standard Galaxy format from supplied dictionary.
- gxformat2.to_format2(workflow: dict[str, Any] | str | Path | PathLike[str] | NativeGalaxyWorkflow | NormalizedNativeWorkflow, options: ConversionOptions, expand: Literal[True]) ExpandedFormat2[source]
- gxformat2.to_format2(workflow: dict[str, Any] | str | Path | PathLike[str] | NativeGalaxyWorkflow | NormalizedNativeWorkflow, options: ConversionOptions | None = None, expand: Literal[False] = False) NormalizedFormat2
Convert a native Galaxy workflow to Format2.
Returns
NormalizedFormat2by default, orExpandedFormat2whenexpand=True.
- gxformat2.to_native(workflow: dict[str, Any] | str | Path | PathLike[str] | NormalizedFormat2 | GalaxyWorkflow, options: ConversionOptions, expand: Literal[True]) ExpandedNativeWorkflow[source]
- gxformat2.to_native(workflow: dict[str, Any] | str | Path | PathLike[str] | NormalizedFormat2 | GalaxyWorkflow, options: ConversionOptions | None = None, expand: Literal[False] = False) NormalizedNativeWorkflow
Convert a Format2 workflow to native Galaxy format.
Returns
NormalizedNativeWorkflowby default, orExpandedNativeWorkflowwhenexpand=True(resolving all URL/TRS/@import subworkflow references).