Skip to content

Commit

Permalink
changed a few things to hopefully get the auto package to import
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Nov 3, 2023
1 parent e1853b7 commit 7e4d019
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions nipype-auto-conv/generate
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions pydra/tasks/freesurfer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')}` "
Expand Down

0 comments on commit 7e4d019

Please sign in to comment.