@@ -35,14 +35,14 @@ Let's start from the previous example:
35
35
36
36
37
37
In order to create an input specification, a new `SpecInfo ` object has to be created.
38
- The field `name ` specifiest the typo of the spec and it should be always "Input" for
38
+ The field `name ` specifies the type of the spec and it should be always "Input" for
39
39
the input specification.
40
40
The field `bases ` specifies the "base specification" you want to use (can think about it as a
41
41
`parent class `) and it will usually contains `ShellSpec ` only, unless you want to build on top of
42
42
your other specification (this will not be cover in this section).
43
43
The part that should be always customised is the `fields ` part.
44
44
Each element of the `fields ` is a separate input field that is added to the specification.
45
- In this example, a three-elements tuples - with name, type and dictionary with additional
45
+ In this example, three-elements tuples - with name, type and dictionary with additional
46
46
information - are used.
47
47
But this is only one of the supported syntax, more options will be described below.
48
48
@@ -86,9 +86,25 @@ However, we allow for shorter syntax, that does not include `attr.ib`:
86
86
87
87
Each of the shorter versions will be converted to the `(name, attr.ib(... )`.
88
88
89
+
90
+ Types
91
+ ---- -
92
+
89
93
Type can be provided as a simple python type (e.g. `str ` , `int ` , `float ` , etc.)
90
94
or can be more complex by using `typing.List` , `typing.Dict` and `typing.Union` .
91
95
96
+ There are also special types provided by Pydra:
97
+
98
+ - `File` and `Directory` - should be used in `input_spec` if the field is an existing file
99
+ or directory.
100
+ Pydra checks if the file or directory exists, and returns an error if it doesn' t exist.
101
+
102
+
103
+ - `MultiInputObj` - a special type that takes a any value and if the value is not a list it
104
+ converts value to a 1 - element list (it could be used together with `MultiOutputObj`
105
+ in the `output_spec` to reverse the conversion of the output values).
106
+
107
+
92
108
93
109
Metadata
94
110
--------
@@ -126,9 +142,6 @@ In the example we used multiple keys in the metadata dictionary including `help_
126
142
`xor` (`list ` ):
127
143
List of field names that are mutually exclusive with the field.
128
144
129
- `keep_extension` (`bool ` , default: `True ` ):
130
- A flag that specifies if the file extension should be removed from the field value.
131
-
132
145
`copyfile` (`bool ` , default: `False ` ):
133
146
If `True ` , a hard link is created for the input file in the output directory.
134
147
If hard link not possible, the file is copied to the output directory.
@@ -139,9 +152,16 @@ In the example we used multiple keys in the metadata dictionary including `help_
139
152
`output_file_template` (`str ` ):
140
153
If provided, the field is treated also as an output field and it is added to the output spec.
141
154
The template can use other fields, e.g. `{file1}` .
155
+ Used in order to create an output specification.
142
156
143
157
`output_field_name` (`str ` , used together with `output_file_template` )
144
158
If provided the field is added to the output spec with changed name.
159
+ Used in order to create an output specification.
160
+
161
+ `keep_extension` (`bool ` , default: `True ` ):
162
+ A flag that specifies if the file extension should be removed from the field value.
163
+ Used in order to create an output specification.
164
+
145
165
146
166
`readonly` (`bool ` , default: `False ` ):
147
167
If `True ` the input field can' t be provided by the user but it aggregates other input fields
0 commit comments