From 1c6ac974cc9c39049243bb6ccaf3ee81b2dbf559 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Tue, 20 May 2025 12:12:57 +1000 Subject: [PATCH 1/5] allow sequence types for fields with requires (can be empty) --- pydra/compose/base/field.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pydra/compose/base/field.py b/pydra/compose/base/field.py index d72f2bfaf..6d620e7d3 100644 --- a/pydra/compose/base/field.py +++ b/pydra/compose/base/field.py @@ -229,7 +229,12 @@ def mandatory(self): @requires.validator def _requires_validator(self, _, value): - if value and self.type not in (ty.Any, bool) and not is_optional(self.type): + if ( + value + and self.type not in (ty.Any, bool) + and not is_optional(self.type) + and not issubclass(self.type, ty.Sequence) + ): raise ValueError( f"Fields with requirements must be of optional type (i.e. in union " f"with None) or boolean, not type {self.type} ({self!r})" From e90a4328511079e0c82667d5be0620c3b46fdbf9 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Tue, 20 May 2025 12:17:36 +1000 Subject: [PATCH 2/5] updated heading of Canonical forms --- docs/source/tutorial/7-canonical-form.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/tutorial/7-canonical-form.ipynb b/docs/source/tutorial/7-canonical-form.ipynb index 428ef217a..972ebd924 100644 --- a/docs/source/tutorial/7-canonical-form.ipynb +++ b/docs/source/tutorial/7-canonical-form.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Canonical form and serialisation\n", + "# Canonical forms\n", "\n", "## Canonical task form\n", "\n", From 3af9d5308a2847d26e7ae9342812c9fadd5ced08 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Fri, 23 May 2025 11:11:05 +1000 Subject: [PATCH 3/5] fixed up headings in canonical form notebook --- docs/source/tutorial/7-canonical-form.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/tutorial/7-canonical-form.ipynb b/docs/source/tutorial/7-canonical-form.ipynb index 972ebd924..d834249fe 100644 --- a/docs/source/tutorial/7-canonical-form.ipynb +++ b/docs/source/tutorial/7-canonical-form.ipynb @@ -28,7 +28,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Python-tasks\n", + "### Python-tasks\n", "\n", "Python tasks in dataclass form are decorated by `pydra.compose.python.define`\n", "with inputs listed as type annotations. Outputs are similarly defined in a nested class\n", @@ -135,7 +135,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Shell-tasks\n", + "### Shell-tasks\n", "\n", "The canonical form of shell tasks is the same as for Python tasks, except a string `executable`\n", "attribute replaces the `function` staticmethod." @@ -183,7 +183,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Workflow definitions\n", + "### Workflow definitions\n", "\n", "Workflows can also be defined in canonical form, which is the same as for Python tasks\n", "but with a staticmethod called `constructor` that constructs the workflow." @@ -242,7 +242,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Converting to/from dictionaries\n", + "## Conversion to/from dictionaries\n", "\n", "As well as the dataclass-like canonical form, it is also possible to represent all tasks\n", "in a nested dictionary form, which could be written to a static file (e.g. in JSON or\n", From de8808539490d4b098707e30804f02488db86f39 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Sun, 22 Jun 2025 16:41:41 +1000 Subject: [PATCH 4/5] touching up ci/cd --- .github/workflows/ci-cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index b13075d87..8e21643b0 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -182,7 +182,7 @@ jobs: docker exec slurm bash -c "ls -la /pydra && echo list pydra dir" docker exec slurm bash -c "CONFIGURE_OPTS=\"-with-openssl=/opt/openssl\" pyenv install -v ${{ matrix.python-version }}" docker exec slurm bash -c "pyenv global ${{ matrix.python-version }}" - docker exec slurm bash -c "pip install --upgrade pip && pip install -e /pydra[test,psij] && python -c 'import pydra.engine; print(pydra.utils.__version__)'" + docker exec slurm bash -c "pip install --upgrade pip && pip install 'numpy<2' -e /pydra[test,psij] && python -c 'import pydra.engine; print(pydra.utils.__version__)'" - name: Run pytest run: | docker exec slurm bash -c "cd /pydra; pytest pydra/workers/tests/test_worker.py --only-worker=slurm --color=yes" @@ -317,7 +317,7 @@ jobs: activate-environment: "" - name: Install MRtrix via Conda run: | - conda install -c mrtrix3 mrtrix3 + conda install -c conda-forge -c MRtrix3 mrtrix3 libstdcxx-ng mrconvert --version - name: Set up Python uses: actions/setup-python@v5 From 8de9b30ca3437ad749e7f4a1e93bd029c7b9067c Mon Sep 17 00:00:00 2001 From: Tom Close Date: Sun, 22 Jun 2025 16:46:38 +1000 Subject: [PATCH 5/5] create dummy aliases for mrtrix conda --- .github/workflows/ci-cd.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 8e21643b0..12dd75a69 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -315,8 +315,11 @@ jobs: with: auto-activate-base: true activate-environment: "" + # We generate dummy aliases so they can be deleted by conda later without throwing an error - name: Install MRtrix via Conda run: | + alias shview='ls' + alias mrview='ls' conda install -c conda-forge -c MRtrix3 mrtrix3 libstdcxx-ng mrconvert --version - name: Set up Python