Skip to content

feat(app-page): vendor tools as Nipype interfaces & Pydra tasks - #11

Merged
nx10 merged 1 commit into
mainfrom
feat/nipype-pydra-vendoring
Jun 6, 2026
Merged

feat(app-page): vendor tools as Nipype interfaces & Pydra tasks#11
nx10 merged 1 commit into
mainfrom
feat/nipype-pydra-vendoring

Conversation

@nx10

@nx10 nx10 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

What & why

@styx-api/core 0.5.0 (now latest) adds experimental nipype and pydra code generation. This surfaces both in the "Vendor this tool" (Source) tab so users can vendor a tool as a Nipype Interface or a Pydra task — not just a raw Python/TS wrapper — and reworks the picker, which had outgrown its flat tab strip.

The key wrinkle: 2-file delegation

generateNipype/generatePydra don't produce single-file drop-ins. Each emits an interface/task file that imports the styx Python wrapper (from ._bet import bet, BetOutputs). So those targets render two files<iface>.py + _<styx>.py (the latter reusing the existing pythonModule) — with a "drop both files together" note. Filenames come from the compiler's own stems, never the raw tool name, which is required for the relative import to resolve (e.g. afni/3dcalcfrom ._v_3dcalc import v_3dcalc, since 3dcalc can't name a Python module).

Changes

  • Bump @styx-api/core 0.4.00.5.0.
  • Worker emits generateNipype/generatePydra defensively (try/catchnull, with a console.warn so a genuine codegen regression is distinguishable from the intended per-tool "not applicable" skip), plus a canonical moduleStem from buildTypedSpec.
  • Thread a DelegationArtifact type + moduleStem through the compile protocol → client → AppPageResultsPanel.
  • UX: the cramped 5→7 tab strip becomes a grouped Select (Language wrappers / Workflow frameworks (Python) / Specs) + content panel. Nipype/Pydra carry an Experimental badge and a caveat note. The shown target is derived (falls back to the first available option) instead of reset in an effect.
  • Consistency fix (pre-existing): all vendored filenames now use the compiler's module stem, so e.g. 3dcalc yields import-valid v_3dcalc.py / v_3dcalc.ts matching the delegation files, instead of the non-importable 3dcalc.py.

Heads-up

Bumping to 0.5.0 will trip the existing "Compiler version mismatch" banner until the published niwrap manifest is rebuilt with 0.5.0 — that's the lockstep warning working as intended, not a regression.

Verification

  • npm run check (0 errors), npm run lint, npm run test (185 passing) all green.
  • In-browser (fsl/bet + afni/3dcalc): grouped Select shows 3 headings / 7 options / Experimental badges; Nipype → bet.py + _bet.py with a resolving import + note; 3dcalc → v_3dcalc.py / _v_3dcalc.py; Python/TypeScript/Boutiques/schemas all still render; no console errors.

styx 0.5.0 adds experimental nipype/pydra codegen. Surface both in the
"Vendor this tool" (Source) tab, and rework the now-7-target picker.

- Bump @styx-api/core 0.4.0 -> 0.5.0.
- Worker emits generateNipype/generatePydra defensively (try/catch -> null,
  with a console.warn so a real codegen regression is distinguishable from the
  intended per-tool "not applicable" skip). Both are 2-file delegation targets:
  the interface/task file imports the styx Python wrapper, so each ships as
  <iface>.py + _<styx>.py (the latter reusing pythonModule).
- Thread DelegationArtifact + a canonical moduleStem through the compile
  protocol, client, AppPage, and ResultsPanel.
- Replace the cramped flat sub-tab strip with a grouped Select (Language
  wrappers / Workflow frameworks (Python) / Specs) + content panel; nipype/pydra
  carry an Experimental badge and a caveat note. The effective target is derived
  (falls back to the first available option) rather than reset in an effect.
- Name vendored files from the compiler's module stem, not the raw tool name, so
  e.g. afni/3dcalc yields import-valid v_3dcalc.py / _v_3dcalc.py and every
  artifact for a tool shares one stem.
@nx10
nx10 merged commit f628507 into main Jun 6, 2026
4 checks passed
@nx10
nx10 deleted the feat/nipype-pydra-vendoring branch June 6, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant