diff --git a/build.sh b/build.sh index 9a3b697e1..9d6bfa7fd 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-2024, NVIDIA CORPORATION. # wholegraph build script @@ -49,7 +49,7 @@ HELP="$0 [ ...] [ ...] and is: -v - verbose build mode -g - build for debug - -n - no install step + -n - no install step (does not affect Python) --allgpuarch - build for all supported GPU architectures --cmake-args=\\\"\\\" - add arbitrary CMake arguments to any cmake call --compile-cmd - only output compile commands (invoke CMake without build) @@ -271,19 +271,12 @@ if buildAll || hasArg pylibwholegraph; then if ! hasArg --compile-cmd; then cd ${REPODIR}/python/pylibwholegraph env LIBWHOLEGRAPH_DIR=${LIBWHOLEGRAPH_DIR} \ - ${PYTHON} setup.py build_ext --inplace \ - --build-type=${BUILD_TYPE} \ - ${EXTRA_CMAKE_ARGS} - if ! hasArg -n; then - env LIBWHOLEGRAPH_DIR=${LIBWHOLEGRAPH_DIR} \ - ${PYTHON} setup.py install \ - --build-type=${BUILD_TYPE} \ - ${EXTRA_CMAKE_ARGS} - fi + SKBUILD_CMAKE_ARGS="-DCMAKE_BUILD_TYPE=${BUILD_TYPE};${EXTRA_CMAKE_ARGS/ /;}" ${PYTHON} -m pip install --no-build-isolation --no-deps . + else - # just invoke cmake without going through scikit-build + # just invoke cmake without going through scikit-build-core env LIBWHOLEGRAPH_DIR=${LIBWHOLEGRAPH_DIR} \ - cmake -S ${REPODIR}/python/pylibwholegraph -B ${REPODIR}/python/pylibwholegraph/_skbuild/build \ + cmake -S ${REPODIR}/python/pylibwholegraph -B ${REPODIR}/python/pylibwholegraph/build \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ ${EXTRA_CMAKE_ARGS} fi diff --git a/ci/build_wheel.sh b/ci/build_wheel.sh index dd7ce7737..1f7e5580a 100755 --- a/ci/build_wheel.sh +++ b/ci/build_wheel.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2023, NVIDIA CORPORATION. +# Copyright (c) 2023-2024, NVIDIA CORPORATION. set -euo pipefail @@ -38,7 +38,7 @@ fi cd "${package_dir}" # Hardcode the output dir -SKBUILD_CONFIGURE_OPTIONS="-DDETECT_CONDA_ENV=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE -DCUDA_STATIC_RUNTIME=ON -DWHOLEGRAPH_BUILD_WHEELS=ON" \ +SKBUILD_CMAKE_ARGS="-DDETECT_CONDA_ENV=OFF;-DBUILD_SHARED_LIBS=OFF;-DCMAKE_MESSAGE_LOG_LEVEL=VERBOSE;-DCUDA_STATIC_RUNTIME=ON;-DWHOLEGRAPH_BUILD_WHEELS=ON" \ python -m pip wheel . -w dist -vvv --no-deps --disable-pip-version-check mkdir -p final_dist diff --git a/conda/environments/all_cuda-118_arch-x86_64.yaml b/conda/environments/all_cuda-118_arch-x86_64.yaml index c0fa7bbfe..45fc02021 100644 --- a/conda/environments/all_cuda-118_arch-x86_64.yaml +++ b/conda/environments/all_cuda-118_arch-x86_64.yaml @@ -42,7 +42,7 @@ dependencies: - pytorch-cuda=11.8 - pytorch=2.0.0 - recommonmark -- scikit-build +- scikit-build-core>=0.7.0 - sphinx-copybutton - sphinx-markdown-tables - sphinx<6 diff --git a/conda/environments/all_cuda-122_arch-x86_64.yaml b/conda/environments/all_cuda-122_arch-x86_64.yaml index 134d72146..dd33e60c1 100644 --- a/conda/environments/all_cuda-122_arch-x86_64.yaml +++ b/conda/environments/all_cuda-122_arch-x86_64.yaml @@ -40,7 +40,7 @@ dependencies: - pytest-xdist - python>=3.9,<3.12 - recommonmark -- scikit-build +- scikit-build-core>=0.7.0 - sphinx-copybutton - sphinx-markdown-tables - sphinx<6 diff --git a/conda/recipes/pylibwholegraph/conda_build_config.yaml b/conda/recipes/pylibwholegraph/conda_build_config.yaml index 6ae8a2422..d45aacc92 100644 --- a/conda/recipes/pylibwholegraph/conda_build_config.yaml +++ b/conda/recipes/pylibwholegraph/conda_build_config.yaml @@ -13,8 +13,8 @@ cuda11_compiler: cmake_version: - ">=3.26.4" -scikit_build_version: - - ">=0.13.1" +scikit_build_core_version: + - ">=0.7.0" sysroot_version: - "2.17" diff --git a/conda/recipes/pylibwholegraph/meta.yaml b/conda/recipes/pylibwholegraph/meta.yaml index c67f8e131..1caa9573f 100644 --- a/conda/recipes/pylibwholegraph/meta.yaml +++ b/conda/recipes/pylibwholegraph/meta.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. {% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') + environ.get('VERSION_SUFFIX', '') %} {% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %} @@ -63,7 +63,7 @@ requirements: - cython - libwholegraph ={{ version }} - python - - scikit-build {{ scikit_build_version }} + - scikit-build-core {{ scikit_build_core_version }} run: - {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }} {% if cuda_major == "11" %} diff --git a/dependencies.yaml b/dependencies.yaml index c76671a87..d20ccf9bc 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -78,7 +78,7 @@ dependencies: - librmm==24.6.* - nanobind>=0.2.0 - nccl - - scikit-build + - scikit-build-core>=0.7.0 specific: - output_types: conda matrices: @@ -322,6 +322,4 @@ dependencies: - cmake>=3.26.4 - cython>=3.0.0 - ninja - - setuptools - - scikit-build>=0.13.1 - - wheel + - scikit-build-core[pyproject]>=0.7.0 diff --git a/python/pylibwholegraph/CMakeLists.txt b/python/pylibwholegraph/CMakeLists.txt index 6fc6f134f..d22e3d51c 100644 --- a/python/pylibwholegraph/CMakeLists.txt +++ b/python/pylibwholegraph/CMakeLists.txt @@ -33,7 +33,7 @@ include(rapids-cpm) rapids_cuda_init_architectures(PYLIBWHOLEGRAPH) -project(PYLIBWHOLEGRAPH VERSION ${WHOLEGRAPH_VERSION} LANGUAGES C CXX CUDA) +project(PYLIBWHOLEGRAPH VERSION ${WHOLEGRAPH_VERSION} LANGUAGES CXX CUDA) ############################################################################## # - User Options ------------------------------------------------------------ @@ -132,7 +132,7 @@ execute_process( ) list(APPEND CMAKE_MODULE_PATH "${SKBUILD_CMAKE_MODULE_PATH}") -include(rapids-cython) +include(rapids-cython-core) rapids_cython_init() ############################################################################## diff --git a/python/pylibwholegraph/pyproject.toml b/python/pylibwholegraph/pyproject.toml index 910d4ccea..3f061998d 100644 --- a/python/pylibwholegraph/pyproject.toml +++ b/python/pylibwholegraph/pyproject.toml @@ -13,13 +13,12 @@ # limitations under the License. [build-system] +build-backend = "scikit_build_core.build" requires = [ "cmake>=3.26.4", "cython>=3.0.0", "ninja", - "scikit-build>=0.13.1", - "setuptools", - "wheel", + "scikit-build-core[pyproject]>=0.7.0", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. [project] @@ -43,8 +42,16 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] -[tool.setuptools] -license-files = ["LICENSE"] +[tool.scikit-build] +build-dir = "build/{wheel_tag}" +cmake.build-type = "Release" +cmake.minimum-version = "3.26.4" +ninja.make-fallback = true +sdist.exclude = ["*tests*"] +sdist.reproducible = true +wheel.packages = ["pylibwholegraph"] -[tool.setuptools.dynamic] -version = {file = "pylibwholegraph/VERSION"} +[tool.scikit-build.metadata.version] +provider = "scikit_build_core.metadata.regex" +input = "pylibwholegraph/VERSION" +regex = "(?P.*)" diff --git a/python/pylibwholegraph/setup.py b/python/pylibwholegraph/setup.py deleted file mode 100644 index 0a1f3fa42..000000000 --- a/python/pylibwholegraph/setup.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. -# 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. - -import os - -from setuptools import find_packages, Command -from skbuild import setup - - -class CleanCommand(Command): - """Custom clean command to tidy up the project root.""" - - user_options = [ - ("all", None, None), - ] - - def initialize_options(self): - self.all = None - - def finalize_options(self): - pass - - def run(self): - setupFileDir = os.path.dirname(os.path.abspath(__file__)) - os.chdir(setupFileDir) - os.system("rm -rf build") - os.system("rm -rf _skbuild") - os.system("rm -rf dist") - os.system('find . -name "__pycache__" -type d -exec rm -rf {} +') - os.system("rm -rf *.egg-info") - os.system('find . -name "*.cpython*.so" -type f -delete') - - -cmdclass = dict() -cmdclass["clean"] = CleanCommand - - -setup( - packages=find_packages( - include=[ - "pylibwholegraph", - "pylibwholegraph.*", - ] - ), - package_data={ - "pylibwholegraph": ["VERSION", "torch_cpp_ext/*.cpp", - "torch_cpp_ext/*.h"], - }, - include_package_data=True, - cmdclass=cmdclass, - zip_safe=False, -)