Skip to content

Commited auto-generated code with new syntax #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ name: CI/CD
on:
push:
branches: [ main, develop ]
tags: [ '*' ]
pull_request:
branches: [ main, develop ]
release:
types: [published]
repository_dispatch:
types: [create-release]
types: [create-post-release]


jobs:
nipype-conv:
Expand Down Expand Up @@ -143,7 +145,7 @@ jobs:
if: ${{ always() }}
with:
files: coverage.xml
name: pydra-mriqc
name: pydra-tasks-mriqc

deploy:
needs: [test]
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,3 @@ dmypy.json
# Mac garbarge
.DS_store

/pydra
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# -- Project information -----------------------------------------------------

project = "pydra-mriqc"
project = "pydra-tasks-mriqc"
copyright = "2020, Xihe Xie"
author = "Xihe Xie"

Expand Down
14 changes: 14 additions & 0 deletions nipype-auto-conv/generate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from pathlib import Path
from click.testing import CliRunner
from nipype2pydra.cli import convert


spec_dir = Path(__file__).parent / "specs"
conv_dir = Path(__file__).parent.parent

runner = CliRunner()
result = runner.invoke(
convert,
args=[str(spec_dir), str(conv_dir)],
catch_exceptions=False,
)
94 changes: 47 additions & 47 deletions nipype-auto-conv/specs/interfaces/derivatives_data_sink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# Docs
# ----
#
#
task_name: DerivativesDataSink
nipype_name: DerivativesDataSink
nipype_module: mriqc.interfaces
Expand All @@ -15,11 +15,11 @@ inputs:
rename:
# dict[str, str] - fields to rename in the Pydra interface
types:
# dict[str, type] - override inferred types (use "mime-like" string for file-format types,
# e.g. 'medimage/nifti-gz'). For most fields the type will be correctly inferred
# from the nipype interface, but you may want to be more specific, particularly
# for file types, where specifying the format also specifies the file that will be
# passed to the field in the automatically generated unittests.
# dict[str, type] - override inferred types (use "mime-like" string for file-format types,
# e.g. 'medimage/nifti-gz'). For most fields the type will be correctly inferred
# from the nipype interface, but you may want to be more specific, particularly
# for file types, where specifying the format also specifies the file that will be
# passed to the field in the automatically generated unittests.
base_directory: generic/directory
# type=directory|default='': Path to the base directory for storing data.
in_file: generic/file+list-of
Expand All @@ -37,15 +37,15 @@ outputs:
rename:
# dict[str, str] - fields to rename in the Pydra interface
types:
# dict[str, type] - override inferred types (use "mime-like" string for file-format types,
# e.g. 'medimage/nifti-gz'). For most fields the type will be correctly inferred
# from the nipype interface, but you may want to be more specific, particularly
# for file types, where specifying the format also specifies the file that will be
# passed to the field in the automatically generated unittests.
# dict[str, type] - override inferred types (use "mime-like" string for file-format types,
# e.g. 'medimage/nifti-gz'). For most fields the type will be correctly inferred
# from the nipype interface, but you may want to be more specific, particularly
# for file types, where specifying the format also specifies the file that will be
# passed to the field in the automatically generated unittests.
out_file: generic/file+list-of
# type=outputmultiobject:
# type=outputmultiobject:
out_meta: generic/file+list-of
# type=outputmultiobject:
# type=outputmultiobject:
callables:
# dict[str, str] - names of methods/callable classes defined in the adjacent `*_callables.py`
# to set to the `callable` attribute of output fields
Expand All @@ -54,38 +54,38 @@ outputs:
requirements:
# dict[str, list[str]] - input fields that are required to be provided for the output field to be present
tests:
- inputs:
# dict[str, str] - values to provide to inputs fields in the task initialisation
# (if not specified, will try to choose a sensible value)
base_directory:
# type=directory|default='': Path to the base directory for storing data.
check_hdr:
# type=bool|default=True: fix headers of NIfTI outputs
compress:
# type=inputmultiobject|default=[]: whether ``in_file`` should be compressed (True), uncompressed (False) or left unmodified (None, default).
data_dtype:
# type=str|default='': NumPy datatype to coerce NIfTI data to, or `source` tomatch the input file dtype
dismiss_entities:
# type=inputmultiobject|default=[]: a list entities that will not be propagated from the source file
in_file:
# type=inputmultiobject|default=[]: the object to be saved
meta_dict:
# type=dict|default={}: an input dictionary containing metadata
source_file:
# type=inputmultiobject|default=[]: the source file(s) to extract entities from
imports:
# list[nipype2pydra.task.base.explicitimport] - list import statements required by the test, with each list item
# consisting of 'module', 'name', and optionally 'alias' keys
expected_outputs:
# dict[str, str] - expected values for selected outputs, noting that tests will typically
# be terminated before they complete for time-saving reasons, and therefore
# these values will be ignored, when running in CI
timeout: 10
# int - the value to set for the timeout in the generated test,
# after which the test will be considered to have been initialised
# successfully. Set to 0 to disable the timeout (warning, this could
# lead to the unittests taking a very long time to complete)
xfail: true
# bool - whether the unittest is expected to fail or not. Set to false
# when you are satisfied with the edits you have made to this file
- inputs:
# dict[str, str] - values to provide to inputs fields in the task initialisation
# (if not specified, will try to choose a sensible value)
base_directory:
# type=directory|default='': Path to the base directory for storing data.
check_hdr:
# type=bool|default=True: fix headers of NIfTI outputs
compress:
# type=inputmultiobject|default=[]: whether ``in_file`` should be compressed (True), uncompressed (False) or left unmodified (None, default).
data_dtype:
# type=str|default='': NumPy datatype to coerce NIfTI data to, or `source` tomatch the input file dtype
dismiss_entities:
# type=inputmultiobject|default=[]: a list entities that will not be propagated from the source file
in_file:
# type=inputmultiobject|default=[]: the object to be saved
meta_dict:
# type=dict|default={}: an input dictionary containing metadata
source_file:
# type=inputmultiobject|default=[]: the source file(s) to extract entities from
imports:
# list[nipype2pydra.task.base.explicitimport] - list import statements required by the test, with each list item
# consisting of 'module', 'name', and optionally 'alias' keys
expected_outputs:
# dict[str, str] - expected values for selected outputs, noting that tests will typically
# be terminated before they complete for time-saving reasons, and therefore
# these values will be ignored, when running in CI
timeout: 10
# int - the value to set for the timeout in the generated test,
# after which the test will be considered to have been initialised
# successfully. Set to 0 to disable the timeout (warning, this could
# lead to the unittests taking a very long time to complete)
xfail: true
# bool - whether the unittest is expected to fail or not. Set to false
# when you are satisfied with the edits you have made to this file
doctests: []
1 change: 1 addition & 0 deletions nipype-auto-conv/specs/interfaces/iqm_file_sink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@ tests:
doctests: []
find_replace:
- [config\.loggers\.\w+\., logger.]
- ["value=Undefined", "value=attrs.NOTHING"]
100 changes: 51 additions & 49 deletions nipype-auto-conv/specs/interfaces/synth_strip.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# Docs
# ----
#
#
task_name: SynthStrip
nipype_name: SynthStrip
nipype_module: mriqc.interfaces.synthstrip
Expand All @@ -15,11 +15,11 @@ inputs:
rename:
# dict[str, str] - fields to rename in the Pydra interface
types:
# dict[str, type] - override inferred types (use "mime-like" string for file-format types,
# e.g. 'medimage/nifti-gz'). For most fields the type will be correctly inferred
# from the nipype interface, but you may want to be more specific, particularly
# for file types, where specifying the format also specifies the file that will be
# passed to the field in the automatically generated unittests.
# dict[str, type] - override inferred types (use "mime-like" string for file-format types,
# e.g. 'medimage/nifti-gz'). For most fields the type will be correctly inferred
# from the nipype interface, but you may want to be more specific, particularly
# for file types, where specifying the format also specifies the file that will be
# passed to the field in the automatically generated unittests.
in_file: generic/file
# type=file|default=<undefined>: Input image to be brain extracted
model: generic/file
Expand All @@ -34,18 +34,20 @@ inputs:
# dict[str, str] - names of methods/callable classes defined in the adjacent `*_callables.py`
# to set as the `default` method of input fields
metadata:
in_file:
copyfile: true
# dict[str, dict[str, any]] - additional metadata to set on any of the input fields (e.g. out_file: position: 1)
outputs:
omit:
# list[str] - fields to omit from the Pydra interface
rename:
# dict[str, str] - fields to rename in the Pydra interface
types:
# dict[str, type] - override inferred types (use "mime-like" string for file-format types,
# e.g. 'medimage/nifti-gz'). For most fields the type will be correctly inferred
# from the nipype interface, but you may want to be more specific, particularly
# for file types, where specifying the format also specifies the file that will be
# passed to the field in the automatically generated unittests.
# dict[str, type] - override inferred types (use "mime-like" string for file-format types,
# e.g. 'medimage/nifti-gz'). For most fields the type will be correctly inferred
# from the nipype interface, but you may want to be more specific, particularly
# for file types, where specifying the format also specifies the file that will be
# passed to the field in the automatically generated unittests.
out_file: generic/file
# type=file: brain-extracted image
# type=file|default=<undefined>: store brain-extracted input to file
Expand All @@ -60,42 +62,42 @@ outputs:
requirements:
# dict[str, list[str]] - input fields that are required to be provided for the output field to be present
tests:
- inputs:
# dict[str, str] - values to provide to inputs fields in the task initialisation
# (if not specified, will try to choose a sensible value)
in_file:
# type=file|default=<undefined>: Input image to be brain extracted
use_gpu:
# type=bool|default=False: Use GPU
model:
# type=file|default=<undefined>: file containing model's weights
border_mm:
# type=int|default=1: Mask border threshold in mm
out_file:
# type=file: brain-extracted image
# type=file|default=<undefined>: store brain-extracted input to file
out_mask:
# type=file: brain mask
# type=file|default=<undefined>: store brainmask to file
num_threads:
# type=int|default=0: Number of threads
args:
# type=str|default='': Additional parameters to the command
environ:
# type=dict|default={}: Environment variables
imports:
# list[nipype2pydra.task.base.explicitimport] - list import statements required by the test, with each list item
# consisting of 'module', 'name', and optionally 'alias' keys
expected_outputs:
# dict[str, str] - expected values for selected outputs, noting that tests will typically
# be terminated before they complete for time-saving reasons, and therefore
# these values will be ignored, when running in CI
timeout: 10
# int - the value to set for the timeout in the generated test,
# after which the test will be considered to have been initialised
# successfully. Set to 0 to disable the timeout (warning, this could
# lead to the unittests taking a very long time to complete)
xfail: true
# bool - whether the unittest is expected to fail or not. Set to false
# when you are satisfied with the edits you have made to this file
- inputs:
# dict[str, str] - values to provide to inputs fields in the task initialisation
# (if not specified, will try to choose a sensible value)
in_file:
# type=file|default=<undefined>: Input image to be brain extracted
use_gpu:
# type=bool|default=False: Use GPU
model:
# type=file|default=<undefined>: file containing model's weights
border_mm:
# type=int|default=1: Mask border threshold in mm
out_file:
# type=file: brain-extracted image
# type=file|default=<undefined>: store brain-extracted input to file
out_mask:
# type=file: brain mask
# type=file|default=<undefined>: store brainmask to file
num_threads:
# type=int|default=0: Number of threads
args:
# type=str|default='': Additional parameters to the command
environ:
# type=dict|default={}: Environment variables
imports:
# list[nipype2pydra.task.base.explicitimport] - list import statements required by the test, with each list item
# consisting of 'module', 'name', and optionally 'alias' keys
expected_outputs:
# dict[str, str] - expected values for selected outputs, noting that tests will typically
# be terminated before they complete for time-saving reasons, and therefore
# these values will be ignored, when running in CI
timeout: 10
# int - the value to set for the timeout in the generated test,
# after which the test will be considered to have been initialised
# successfully. Set to 0 to disable the timeout (warning, this could
# lead to the unittests taking a very long time to complete)
xfail: true
# bool - whether the unittest is expected to fail or not. Set to false
# when you are satisfied with the edits you have made to this file
doctests: []
15 changes: 11 additions & 4 deletions nipype-auto-conv/specs/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ config_params:
varname: config.environment
type: struct
module: mriqc
inputs_entities:
varname: config.workflow.inputs_entities
type: struct
module: mriqc
omit_functions:
- nipype.external.due.BibTeX
omit_classes:
Expand All @@ -35,6 +39,12 @@ omit_constants:
import_translations:
- [nireports, pydra.tasks.nireports]
- [niworkflows, pydra.tasks.niworkflows]
import_find_replace:
- ["from \\.\\. import config, logging", ""]
- ["_ReadDWIMetadataOutputSpec,", ""]
- ["from pydra.tasks.mriqc.nipype_ports.interfaces import utility as niu", ""]
- ["\\s+config,(\\s+)fname_presuffix,", "\\1fname_presuffix,"]
- ["from pydra.tasks.io.auto import add_traits\n", ""]
find_replace:
- [config\.loggers\.\w+\., logger.]
- [config.to_filename\(\), ""]
Expand All @@ -55,9 +65,6 @@ find_replace:
# - ["\\bdict\\[", "ty.Dict["]
omit_modules:
- "mriqc.config"
import_find_replace:
- ["from \\.\\. import config, logging", ""]
- ["_ReadDWIMetadataOutputSpec,", ""]
- ["from pydra.tasks.mriqc.nipype_ports.interfaces import utility as niu", ""]
copy_packages:
- mriqc.data
- mriqc.synthstrip
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ nipype_name: anat_qc_workflow
nipype_module: mriqc.workflows.anatomical.base
# Name of the node that is to be considered the input of the workflow, i.e. its outputs will be the inputs of the workflow
input_node: inputnode
inputs:
in_file:
type: medimage/t1w+nifti-gz-x
modality:
type: field/text
connections:
- [norm, modality]
# name of the workflow variable that is returned
workflow_variable: workflow
# the names of the nested workflows that are defined in other modules and need to be imported
Expand All @@ -21,3 +28,8 @@ find_replace:
"# fmt: off\\n\\s*workflow.set_output\\(\\[\\('iqmswf_measures', workflow.iqmswf.lzout.measures\\)\\]\\)",
"",
]
- [
"modality=workflow.lzin.modality,(\\s+)name=\"norm\"",
"modality=workflow.lzin.modality,\\1name=\"spatial_norm\"",
]
- ["workflow\\.norm\\b", "workflow.spatial_norm"]
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ find_replace:
- ["config = NipypeConfig\\(\\)", ""]
- ["iflogger = logging.getLogger\\(\"nipype.interface\"\\)", ""]
- ["logging = Logging\\(config\\)", ""]
- ["save_bias=True", "bias_image=True"]
# name of the workflow variable that is returned
workflow_variable: workflow
# the names of the nested workflows that are defined in other modules and need to be imported
Expand Down
Loading
Loading