From 768614507ca5bf61e846873b4d927ee1909e4ba0 Mon Sep 17 00:00:00 2001 From: "Faust, Ian" Date: Wed, 1 Jan 2025 23:46:02 +0100 Subject: [PATCH 01/10] move functionality to separate yamls --- .ci/pipeline/ci.yml | 44 +++---------------------------- .ci/pipeline/conda-recipe-lnx.yml | 29 ++++++++++++++++++++ .ci/pipeline/conda-recipe-win.yml | 30 +++++++++++++++++++++ .ci/pipeline/linting.yml | 30 +++++++++++++++++++++ 4 files changed, 92 insertions(+), 41 deletions(-) create mode 100644 .ci/pipeline/conda-recipe-lnx.yml create mode 100644 .ci/pipeline/conda-recipe-win.yml create mode 100644 .ci/pipeline/linting.yml diff --git a/.ci/pipeline/ci.yml b/.ci/pipeline/ci.yml index 2472054108..3e761c79bc 100644 --- a/.ci/pipeline/ci.yml +++ b/.ci/pipeline/ci.yml @@ -48,20 +48,7 @@ jobs: pool: vmImage: 'ubuntu-22.04' steps: - - script: | - echo "##vso[task.setvariable variable=ISORT_VERSION]$(grep -zoP '(?<=isort\n rev: ).*' .pre-commit-config.yaml)" - echo "##vso[task.setvariable variable=BLACK_VERSION]$(grep -zoP '(?<=black\n rev: ).*' .pre-commit-config.yaml)" - echo "##vso[task.setvariable variable=PYTHON_LINT_VERSION]$(grep -oP -m 1 '(?<=python).*' .pre-commit-config.yaml)" - displayName: 'Collect lint versions' - - task: UsePythonVersion@0 - inputs: - versionSpec: $(PYTHON_LINT_VERSION) - addToPath: true - - script: | - python -m pip install --upgrade pip setuptools - pip install isort==${ISORT_VERSION} black[jupyter]==${BLACK_VERSION} - isort --profile black --check . && black --check . - displayName: 'Linting' + - template: linting.yml - job: LinuxCondaRecipe dependsOn: Lint timeoutInMinutes: 120 @@ -73,19 +60,7 @@ jobs: pool: vmImage: 'ubuntu-22.04' steps: - - script: | - conda config --add channels conda-forge - conda config --set channel_priority strict - conda update -y -q --all - displayName: "Conda update" - - script: | - conda create -y -q -n build-env conda-build conda-verify - displayName: "Conda create" - - script: | - . /usr/share/miniconda/etc/profile.d/conda.sh - conda activate build-env - conda build . --python $(PYTHON_VERSION) --numpy $(NUMPY_VERSION) - displayName: "Conda build and test" + - template: conda-recipe-lnx.yml - job: WindowsCondaRecipe dependsOn: Lint timeoutInMinutes: 120 @@ -97,20 +72,7 @@ jobs: pool: vmImage: 'windows-2022' steps: - - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" - displayName: Add conda to PATH - - script: | - conda config --add channels conda-forge - conda config --set channel_priority strict - conda update -y -q --all - displayName: "Conda update" - - script: | - conda create -y -q -n build-env conda-build conda-verify - displayName: "Conda create" - - script: | - call activate build-env - conda build . --python $(PYTHON_VERSION) --numpy $(NUMPY_VERSION) - displayName: "Conda build and test" + - template: conda-recipe-win.yml - job: LinuxCondaEnv dependsOn: Lint timeoutInMinutes: 120 diff --git a/.ci/pipeline/conda-recipe-lnx.yml b/.ci/pipeline/conda-recipe-lnx.yml new file mode 100644 index 0000000000..cfce73898d --- /dev/null +++ b/.ci/pipeline/conda-recipe-lnx.yml @@ -0,0 +1,29 @@ +#=============================================================================== +# Copyright contributors to the oneDAL project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#=============================================================================== +steps: + - script: | + conda config --add channels conda-forge + conda config --set channel_priority strict + conda update -y -q --all + displayName: "Conda update" + - script: | + conda create -y -q -n build-env conda-build conda-verify + displayName: "Conda create" + - script: | + . /usr/share/miniconda/etc/profile.d/conda.sh + conda activate build-env + conda build . --python $(PYTHON_VERSION) --numpy $(NUMPY_VERSION) + displayName: "Conda build and test" \ No newline at end of file diff --git a/.ci/pipeline/conda-recipe-win.yml b/.ci/pipeline/conda-recipe-win.yml new file mode 100644 index 0000000000..0e1f826c97 --- /dev/null +++ b/.ci/pipeline/conda-recipe-win.yml @@ -0,0 +1,30 @@ +#=============================================================================== +# Copyright contributors to the oneDAL project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#=============================================================================== +steps: + - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" + displayName: Add conda to PATH + - script: | + conda config --add channels conda-forge + conda config --set channel_priority strict + conda update -y -q --all + displayName: "Conda update" + - script: | + conda create -y -q -n build-env conda-build conda-verify + displayName: "Conda create" + - script: | + call activate build-env + conda build . --python $(PYTHON_VERSION) --numpy $(NUMPY_VERSION) + displayName: "Conda build and test" \ No newline at end of file diff --git a/.ci/pipeline/linting.yml b/.ci/pipeline/linting.yml new file mode 100644 index 0000000000..dbb5ba5262 --- /dev/null +++ b/.ci/pipeline/linting.yml @@ -0,0 +1,30 @@ +#=============================================================================== +# Copyright contributors to the oneDAL project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#=============================================================================== +steps: + - script: | + echo "##vso[task.setvariable variable=ISORT_VERSION]$(grep -zoP '(?<=isort\n rev: ).*' .pre-commit-config.yaml)" + echo "##vso[task.setvariable variable=BLACK_VERSION]$(grep -zoP '(?<=black\n rev: ).*' .pre-commit-config.yaml)" + echo "##vso[task.setvariable variable=PYTHON_LINT_VERSION]$(grep -oP -m 1 '(?<=python).*' .pre-commit-config.yaml)" + displayName: 'Collect lint versions' + - task: UsePythonVersion@0 + inputs: + versionSpec: $(PYTHON_LINT_VERSION) + addToPath: true + - script: | + python -m pip install --upgrade pip setuptools + pip install isort==${ISORT_VERSION} black[jupyter]==${BLACK_VERSION} + isort --profile black --check . && black --check . + displayName: 'Linting' \ No newline at end of file From 6b3dae576014971e2066d3c6a08f0b673bdd9949 Mon Sep 17 00:00:00 2001 From: "Faust, Ian" Date: Wed, 1 Jan 2025 23:47:12 +0100 Subject: [PATCH 02/10] add endlines --- .ci/pipeline/conda-recipe-lnx.yml | 2 +- .ci/pipeline/conda-recipe-win.yml | 2 +- .ci/pipeline/linting.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/pipeline/conda-recipe-lnx.yml b/.ci/pipeline/conda-recipe-lnx.yml index cfce73898d..e272f4439f 100644 --- a/.ci/pipeline/conda-recipe-lnx.yml +++ b/.ci/pipeline/conda-recipe-lnx.yml @@ -26,4 +26,4 @@ steps: . /usr/share/miniconda/etc/profile.d/conda.sh conda activate build-env conda build . --python $(PYTHON_VERSION) --numpy $(NUMPY_VERSION) - displayName: "Conda build and test" \ No newline at end of file + displayName: "Conda build and test" diff --git a/.ci/pipeline/conda-recipe-win.yml b/.ci/pipeline/conda-recipe-win.yml index 0e1f826c97..6abeaa4309 100644 --- a/.ci/pipeline/conda-recipe-win.yml +++ b/.ci/pipeline/conda-recipe-win.yml @@ -27,4 +27,4 @@ steps: - script: | call activate build-env conda build . --python $(PYTHON_VERSION) --numpy $(NUMPY_VERSION) - displayName: "Conda build and test" \ No newline at end of file + displayName: "Conda build and test" diff --git a/.ci/pipeline/linting.yml b/.ci/pipeline/linting.yml index dbb5ba5262..712f71291a 100644 --- a/.ci/pipeline/linting.yml +++ b/.ci/pipeline/linting.yml @@ -27,4 +27,4 @@ steps: python -m pip install --upgrade pip setuptools pip install isort==${ISORT_VERSION} black[jupyter]==${BLACK_VERSION} isort --profile black --check . && black --check . - displayName: 'Linting' \ No newline at end of file + displayName: 'Linting' From 2c6a4178ba0ce1987b6d0b702742965f915ce40d Mon Sep 17 00:00:00 2001 From: Ian Faust Date: Thu, 2 Jan 2025 15:00:56 +0100 Subject: [PATCH 03/10] Update linting.yml --- .ci/pipeline/linting.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.ci/pipeline/linting.yml b/.ci/pipeline/linting.yml index 712f71291a..456e0abef0 100644 --- a/.ci/pipeline/linting.yml +++ b/.ci/pipeline/linting.yml @@ -15,16 +15,7 @@ #=============================================================================== steps: - script: | - echo "##vso[task.setvariable variable=ISORT_VERSION]$(grep -zoP '(?<=isort\n rev: ).*' .pre-commit-config.yaml)" - echo "##vso[task.setvariable variable=BLACK_VERSION]$(grep -zoP '(?<=black\n rev: ).*' .pre-commit-config.yaml)" - echo "##vso[task.setvariable variable=PYTHON_LINT_VERSION]$(grep -oP -m 1 '(?<=python).*' .pre-commit-config.yaml)" - displayName: 'Collect lint versions' - - task: UsePythonVersion@0 - inputs: - versionSpec: $(PYTHON_LINT_VERSION) - addToPath: true - - script: | - python -m pip install --upgrade pip setuptools - pip install isort==${ISORT_VERSION} black[jupyter]==${BLACK_VERSION} - isort --profile black --check . && black --check . + python -m pip install --upgrade pip pre-commit + pre-commit install + pre-commit run --all-files displayName: 'Linting' From a227d5ae9f116cd216f8066f43eba4988d841fff Mon Sep 17 00:00:00 2001 From: Ian Faust Date: Thu, 2 Jan 2025 15:27:57 +0100 Subject: [PATCH 04/10] Update _forest.py --- sklearnex/ensemble/_forest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearnex/ensemble/_forest.py b/sklearnex/ensemble/_forest.py index 2a04962645..e716d0e25d 100644 --- a/sklearnex/ensemble/_forest.py +++ b/sklearnex/ensemble/_forest.py @@ -18,8 +18,8 @@ import warnings from abc import ABC -import numpy as np from scipy import sparse as sp +import numpy as np from sklearn.base import BaseEstimator, clone from sklearn.ensemble import ExtraTreesClassifier as _sklearn_ExtraTreesClassifier from sklearn.ensemble import ExtraTreesRegressor as _sklearn_ExtraTreesRegressor From 59b2c9b43c3cb14186970242a353a0232717930e Mon Sep 17 00:00:00 2001 From: "Faust, Ian" Date: Thu, 2 Jan 2025 15:31:46 +0100 Subject: [PATCH 05/10] Revert "Update _forest.py" This reverts commit a227d5ae9f116cd216f8066f43eba4988d841fff. --- sklearnex/ensemble/_forest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearnex/ensemble/_forest.py b/sklearnex/ensemble/_forest.py index e716d0e25d..2a04962645 100644 --- a/sklearnex/ensemble/_forest.py +++ b/sklearnex/ensemble/_forest.py @@ -18,8 +18,8 @@ import warnings from abc import ABC -from scipy import sparse as sp import numpy as np +from scipy import sparse as sp from sklearn.base import BaseEstimator, clone from sklearn.ensemble import ExtraTreesClassifier as _sklearn_ExtraTreesClassifier from sklearn.ensemble import ExtraTreesRegressor as _sklearn_ExtraTreesRegressor From 983afba2793f5271ecd568d57a5975032d21d416 Mon Sep 17 00:00:00 2001 From: Ian Faust Date: Tue, 7 Jan 2025 09:17:59 +0100 Subject: [PATCH 06/10] Update linting.yml --- .ci/pipeline/linting.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/pipeline/linting.yml b/.ci/pipeline/linting.yml index 456e0abef0..e6d8e1cc30 100644 --- a/.ci/pipeline/linting.yml +++ b/.ci/pipeline/linting.yml @@ -15,7 +15,7 @@ #=============================================================================== steps: - script: | - python -m pip install --upgrade pip pre-commit + python -m pip install --upgrade pip pre-commit==4.0.1 pre-commit install - pre-commit run --all-files + pre-commit run displayName: 'Linting' From f1561f30f0de630890aff42abd9519e462f1ee17 Mon Sep 17 00:00:00 2001 From: Ian Faust Date: Tue, 7 Jan 2025 09:19:49 +0100 Subject: [PATCH 07/10] Update linting.yml --- .ci/pipeline/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/pipeline/linting.yml b/.ci/pipeline/linting.yml index e6d8e1cc30..cb0be7eb24 100644 --- a/.ci/pipeline/linting.yml +++ b/.ci/pipeline/linting.yml @@ -17,5 +17,5 @@ steps: - script: | python -m pip install --upgrade pip pre-commit==4.0.1 pre-commit install - pre-commit run + pre-commit run --all-files displayName: 'Linting' From 2ec47cd1475eda6069a31e642fc6e05874b9f60c Mon Sep 17 00:00:00 2001 From: Ian Faust Date: Tue, 7 Jan 2025 09:24:14 +0100 Subject: [PATCH 08/10] Update linting.yml --- .ci/pipeline/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/pipeline/linting.yml b/.ci/pipeline/linting.yml index cb0be7eb24..f303f7f9db 100644 --- a/.ci/pipeline/linting.yml +++ b/.ci/pipeline/linting.yml @@ -17,5 +17,5 @@ steps: - script: | python -m pip install --upgrade pip pre-commit==4.0.1 pre-commit install - pre-commit run --all-files + pre-commit run --all-files --show-diff-on-failure displayName: 'Linting' From 5c3ffb4552e9ebf754ef2ecabc7cc30b1f11d05a Mon Sep 17 00:00:00 2001 From: Ian Faust Date: Tue, 7 Jan 2025 09:24:33 +0100 Subject: [PATCH 09/10] Update _forest.py --- sklearnex/ensemble/_forest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearnex/ensemble/_forest.py b/sklearnex/ensemble/_forest.py index 2a04962645..e716d0e25d 100644 --- a/sklearnex/ensemble/_forest.py +++ b/sklearnex/ensemble/_forest.py @@ -18,8 +18,8 @@ import warnings from abc import ABC -import numpy as np from scipy import sparse as sp +import numpy as np from sklearn.base import BaseEstimator, clone from sklearn.ensemble import ExtraTreesClassifier as _sklearn_ExtraTreesClassifier from sklearn.ensemble import ExtraTreesRegressor as _sklearn_ExtraTreesRegressor From 6b241c91f9d885e04ca6d52d1cadabcfb39a911b Mon Sep 17 00:00:00 2001 From: Ian Faust Date: Tue, 7 Jan 2025 09:26:55 +0100 Subject: [PATCH 10/10] Update _forest.py --- sklearnex/ensemble/_forest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearnex/ensemble/_forest.py b/sklearnex/ensemble/_forest.py index e716d0e25d..2a04962645 100644 --- a/sklearnex/ensemble/_forest.py +++ b/sklearnex/ensemble/_forest.py @@ -18,8 +18,8 @@ import warnings from abc import ABC -from scipy import sparse as sp import numpy as np +from scipy import sparse as sp from sklearn.base import BaseEstimator, clone from sklearn.ensemble import ExtraTreesClassifier as _sklearn_ExtraTreesClassifier from sklearn.ensemble import ExtraTreesRegressor as _sklearn_ExtraTreesRegressor