diff --git a/.github/workflows/black-ruff.yml b/.github/workflows/black-ruff.yml index 9a04743..fae3f72 100644 --- a/.github/workflows/black-ruff.yml +++ b/.github/workflows/black-ruff.yml @@ -4,7 +4,7 @@ jobs: black-format-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: psf/black@stable with: options: "--diff --check" @@ -12,5 +12,5 @@ jobs: ruff-format-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: chartboost/ruff-action@v1 diff --git a/.github/workflows/check-urls.yml b/.github/workflows/check-urls.yml index b348ab2..ea8fa79 100644 --- a/.github/workflows/check-urls.yml +++ b/.github/workflows/check-urls.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: urls-checker-code uses: urlstechie/urlchecker-action@main diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index 0c30a71..964dced 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -4,7 +4,7 @@ jobs: clang-format-checking: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: RafikFarhad/clang-format-github-action@v3 with: sources: "src/**/*.h,src/**/*.c,test/**/*.c" diff --git a/.github/workflows/cmakelint.yml b/.github/workflows/cmakelint.yml index 36265e9..07f2ad6 100644 --- a/.github/workflows/cmakelint.yml +++ b/.github/workflows/cmakelint.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Format CMake files id: cmake-format diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 8f05f7a..f24abd3 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -17,11 +17,11 @@ jobs: os: [ubuntu-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.12' - uses: tlylt/install-graphviz@v1 @@ -35,7 +35,7 @@ jobs: run: python -m pip install -r requirements-dev.txt - name: Cache pip - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }} @@ -86,6 +86,6 @@ jobs: exit 1 fi - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: ./dist/html/** diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index c0a5259..0632a5c 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -4,10 +4,10 @@ jobs: mypy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.12' - name: Install mypy run: pip install mypy - name: Run mypy diff --git a/.github/workflows/rstcheck.yml b/.github/workflows/rstcheck.yml index 4a48174..332f359 100644 --- a/.github/workflows/rstcheck.yml +++ b/.github/workflows/rstcheck.yml @@ -11,12 +11,12 @@ jobs: os: [ubuntu-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Used to host cibuildwheel - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.12' - name: Install requirements run: python -m pip install -r requirements.txt diff --git a/.github/workflows/wheels-linux.yml b/.github/workflows/wheels-linux.yml index f16510c..95d1402 100644 --- a/.github/workflows/wheels-linux.yml +++ b/.github/workflows/wheels-linux.yml @@ -25,12 +25,12 @@ jobs: os: [ubuntu-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Used to host cibuildwheel - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.12' - name: Install cibuildwheel run: python -m pip install cibuildwheel @@ -41,6 +41,6 @@ jobs: - name: Build wheels run: python -m cibuildwheel --output-dir wheelhouse - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl diff --git a/.github/workflows/wheels-mac.yml b/.github/workflows/wheels-mac.yml index 5c06eb0..dbb0dbd 100644 --- a/.github/workflows/wheels-mac.yml +++ b/.github/workflows/wheels-mac.yml @@ -21,12 +21,12 @@ jobs: os: [macOS-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Used to host cibuildwheel - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.12' - name: Install cibuildwheel run: python -m pip install cibuildwheel @@ -37,6 +37,6 @@ jobs: - name: Build wheels run: python -m cibuildwheel --output-dir wheelhouse - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl diff --git a/.github/workflows/wheels-windows.yml b/.github/workflows/wheels-windows.yml index d0dd75a..2c29360 100644 --- a/.github/workflows/wheels-windows.yml +++ b/.github/workflows/wheels-windows.yml @@ -20,12 +20,12 @@ jobs: os: [windows-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Used to host cibuildwheel - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.12' - name: Install cibuildwheel run: python -m pip install cibuildwheel @@ -36,6 +36,6 @@ jobs: - name: Build wheels run: python -m cibuildwheel - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: path: ./wheelhouse/*.whl diff --git a/_unittests/ut_mlmodel/test_kmeans_sklearn.py b/_unittests/ut_mlmodel/test_kmeans_sklearn.py index 974b024..253c828 100644 --- a/_unittests/ut_mlmodel/test_kmeans_sklearn.py +++ b/_unittests/ut_mlmodel/test_kmeans_sklearn.py @@ -5,7 +5,6 @@ assert_array_equal, assert_array_almost_equal, assert_almost_equal, - assert_raise_message, ) from sklearn.metrics.cluster import v_measure_score from sklearn.datasets import make_blobs @@ -112,12 +111,12 @@ def _check_fitted_model(self, km): self.assertGreater(km.inertia_, 0.0) # check error on dataset being too small - assert_raise_message( - ValueError, - "n_samples=1 should be >= n_clusters=%d" % km.n_clusters, - km.fit, - [[0.0, 1.0]], - ) + try: + km.fit([[0.0, 1.0]]) + except Exception as e: + self.assertIn( + f"n_samples=1 should be >= n_clusters={km.n_clusters}", str(e) + ) @ignore_warnings(UserWarning) def test_k_means_new_centers(self): diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3e54602..96c05e7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,4 +1,5 @@ jobs: + - job: 'TestLinuxWheelNoCuda' pool: vmImage: 'ubuntu-latest' diff --git a/pyproject.toml b/pyproject.toml index abe94ef..c6d950a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,9 +14,10 @@ classifiers = [ "Operating System :: Unix", "Operating System :: MacOS", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] dependencies = ["numpy", "onnx>=1.14.0", "scipy"] description = "Extends the list of supported operators in onnx reference implementation and onnxruntime, or implements faster versions in C++." @@ -24,7 +25,7 @@ keywords = ["onnx", "cython", "scikit-learn", "machine-learning"] license = {file = "LICENSE.txt"} name = "mlinsights" readme = "README.rst" -requires-python = ">=3.9" +requires-python = ">=3.10" version = "0.5.1" [project.urls] @@ -108,7 +109,7 @@ manylinux-x86_64-image = "manylinux2014" [tool.cibuildwheel.linux] archs = ["x86_64"] build = "cp*" -skip = "cp36-* cp37-* cp38-* cp39-* cp313-* cp314-* pypy* *musllinux*" +skip = "cp36-* cp37-* cp38-* cp39-* cp313-* cp314-* cp315-* pypy* *musllinux*" manylinux-x86_64-image = "manylinux2014" before-build = "pip install auditwheel-symbols abi3audit" build-verbosity = 1 @@ -116,15 +117,23 @@ repair-wheel-command = "auditwheel-symbols --manylinux 2014 {wheel} ; abi3audit # repair-wheel-command = "auditwheel-symbols --manylinux 2014 {wheel} || exit 0" [tool.cibuildwheel.macos] -archs = ["arm64", "universal2"] +archs = "arm64" # or "universal2" for a single universal wheel +environment = """ + MACOSX_DEPLOYMENT_TARGET=14.0 + LDFLAGS='-L$(brew --prefix libomp)/lib' + CPPFLAGS='-I$(brew --prefix libomp)/include' + CFLAGS='-I$(brew --prefix libomp)/include -arch x86_64 -arch arm64' + CXXFLAGS='-I$(brew --prefix libomp)/include -arch x86_64 -arch arm64' + DYLD_LIBRARY_PATH='$(brew --prefix libomp)/lib:$DYLD_LIBRARY_PATH' +""" build = "cp*" -skip = "cp36-* cp37-* cp38-* cp39-* cp313-* cp314-* pypy* pp*" +skip = "cp36-* cp37-* cp38-* cp39-* cp313-* cp314-* cp315-* pypy* pp*" before-build = "brew install libomp llvm&&echo 'export PATH=\"/opt/homebrew/opt/llvm/bin:$PATH\"' >> /Users/runner/.bash_profile" [tool.cibuildwheel.windows] archs = ["AMD64"] build = "cp*" -skip = "cp36-* cp37-* cp38-* cp39-* cp313-* cp314-* pypy*" +skip = "cp36-* cp37-* cp38-* cp39-* cp313-* cp314-* cp315-* pypy*" [tool.cython-lint] max-line-length = 88 diff --git a/setup.py b/setup.py index 983267e..272abff 100644 --- a/setup.py +++ b/setup.py @@ -265,8 +265,8 @@ def initialize_options(self): self._parent.initialize_options(self) # boolean - b_values = {0, 1, "1", "0", True, False} - t_values = {1, "1", True} + b_values = {0, 1, "1", "0", True, False} # noqa: B033 + t_values = {1, "1", True} # noqa: B033 for att in ["use_nvtx", "use_cuda", "manylinux"]: v = getattr(self, att) if v is not None: @@ -295,7 +295,7 @@ def initialize_options(self): def finalize_options(self): self._parent.finalize_options(self) - b_values = {0, 1, "1", "0", True, False, "True", "False"} + b_values = {0, 1, "1", "0", True, False, "True", "False"} # noqa: B033 if self.use_nvtx not in b_values: raise ValueError(f"use_nvtx={self.use_nvtx!r} must be in {b_values}.") if self.use_cuda is None: @@ -303,9 +303,9 @@ def finalize_options(self): if self.use_cuda not in b_values: raise ValueError(f"use_cuda={self.use_cuda!r} must be in {b_values}.") - self.use_nvtx = self.use_nvtx in {1, "1", True, "True"} - self.use_cuda = self.use_cuda in {1, "1", True, "True"} - self.manylinux = self.manylinux in {1, "1", True, "True"} + self.use_nvtx = self.use_nvtx in {1, "1", True, "True"} # noqa: B033 + self.use_cuda = self.use_cuda in {1, "1", True, "True"} # noqa: B033 + self.manylinux = self.manylinux in {1, "1", True, "True"} # noqa: B033 if self.cuda_version in (None, ""): self.cuda_version = None @@ -599,7 +599,7 @@ def get_ext_modules(): add_cuda = False elif "--use-cuda=0" in sys.argv: add_cuda = False - elif os.environ.get("USE_CUDA", None) in {0, "0", False}: + elif os.environ.get("USE_CUDA", None) in {0, "0", False}: # noqa: B033 add_cuda = False if add_cuda: cuda_extensions.extend([])