From 8e2b4e089ec79891027fb3df6ae262e983129384 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 16:39:43 +0000 Subject: [PATCH 1/8] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 24.2.0 → 24.3.0](https://github.com/psf/black/compare/24.2.0...24.3.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 518b51e4..f66b8cca 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: - id: end-of-file-fixer - id: sort-simple-yaml - repo: https://github.com/psf/black - rev: 24.2.0 + rev: 24.3.0 hooks: - id: black args: ['--line-length=119'] From e5624b0b076c3b20eb8e85b655d7d0b073ed9dc1 Mon Sep 17 00:00:00 2001 From: Dmitry Ganyushin Date: Thu, 6 Jun 2024 10:30:05 -0400 Subject: [PATCH 2/8] Settings to use param 2 python module (should be taken automatically) --- environment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index f04c4350..c159f939 100644 --- a/environment.yml +++ b/environment.yml @@ -17,8 +17,8 @@ dependencies: - datashader - hvplot # GUI - - panel<1.3 - - param<2 + - panel + - param - pyvista # IO - dxchange From c96867f43020f616824214335a0fec82cffec6a0 Mon Sep 17 00:00:00 2001 From: Jose Borreguero Date: Thu, 6 Jun 2024 13:48:36 -0400 Subject: [PATCH 3/8] Update the call to params() Signed-off-by: Jose Borreguero --- src/imars3d/backend/workflow/engine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/imars3d/backend/workflow/engine.py b/src/imars3d/backend/workflow/engine.py index c1e756fb..3736333f 100644 --- a/src/imars3d/backend/workflow/engine.py +++ b/src/imars3d/backend/workflow/engine.py @@ -104,7 +104,7 @@ def _instrospect_task_function(self, function_str: str) -> namedtuple: # depending on the value of other parameters. Methods `dryrun()` assume that # parameters are independent of each other independent = False if function_name in ["load_data"] else True - outputs = dict(function=f, paramdict=f.params(), params_independent=independent) + outputs = dict(function=f, paramdict=f.param.params(), params_independent=independent) return namedtuple("TaskFuncionInstrospection", outputs.keys())(**outputs) def _resolve_inputs(self, task_inputs: dict, paramdict: dict) -> dict: From eb0d1287e3c423c602ac3f1ad684a3b1c013a61f Mon Sep 17 00:00:00 2001 From: "Kevin A. Tactac" Date: Wed, 12 Jun 2024 10:24:28 -0400 Subject: [PATCH 4/8] local tests pass --- src/imars3d/backend/dataio/data.py | 17 ++++++++++++----- tests/unit/backend/dataio/test_data.py | 3 ++- tests/unit/backend/diagnostics/test_tilt.py | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/imars3d/backend/dataio/data.py b/src/imars3d/backend/dataio/data.py index 4bff10f2..d3d4bc21 100644 --- a/src/imars3d/backend/dataio/data.py +++ b/src/imars3d/backend/dataio/data.py @@ -59,14 +59,21 @@ class Foldernames(param.Foldername): * any of the paths searched by resolve_dir_path() (if search_paths is None). """ + def _validate(self, val): + + if isinstance(val, (list, tuple)): + for v in val: + super()._validate(v) + else: + super()._validate(val) + def _resolve(self, paths): - if isinstance(paths, (str, Path)): - return super()._resolve(paths) - elif isinstance(paths, (list, tuple)): + + if isinstance(paths, (list, tuple)): return [self._resolve(path) for path in paths] else: - name = next(x for x in [self.name, self.label, "Foldernames parameter"] if x) - raise ValueError(f"{name} must be a string or a list of strings") + return super()._resolve(paths) + class load_data(param.ParameterizedFunction): diff --git a/tests/unit/backend/dataio/test_data.py b/tests/unit/backend/dataio/test_data.py index 82cb87b0..efbe04fb 100644 --- a/tests/unit/backend/dataio/test_data.py +++ b/tests/unit/backend/dataio/test_data.py @@ -69,7 +69,8 @@ class TestFoldernames(param.Parameterized): # test wrong input with pytest.raises(ValueError) as e: TestFoldernames(f=open(tmpdir / "temp.txt", "w")) - assert str(e.value) == "f must be a string or a list of strings" + + assert str(e.value) == "Foldernames parameter 'TestFoldernames.f' only take str or pathlib.Path types" # test single directory tf = TestFoldernames(f=str(tmpdir)) assert tf.f == str(tmpdir) diff --git a/tests/unit/backend/diagnostics/test_tilt.py b/tests/unit/backend/diagnostics/test_tilt.py index b73b7200..f2f26ca5 100644 --- a/tests/unit/backend/diagnostics/test_tilt.py +++ b/tests/unit/backend/diagnostics/test_tilt.py @@ -285,7 +285,7 @@ def test_apply_tilt_correction(): def test_tilt_correction(): # error_0: incorrect dimension with pytest.raises(ValueError): - tilt_correction(arrays=np.arange(10), tilt=1.0) + tilt_correction(arrays=np.arange(10)) # make synthetic data size = 100 rot_axis_ideal = get_tilted_rot_axis(0, 0) From 3fc065fd56820706c1f2963d29873d5b35d07aef Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 12 Jun 2024 14:28:23 +0000 Subject: [PATCH 5/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/imars3d/backend/dataio/data.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/imars3d/backend/dataio/data.py b/src/imars3d/backend/dataio/data.py index d3d4bc21..ebbdd648 100644 --- a/src/imars3d/backend/dataio/data.py +++ b/src/imars3d/backend/dataio/data.py @@ -75,7 +75,6 @@ def _resolve(self, paths): return super()._resolve(paths) - class load_data(param.ParameterizedFunction): """ Load data with given input. From 9552f2e9af53c7ff6f6b641b742ab3141d642552 Mon Sep 17 00:00:00 2001 From: "Kevin A. Tactac" Date: Thu, 13 Jun 2024 13:38:09 -0400 Subject: [PATCH 6/8] create ~/tmp for rtd build --- .readthedocs.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 6862e41e..443fe21c 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -12,3 +12,7 @@ sphinx: conda: environment: environment.yml + +commands: + pre_build: + - mkdir ~/tmp From c46d21f4ad20e20274802252f85a0df5a68d7466 Mon Sep 17 00:00:00 2001 From: "Kevin A. Tactac" Date: Thu, 13 Jun 2024 13:43:40 -0400 Subject: [PATCH 7/8] fix job config --- .readthedocs.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 443fe21c..e303aa84 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -4,6 +4,9 @@ build: os: ubuntu-20.04 tools: python: "mambaforge-4.10" + jobs: + pre_build: + - mkdir ~/tmp sphinx: builder: html @@ -12,7 +15,3 @@ sphinx: conda: environment: environment.yml - -commands: - pre_build: - - mkdir ~/tmp From 95735ce5b7c638214396163b27b7e1b854f36b05 Mon Sep 17 00:00:00 2001 From: "Kevin A. Tactac" Date: Thu, 13 Jun 2024 15:49:29 -0400 Subject: [PATCH 8/8] upgrade param version in conda recipe --- conda.recipe/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 0caf1506..98175aec 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -40,8 +40,8 @@ requirements: - dxchange - olefile - pooch - - panel<1.3 - - param<2 + - panel + - param - pyvista - holoviews - bokeh