Skip to content

Commit a3534ef

Browse files
authored
Merge pull request #13 from kaitj/maint/boutiques-guide
Fix boutiques guide
2 parents 09e1a79 + 07b6465 commit a3534ef

5 files changed

Lines changed: 45 additions & 13 deletions

File tree

src/boutiques_guide/advanced_features.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ NiWrap uses separate package configuration files to organize tools by suite:
5959
### Endpoint Status Values
6060

6161
The `status` field in each endpoint tracks implementation:
62+
6263
- `"done"`: Descriptor is complete and ready to use
6364
- `"missing"`: Tool is identified but descriptor not yet created
6465
- `"ignore"`: Tool should be deliberately excluded from the API
@@ -83,6 +84,7 @@ For tools that output important data to stdout or stderr, the Styx ecosystem ext
8384
```
8485

8586
These fields make the command output available as strings in the generated bindings, useful for tools that:
87+
8688
- Output data tables to the terminal
8789
- Provide processing statistics on stderr
8890
- Generate simple text outputs without writing files
@@ -219,13 +221,15 @@ Several fields help constrain parameter values:
219221
When creating or modifying descriptors, use these validation methods:
220222

221223
1. JSON Schema validation:
224+
222225
```bash
223226
# In NiWrap repository
224227
python -m pytest tests/test_descriptors.py::test_descriptor_validity
225228
```
226229

227230
2. Visual Studio Code validation:
228231
Add this to `.vscode/settings.json`:
232+
229233
```json
230234
{
231235
"json.schemas": [
@@ -238,6 +242,7 @@ When creating or modifying descriptors, use these validation methods:
238242
```
239243

240244
3. Build testing:
245+
241246
```bash
242247
# Test if Styx can process your descriptor
243248
python build.py
@@ -260,4 +265,4 @@ Now that you've explored advanced features, you might find these pages helpful:
260265

261266
- [Examples](./examples.md) - Complete descriptors demonstrating these concepts in action
262267
- [Troubleshooting](./troubleshooting.md) - Solutions to common problems with descriptors
263-
- [Subcommands](./subcommands.md) - More on hierarchical command structures
268+
- [Subcommands](./subcommands.md) - More on hierarchical command structures

src/boutiques_guide/basic_structure.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Optional list-related fields:
8888
- `list-separator`: Character(s) used to join list values (default is space)
8989

9090
Example with a custom separator:
91+
9192
```json
9293
{
9394
"id": "tags",
@@ -112,6 +113,7 @@ Value keys connect parameters to positions in the command line. In the Styx ecos
112113
- Match exactly in the `command-line` template
113114

114115
Example:
116+
115117
```json
116118
"command-line": "bet [INFILE] [OUTFILE] [OPTIONS]",
117119
"inputs": [
@@ -191,7 +193,8 @@ Container configurations help ensure reproducibility:
191193
}
192194
```
193195

194-
In the Styx ecosystem, primarily the `type` and `image` fields are used, with Docker as the main container type.
196+
In the Styx ecosystem, primarily the `type` and `image` fields are used, with Docker as
197+
the only container type.
195198

196199
## Cross-References
197200

@@ -201,4 +204,4 @@ Now that you understand the basic structure, learn more about:
201204
- [File Handling](./file_handling.md) - For detailed file input/output, path templates, and extension handling
202205
- [Advanced Features](./advanced_features.md) - For command output capture, package configuration, and more
203206
- [Troubleshooting](./troubleshooting.md) - For common issues and their solutions
204-
- [Examples](./examples.md) - For complete descriptor examples showing these concepts in action
207+
- [Examples](./examples.md) - For complete descriptor examples showing these concepts in action

src/boutiques_guide/file_handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ If the input is `subject1.nii.gz`, this would produce `subject1_mask.nii.gz` (no
111111
| `id` | Unique identifier | Yes | `"brain_mask"` |
112112
| `name` | Human-readable name | Yes | `"Brain Mask Image"` |
113113
| `description` | Detailed description | No | `"Binary mask of the brain"` |
114-
| `path-template` | Template for output file path | Yes | `"[OUTPUT_DIR]/[PREFIX]_mask.nii.gz"` |
114+
| `path-template` | Template for output file path | Yes | `"[PREFIX]_mask.nii.gz"` |
115115
| `optional` | Whether file might not be produced | No | `true` |
116116
| `path-template-stripped-extensions` | Extensions to remove from input paths | No | `[".nii.gz", ".nii"]` |
117117

@@ -246,4 +246,4 @@ The Styx execution environment handles these mappings transparently, but it's im
246246
"name": "Processing Log",
247247
"description": "Detailed log of the processing steps"
248248
}
249-
}
249+
}

src/boutiques_guide/subcommands.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ The most common use of subcommands is to represent different "modes" or "algorit
111111
```
112112

113113
In this example:
114+
114115
- The user must choose either the "fast" or "accurate" algorithm
115116
- Each algorithm has its own specific parameters
116117
- The "accurate" algorithm produces an additional output file
@@ -392,10 +393,11 @@ This ensures users can only provide valid parameter combinations.
392393
4. **Consider output files carefully** - each subcommand can have different outputs
393394
5. **Nest subcommands when it makes logical sense** for the tool's structure
394395
6. **Use value-choices for fixed option sets** within subcommands
395-
7. **Add list: true for repeatable elements** when the same subcommand can appear multiple times
396+
7. **Add `list: true` for repeatable elements** when the same subcommand can appear multiple times
396397

397398
## Next Steps
398399

399400
Now that you understand subcommands, learn about:
401+
400402
- [File Handling](./file_handling.md) - For detailed input/output file handling
401-
- [Advanced Features](./advanced_features.md) - For additional capabilities
403+
- [Advanced Features](./advanced_features.md) - For additional capabilities

src/boutiques_guide/troubleshooting.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This guide covers common issues when creating or modifying Boutiques descriptors
1313
**Problem**: `ERROR: 'name' is a required property`
1414

1515
**Solution**: Ensure all required top-level fields are present:
16+
1617
```json
1718
{
1819
"name": "tool_name",
@@ -29,6 +30,7 @@ This guide covers common issues when creating or modifying Boutiques descriptors
2930
**Problem**: `ERROR: 'string' is not of type 'number'`
3031

3132
**Solution**: Check that values match their declared types. For numeric parameters:
33+
3234
```json
3335
{
3436
"id": "threshold",
@@ -42,6 +44,7 @@ This guide covers common issues when creating or modifying Boutiques descriptors
4244
**Problem**: `ERROR: 'input-file' does not match pattern '^[0-9,_,a-z,A-Z]*$'`
4345

4446
**Solution**: IDs must contain only alphanumeric characters and underscores:
47+
4548
```json
4649
{
4750
"id": "input_file", // Not "input-file"
@@ -55,8 +58,10 @@ This guide covers common issues when creating or modifying Boutiques descriptors
5558

5659
**Problem**: Value-key placeholders aren't replaced in the command line.
5760

58-
**Solution**:
61+
**Solution**:
62+
5963
1. Ensure the value-key in the parameter matches exactly what's in the command-line:
64+
6065
```json
6166
"command-line": "tool [INPUT_FILE]",
6267
"inputs": [
@@ -74,6 +79,7 @@ This guide covers common issues when creating or modifying Boutiques descriptors
7479
**Problem**: Command-line flags aren't included in the generated command.
7580

7681
**Solution**: Make sure you're using the correct fields:
82+
7783
```json
7884
{
7985
"id": "verbose",
@@ -87,6 +93,7 @@ This guide covers common issues when creating or modifying Boutiques descriptors
8793
**Problem**: List values aren't formatted as expected in the command.
8894

8995
**Solution**: Use the `list-separator` field to control how values are joined:
96+
9097
```json
9198
{
9299
"id": "coordinates",
@@ -104,6 +111,7 @@ This guide covers common issues when creating or modifying Boutiques descriptors
104111
**Problem**: Parameters inside subcommands aren't accessible in the generated bindings.
105112

106113
**Solution**: Check your subcommand structure:
114+
107115
```json
108116
{
109117
"id": "algorithm",
@@ -126,6 +134,7 @@ This guide covers common issues when creating or modifying Boutiques descriptors
126134
**Problem**: The descriptor doesn't enforce mutually exclusive options.
127135

128136
**Solution**: Instead of using `groups` with `mutually-exclusive`, use subcommands:
137+
129138
```json
130139
{
131140
"id": "mode",
@@ -144,7 +153,8 @@ This creates a proper union type in the generated bindings.
144153

145154
**Problem**: Input files are reported as not found even though they exist.
146155

147-
**Solution**:
156+
**Solution**:
157+
148158
1. Make sure you're using `"type": "File"` for input files
149159
2. Check if paths are relative to the current working directory
150160
3. For containerized runs, verify file paths are accessible in the container
@@ -154,6 +164,7 @@ This creates a proper union type in the generated bindings.
154164
**Problem**: Output files appear in unexpected locations.
155165

156166
**Solution**: Check your `path-template` in output-files:
167+
157168
```json
158169
"output-files": [
159170
{
@@ -170,6 +181,7 @@ Ensure all value-keys (`[OUTPUT_DIR]`, `[PREFIX]`) are defined in your inputs.
170181
**Problem**: Output files have double extensions like `file.nii.gz.nii.gz`.
171182

172183
**Solution**: Use `path-template-stripped-extensions`:
184+
173185
```json
174186
"output-files": [
175187
{
@@ -186,9 +198,11 @@ Ensure all value-keys (`[OUTPUT_DIR]`, `[PREFIX]`) are defined in your inputs.
186198

187199
**Problem**: The container image cannot be pulled or found.
188200

189-
**Solution**:
201+
**Solution**:
202+
190203
1. Verify the container exists in the specified registry
191204
2. Ensure the image name and tag are correct:
205+
192206
```json
193207
"container-image": {
194208
"type": "docker",
@@ -201,6 +215,7 @@ Ensure all value-keys (`[OUTPUT_DIR]`, `[PREFIX]`) are defined in your inputs.
201215
**Problem**: The tool reports missing dependencies inside the container.
202216

203217
**Solution**: Use a container that includes all required dependencies. You may need to build a custom container with a Dockerfile:
218+
204219
```dockerfile
205220
FROM base/image:tag
206221
RUN apt-get update && apt-get install -y additional-dependency
@@ -212,10 +227,12 @@ RUN apt-get update && apt-get install -y additional-dependency
212227

213228
**Problem**: Confusion between value-keys and command-line-flags.
214229

215-
**Solution**:
230+
**Solution**:
231+
216232
- `value-key` is a placeholder in the command-line template
217233
- `command-line-flag` is the actual flag used in the command (e.g., `-v`, `--verbose`)
218234
- Both are often needed:
235+
219236
```json
220237
{
221238
"id": "threshold",
@@ -229,15 +246,17 @@ RUN apt-get update && apt-get install -y additional-dependency
229246
**Problem**: Confusion about how to define input and output files.
230247

231248
**Solution**:
249+
232250
- Input files use `"type": "File"` in the inputs section
233251
- Output files are defined in the `output-files` section with a `path-template`
234-
- For parameters that specify output paths, use `"type": "String"` (not "File")
252+
- For parameters that specify output paths, use `"type": "String"` (not `"File"`)
235253

236254
### Inconsistent Naming
237255

238256
**Problem**: Similar parameters have inconsistent naming across descriptors.
239257

240258
**Solution**: Follow consistent naming conventions:
259+
241260
```json
242261
// Good:
243262
"id": "input_file"
@@ -255,6 +274,7 @@ RUN apt-get update && apt-get install -y additional-dependency
255274
### Validating Descriptors
256275

257276
Always validate your descriptors before using them:
277+
258278
```bash
259279
# Using NiWrap validation
260280
python -m pytest tests/test_descriptors.py::test_descriptor_validity
@@ -266,6 +286,7 @@ python -m pytest tests/test_descriptors.py::test_descriptor_validity
266286
### Printing Command Line
267287

268288
When testing, print the full command line to see if it's formed correctly:
289+
269290
```python
270291
# Python
271292
from niwrap.tool import function
@@ -276,6 +297,7 @@ print(cmd)
276297
### Using Verbose Mode
277298

278299
Many tools have verbose or debug modes that can help identify issues:
300+
279301
```json
280302
{
281303
"id": "verbose",
@@ -292,4 +314,4 @@ If you're still having issues:
292314

293315
1. Check existing descriptors in the NiWrap repository for examples
294316
2. Examine the [Boutiques documentation](https://boutiques.github.io/doc/)
295-
3. Open an issue in the [NiWrap issue tracker](https://github.com/styx-api/niwrap/issues)
317+
3. Open an issue in the [NiWrap issue tracker](https://github.com/styx-api/niwrap/issues)

0 commit comments

Comments
 (0)