From 4e9c7404e4cd5420e654f27b3a32b9d49b2f7edc Mon Sep 17 00:00:00 2001 From: Louis Gombert Date: Fri, 3 Jan 2025 13:00:41 +0100 Subject: [PATCH 1/5] Move requirements to pyproject.toml, make instructions use the script as a Python module --- README.md | 12 +++++++----- pyproject.toml | 11 ++++++----- requirements.txt | 3 --- 3 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 requirements.txt diff --git a/README.md b/README.md index b947f9c..794247d 100644 --- a/README.md +++ b/README.md @@ -6,17 +6,18 @@ This Python script allows conversion of [OpenRadioss](https://openradioss.org/) ## Usage -Requires Python 3.10+ +This module requires Python 3.10+. First, create a virtualenv and activate it. ```bash python -m venv .venv source .venv/bin/activate ``` -Run the script: +Install the Python module, and run the script to convert files from the OpenRadioss format to VTKHDF. + ```bash -pip install -r requirements.txt -python src/animtovtkhdf.py [-h] [-q] [-n] [infiles ...] outfile +python -m pip install -e . +python -m animtovtkhdf [-h] [-q] [-n] [infiles ...] outfile ``` Positional arguments: @@ -31,7 +32,8 @@ Options: ## Development -Install in dev mode and run the module tests, that require an recent VTK package (use 9.4 when available), to get PartitionedDatasetCollection support in the VTKHDFReader: +Install in dev mode and run the module tests. + ```bash pip install -e '.[dev]' python -m pytest testing/ diff --git a/pyproject.toml b/pyproject.toml index 8a887db..d0d0bfd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,13 +9,14 @@ name = "animtovtkhdf" version = "0.1" requires-python=">=3.10" license = {file = "LICENSE"} -dynamic = ["dependencies","readme"] +readme = "README.md" +dependencies = [ + "h5py==3.10.0", + "numpy==1.26.4", + "vtk==9.4.0" +] [project.optional-dependencies] dev = [ "pytest" ] - -[tool.setuptools.dynamic] -dependencies = {file = ["requirements.txt"]} -readme = {file = ["README.md"]} diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index eebbbf4..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -h5py==3.10.0 -numpy==1.26.4 -vtk==9.4.0 -- GitLab From 8e9b004050ad5abd541774acf554452fc600b3c7 Mon Sep 17 00:00:00 2001 From: Louis Gombert Date: Fri, 3 Jan 2025 13:11:56 +0100 Subject: [PATCH 2/5] Create build & test CI --- .gitlab-ci.yml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 4 ++-- 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..882cce5 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,56 @@ +workflow: + rules: + - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == "main" + when: always + - if: $CI_MERGE_REQUEST_ID + when: always + - when: never + +stages: + - build + - test + +image: python:3.11 + + +variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + GIT_CLEAN_FLAGS: -ffdx -e .venv/ .cache/ + +cache: + key: pip-and-npm-cache + paths: + - $CI_PROJECT_DIR/.cache/pip + +build_openradioss_to_vtkhdf: + stage: build + before_script: + - python3 -m venv .venv + - source .venv/bin/activate + script: + - pip install -e . + interruptible: true + tags: + - docker + - linux-x86_64 + artifacts: + paths: + - .venv + expire_in: 1 day + + +test_openradioss_to_vtkhdf: + stage: test + before_script: + - source .venv/bin/activate + - pip install -e '.[dev]' + script: + - python3 -m pytest tests + interruptible: true + dependencies: + - build_openradioss_to_vtkhdf + needs: + - build_openradioss_to_vtkhdf + tags: + - docker + - linux-x86_64 diff --git a/pyproject.toml b/pyproject.toml index d0d0bfd..4709bb9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,10 +13,10 @@ readme = "README.md" dependencies = [ "h5py==3.10.0", "numpy==1.26.4", - "vtk==9.4.0" ] [project.optional-dependencies] dev = [ - "pytest" + "pytest==8.3.3", + "vtk==9.4.0" ] -- GitLab From 89e7362750b4a893e1a2e323f22dd9e00530b920 Mon Sep 17 00:00:00 2001 From: Louis Gombert Date: Tue, 14 Jan 2025 17:24:40 +0100 Subject: [PATCH 3/5] CI: Add 'vtkhdf' and 'build' tags --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 882cce5..a41d459 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,6 +33,8 @@ build_openradioss_to_vtkhdf: tags: - docker - linux-x86_64 + - vtkhdf + - build artifacts: paths: - .venv @@ -54,3 +56,5 @@ test_openradioss_to_vtkhdf: tags: - docker - linux-x86_64 + - build + - vtkhdf -- GitLab From bccf73f0a332ae05c20904654ee5df394aab844b Mon Sep 17 00:00:00 2001 From: Louis Gombert Date: Wed, 15 Jan 2025 14:50:54 +0100 Subject: [PATCH 4/5] Fix test directory name --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a41d459..299c277 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,7 +47,7 @@ test_openradioss_to_vtkhdf: - source .venv/bin/activate - pip install -e '.[dev]' script: - - python3 -m pytest tests + - python3 -m pytest testing interruptible: true dependencies: - build_openradioss_to_vtkhdf -- GitLab From 9737a04b3e07b2a38cdfdfd7fc36466fecce1622 Mon Sep 17 00:00:00 2001 From: Louis Gombert Date: Wed, 15 Jan 2025 15:08:20 +0100 Subject: [PATCH 5/5] Update VTK to 9.4.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4709bb9..5f443c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,5 +18,5 @@ dependencies = [ [project.optional-dependencies] dev = [ "pytest==8.3.3", - "vtk==9.4.0" + "vtk==9.4.1" ] -- GitLab