Skip to content

Commit 9c9410e

Browse files
committed
split base and shell compose modules into packages
1 parent 0833ea8 commit 9c9410e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+5535
-5448
lines changed

docs/source/examples/glm.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"import typing as ty\n",
5656
"from pathlib import Path\n",
5757
"\n",
58-
"from pydra.design import python, workflow\n",
58+
"from pydra.compose import python, workflow\n",
5959
"from pydra.engine.submitter import Submitter\n",
6060
"from fileformats.generic import File, Directory\n",
6161
"from fileformats.text import Csv\n",

docs/source/tutorial/4-python.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"\n",
1212
"## Define decorator\n",
1313
"\n",
14-
"The simplest way to define a Python task is to decorate a function with `pydra.design.python.define`"
14+
"The simplest way to define a Python task is to decorate a function with `pydra.compose.python.define`"
1515
]
1616
},
1717
{
@@ -20,7 +20,7 @@
2020
"metadata": {},
2121
"outputs": [],
2222
"source": [
23-
"from pydra.design import python\n",
23+
"from pydra.compose import python\n",
2424
"\n",
2525
"\n",
2626
"# Note that we use PascalCase because the object returned by the decorator is actually a class\n",
@@ -123,7 +123,7 @@
123123
"metadata": {},
124124
"outputs": [],
125125
"source": [
126-
"from pydra.design import python\n",
126+
"from pydra.compose import python\n",
127127
"\n",
128128
"\n",
129129
"@python.define\n",

docs/source/tutorial/5-shell.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"metadata": {},
2323
"outputs": [],
2424
"source": [
25-
"from pydra.design import shell\n",
25+
"from pydra.compose import shell\n",
2626
"\n",
2727
"Cp = shell.define(\"cp <in_file> <out|destination>\")"
2828
]
@@ -193,7 +193,7 @@
193193
"metadata": {},
194194
"outputs": [],
195195
"source": [
196-
"from pydra.design import shell\n",
196+
"from pydra.compose import shell\n",
197197
"from fileformats.generic import File\n",
198198
"\n",
199199
"Gzip = shell.define(\"gzip <out|out_file:application/gzip> <in_files+>\")\n",
@@ -295,7 +295,7 @@
295295
"outputs": [],
296296
"source": [
297297
"import os\n",
298-
"from pydra.design import shell\n",
298+
"from pydra.compose import shell\n",
299299
"from pathlib import Path\n",
300300
"from fileformats.generic import File\n",
301301
"\n",

docs/source/tutorial/6-workflow.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"source": [
1818
"## Constructor functions\n",
1919
"\n",
20-
"Workflows are typically defined using the `pydra.design.workflow.define` decorator on \n",
20+
"Workflows are typically defined using the `pydra.compose.workflow.define` decorator on \n",
2121
"a \"constructor\" function that generates the workflow. For example, given two task\n",
2222
"definitions, `Add` and `Mul`."
2323
]
@@ -28,7 +28,7 @@
2828
"metadata": {},
2929
"outputs": [],
3030
"source": [
31-
"from pydra.design import workflow, python\n",
31+
"from pydra.compose import workflow, python\n",
3232
"\n",
3333
"\n",
3434
"# Example python tasks\n",
@@ -81,7 +81,7 @@
8181
"metadata": {},
8282
"outputs": [],
8383
"source": [
84-
"from pydra.design import shell\n",
84+
"from pydra.compose import shell\n",
8585
"from fileformats import image, video\n",
8686
"\n",
8787
"\n",
@@ -447,7 +447,7 @@
447447
"from fileformats.medimage import Nifti1\n",
448448
"import fileformats.medimage_mrtrix3 as mrtrix3\n",
449449
"from pydra.engine.environments import Docker\n",
450-
"from pydra.design import workflow, python\n",
450+
"from pydra.compose import workflow, python\n",
451451
"from pydra.tasks.mrtrix3.v3_0 import MrConvert, MrThreshold\n",
452452
"\n",
453453
"MRTRIX2NUMPY_DTYPES = {\n",

docs/source/tutorial/7-canonical-form.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"# Canonical task form\n",
88
"\n",
99
"Under the hood, all Python, shell and workflow tasks generated by the\n",
10-
"`pydra.design.*.define` decorators/functions are translated to\n",
10+
"`pydra.compose.*.define` decorators/functions are translated to\n",
1111
"[dataclasses](https://docs.python.org/3/library/dataclasses.html) by the\n",
1212
"[Attrs](https://www.attrs.org/en/stable/). While the more compact syntax described\n",
1313
"in the [Python-tasks](./4-python.html), [Shell-tasks](./5-shell.html) and [Workflow](./6-workflow.html)\n",
@@ -28,7 +28,7 @@
2828
"source": [
2929
"## Python-tasks\n",
3030
"\n",
31-
"Python tasks in dataclass form are decorated by `pydra.design.python.define`\n",
31+
"Python tasks in dataclass form are decorated by `pydra.compose.python.define`\n",
3232
"with inputs listed as type annotations. Outputs are similarly defined in a nested class\n",
3333
"called `Outputs`. The function to be executed should be a staticmethod called `function`.\n",
3434
"Default values can also be set directly, as with Attrs classes.\n",
@@ -49,7 +49,7 @@
4949
"from pprint import pprint\n",
5050
"from pydra.engine.helpers import fields_dict\n",
5151
"from pydra.engine.specs import PythonTask, PythonOutputs\n",
52-
"from pydra.design import python\n",
52+
"from pydra.compose import python\n",
5353
"\n",
5454
"\n",
5555
"@python.define\n",
@@ -152,7 +152,7 @@
152152
"import os\n",
153153
"from pathlib import Path\n",
154154
"from fileformats import generic\n",
155-
"from pydra.design import shell\n",
155+
"from pydra.compose import shell\n",
156156
"from pydra.engine.specs import ShellTask, ShellOutputs\n",
157157
"from pydra.utils.typing import MultiInputObj\n",
158158
"\n",
@@ -200,7 +200,7 @@
200200
"metadata": {},
201201
"outputs": [],
202202
"source": [
203-
"from pydra.design import python, workflow\n",
203+
"from pydra.compose import python, workflow\n",
204204
"from pydra.engine.specs import WorkflowTask, WorkflowOutputs\n",
205205
"\n",
206206
"\n",

pydra/compose/base/__init__.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from .field import Field, Arg, Out, NO_DEFAULT
2+
from .helpers import (
3+
ensure_field_objects,
4+
parse_doc_string,
5+
extract_function_inputs_and_outputs,
6+
check_explicit_fields_are_none,
7+
extract_fields_from_class,
8+
is_set,
9+
)
10+
from .task import Task, Outputs
11+
from .builder import build_task_class
12+
13+
__all__ = [
14+
"Field",
15+
"Arg",
16+
"Out",
17+
"NO_DEFAULT",
18+
"ensure_field_objects",
19+
"parse_doc_string",
20+
"extract_function_inputs_and_outputs",
21+
"check_explicit_fields_are_none",
22+
"extract_fields_from_class",
23+
"is_set",
24+
"build_task_class",
25+
"Task",
26+
"Outputs",
27+
]

0 commit comments

Comments
 (0)