diff --git a/.github/workflows/pythonpackage.yaml b/.github/workflows/pythonpackage.yaml index 33c5b35..2b17a7a 100644 --- a/.github/workflows/pythonpackage.yaml +++ b/.github/workflows/pythonpackage.yaml @@ -106,7 +106,7 @@ jobs: python -m pip install --upgrade pip - name: Install task package run: | - pip install ".[test]" + pip install -e ".[test]" python -c "import pydra.tasks.freesurfer as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" python -c "import pydra as m; print(f'{m.__name__} {m.__version__} @ {m.__file__}')" - name: Test with pytest diff --git a/nipype-auto-conv/generate b/nipype-auto-conv/generate index 2e27fd1..dca1fb9 100755 --- a/nipype-auto-conv/generate +++ b/nipype-auto-conv/generate @@ -7,7 +7,7 @@ import shutil from importlib import import_module import yaml import nipype -import nipype2pydra +import nipype2pydra.utils from nipype2pydra.task import TaskConverter @@ -47,13 +47,15 @@ for fspath in sorted(SPECS_DIR.glob("**/*.yaml")): callables = import_module(rel_pkg_path + "_callables") + module_name = nipype2pydra.utils.to_snake_case(spec["task_name"]) + converter = TaskConverter( - output_module=f"pydra.tasks.{PKG_NAME}.auto.{spec['task_name']}", + output_module=f"pydra.tasks.{PKG_NAME}.auto.{module_name}", callables_module=callables, # type: ignore **spec, ) converter.generate(PKG_ROOT) - auto_init += f"from .{spec['task_name']} import {converter.task_name}\n" + auto_init += f"from .{module_name} import {converter.task_name}\n" with open(PKG_ROOT / "pydra" / "tasks" / PKG_NAME / "auto" / "_version.py", "w") as f: diff --git a/pydra/tasks/freesurfer/__init__.py b/pydra/tasks/freesurfer/__init__.py index 0185301..179c1f8 100644 --- a/pydra/tasks/freesurfer/__init__.py +++ b/pydra/tasks/freesurfer/__init__.py @@ -20,8 +20,8 @@ if "nipype" not in __version__: try: from .auto._version import nipype_version, nipype2pydra_version - except ImportError: - if "No module named pydra.tasks.freesurfer.auto._version": + except ModuleNotFoundError as e: + if "No module named 'pydra.tasks.freesurfer.auto._version'" in str(e): warn( "Nipype interfaces haven't been automatically converted from their specs in " f"`nipype-auto-conv`. Please run `{str(pkg_path / 'nipype-auto-conv' / 'generate')}` "