diff --git a/build.sh b/build.sh index 5cfd2b5af1c..bd716943216 100755 --- a/build.sh +++ b/build.sh @@ -18,7 +18,7 @@ ARGS=$* # script, and that this script resides in the repo dir! REPODIR=$(cd $(dirname $0); pwd) -RAPIDS_VERSION=24.04 +RAPIDS_VERSION="$(sed -E -e 's/^([0-9]{2})\.([0-9]{2})\.([0-9]{2}).*$/\1.\2/' VERSION)" # Valid args to this script (all possible targets and options) - only one per line VALIDARGS=" diff --git a/ci/build_docs.sh b/ci/build_docs.sh index 298a8b68791..8e7cfc2c4b8 100755 --- a/ci/build_docs.sh +++ b/ci/build_docs.sh @@ -39,7 +39,9 @@ rapids-mamba-retry install \ rapids-logger "Install cugraph-dgl" rapids-mamba-retry install "${PYTHON_CHANNEL}/linux-64/cugraph-dgl-*.tar.bz2" -export RAPIDS_VERSION_NUMBER="24.04" +export RAPIDS_VERSION="$(rapids-version)" +export RAPIDS_VERSION_MAJOR_MINOR="$(rapids-version-major-minor)" +export RAPIDS_VERSION_NUMBER="$RAPIDS_VERSION_MAJOR_MINOR" export RAPIDS_DOCS_DIR="$(mktemp -d)" for PROJECT in libcugraphops libwholegraph; do diff --git a/ci/build_python.sh b/ci/build_python.sh index 07a4f59396b..62154fdeced 100755 --- a/ci/build_python.sh +++ b/ci/build_python.sh @@ -23,10 +23,11 @@ echo "${version}" > VERSION rapids-logger "Begin py build" package_dir="python" -for package_name in pylibcugraph cugraph nx-cugraph cugraph-pyg cugraph-dgl; do +for package_name in pylibcugraph cugraph cugraph-pyg cugraph-dgl; do underscore_package_name=$(echo "${package_name}" | tr "-" "_") sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" "${package_dir}/${package_name}/${underscore_package_name}/_version.py" done +sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" "${package_dir}/nx-cugraph/_nx_cugraph/_version.py" # TODO: Remove `--no-test` flags once importing on a CPU # node works correctly diff --git a/ci/build_wheel.sh b/ci/build_wheel.sh index 9de1750de81..587c5fb38e7 100755 --- a/ci/build_wheel.sh +++ b/ci/build_wheel.sh @@ -20,8 +20,12 @@ RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}" # Patch project metadata files to include the CUDA version suffix and version override. +version_package_name="$underscore_package_name" +if [[ "${version_package_name}" = "nx_cugraph" ]]; then + version_package_name="_nx_cugraph" +fi pyproject_file="${package_dir}/pyproject.toml" -version_file="${package_dir}/${underscore_package_name}/_version.py" +version_file="${package_dir}/${version_package_name}/_version.py" sed -i "s/name = \"${package_name}\"/name = \"${package_name}${PACKAGE_CUDA_SUFFIX}\"/g" ${pyproject_file} echo "${version}" > VERSION diff --git a/ci/release/update-version.sh b/ci/release/update-version.sh index 9e284f49b5b..ce2c14a01fc 100755 --- a/ci/release/update-version.sh +++ b/ci/release/update-version.sh @@ -39,33 +39,11 @@ function sed_runner() { sed -i.bak ''"$1"'' $2 && rm -f ${2}.bak } -# rapids-cmake version -sed_runner 's/'"branch-.*\/RAPIDS.cmake"'/'"branch-${NEXT_SHORT_TAG}\/RAPIDS.cmake"'/g' fetch_rapids.cmake - -# CMakeLists update -sed_runner 's/'"CUGRAPH VERSION .* LANGUAGES C CXX CUDA)"'/'"CUGRAPH VERSION ${NEXT_FULL_TAG} LANGUAGES C CXX CUDA)"'/g' cpp/CMakeLists.txt -sed_runner 's|'"branch-.*/RAPIDS.cmake"'|'"branch-${NEXT_SHORT_TAG}/RAPIDS.cmake"'|g' cpp/CMakeLists.txt -sed_runner 's/'"CUGRAPH_ETL VERSION .* LANGUAGES C CXX CUDA)"'/'"CUGRAPH_ETL VERSION ${NEXT_FULL_TAG} LANGUAGES C CXX CUDA)"'/g' cpp/libcugraph_etl/CMakeLists.txt -sed_runner 's|'"branch-.*/RAPIDS.cmake"'|'"branch-${NEXT_SHORT_TAG}/RAPIDS.cmake"'|g' cpp/libcugraph_etl/CMakeLists.txt -sed_runner "s/set(pylibcugraph_version .*)/set(pylibcugraph_version ${NEXT_FULL_TAG})/g" python/pylibcugraph/CMakeLists.txt -sed_runner "s/set(cugraph_version .*)/set(cugraph_version ${NEXT_FULL_TAG})/g" python/cugraph/CMakeLists.txt - -# RTD update -sed_runner 's/version = .*/version = '"'${NEXT_SHORT_TAG}'"'/g' docs/cugraph/source/conf.py -sed_runner 's/release = .*/release = '"'${NEXT_FULL_TAG}'"'/g' docs/cugraph/source/conf.py - - -# build.sh script -sed_runner 's/RAPIDS_VERSION=.*/RAPIDS_VERSION='${NEXT_SHORT_TAG}'/g' build.sh - # Centralized version file update # NOTE: Any script that runs in CI will need to use gha-tool `rapids-generate-version` # and echo it to `VERSION` file to get an alpha spec of the current version echo "${NEXT_FULL_TAG}" > VERSION -# Wheel testing script -sed_runner "s/branch-.*/branch-${NEXT_SHORT_TAG}/g" ci/test_wheel_cugraph.sh - # Need to distutils-normalize the original version NEXT_SHORT_TAG_PEP440=$(python -c "from setuptools.extern import packaging; print(packaging.version.Version('${NEXT_SHORT_TAG}'))") @@ -105,19 +83,11 @@ for DEP in "${DEPENDENCIES[@]}"; do done done -# Doxyfile update -sed_runner "s|PROJECT_NUMBER[[:space:]]*=.*|PROJECT_NUMBER=${NEXT_SHORT_TAG}|" cpp/doxygen/Doxyfile - # ucx-py version sed_runner "/^ucx_py_version:$/ {n;s/.*/ - \"${NEXT_UCX_PY_VERSION}.*\"/}" conda/recipes/cugraph/conda_build_config.yaml sed_runner "/^ucx_py_version:$/ {n;s/.*/ - \"${NEXT_UCX_PY_VERSION}.*\"/}" conda/recipes/cugraph-service/conda_build_config.yaml sed_runner "/^ucx_py_version:$/ {n;s/.*/ - \"${NEXT_UCX_PY_VERSION}.*\"/}" conda/recipes/pylibcugraph/conda_build_config.yaml -# nx-cugraph NetworkX entry-point meta-data -sed_runner "s@branch-[0-9][0-9].[0-9][0-9]@branch-${NEXT_SHORT_TAG}@g" python/nx-cugraph/_nx_cugraph/__init__.py -# FIXME: can this use the standard VERSION file and update mechanism? -sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/nx-cugraph/_nx_cugraph/__init__.py - # CI files for FILE in .github/workflows/*.yaml; do sed_runner "/shared-workflows/ s/@.*/@branch-${NEXT_SHORT_TAG}/g" "${FILE}" @@ -126,7 +96,6 @@ for FILE in .github/workflows/*.yaml; do # Wheel builds install dask-cuda from source, update its branch sed_runner "s/dask-cuda.git@branch-[0-9][0-9].[0-9][0-9]/dask-cuda.git@branch-${NEXT_SHORT_TAG}/g" "${FILE}" done -sed_runner "s/RAPIDS_VERSION_NUMBER=\".*/RAPIDS_VERSION_NUMBER=\"${NEXT_SHORT_TAG}\"/g" ci/build_docs.sh sed_runner "s/branch-.*/branch-${NEXT_SHORT_TAG}/g" python/nx-cugraph/README.md diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index b12403710ab..c562be510c4 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR) -include(../fetch_rapids.cmake) +include(../rapids_config.cmake) include(rapids-cmake) include(rapids-cpm) include(rapids-cuda) @@ -25,7 +25,7 @@ include(rapids-find) rapids_cuda_init_architectures(CUGRAPH) -project(CUGRAPH VERSION 24.04.00 LANGUAGES C CXX CUDA) +project(CUGRAPH VERSION "${RAPIDS_VERSION}" LANGUAGES C CXX CUDA) if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11.0) @@ -588,7 +588,7 @@ find_package(Doxygen 1.8.11) if(Doxygen_FOUND) add_custom_command(OUTPUT CUGRAPH_DOXYGEN WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doxygen - COMMAND doxygen Doxyfile + COMMAND ${CMAKE_COMMAND} -E env "RAPIDS_VERSION_MAJOR_MINOR=${RAPIDS_VERSION_MAJOR_MINOR}" doxygen Doxyfile VERBATIM) add_custom_target(docs_cugraph DEPENDS CUGRAPH_DOXYGEN) diff --git a/cpp/doxygen/Doxyfile b/cpp/doxygen/Doxyfile index d4652a79f91..5b0f2ec0a5e 100644 --- a/cpp/doxygen/Doxyfile +++ b/cpp/doxygen/Doxyfile @@ -48,7 +48,7 @@ PROJECT_NAME = libcugraph # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER=24.04 +PROJECT_NUMBER=$(RAPIDS_VERSION_MAJOR_MINOR) # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/cpp/libcugraph_etl/CMakeLists.txt b/cpp/libcugraph_etl/CMakeLists.txt index c1b526fb121..6b258afdf96 100644 --- a/cpp/libcugraph_etl/CMakeLists.txt +++ b/cpp/libcugraph_etl/CMakeLists.txt @@ -15,7 +15,7 @@ #============================================================================= cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR) -include(../../fetch_rapids.cmake) +include(../../rapids_config.cmake) include(rapids-cmake) include(rapids-cpm) @@ -25,7 +25,7 @@ include(rapids-find) rapids_cuda_init_architectures(CUGRAPH_ETL) -project(CUGRAPH_ETL VERSION 24.04.00 LANGUAGES C CXX CUDA) +project(CUGRAPH_ETL VERSION "${RAPIDS_VERSION}" LANGUAGES C CXX CUDA) if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11.0) diff --git a/docs/cugraph/source/conf.py b/docs/cugraph/source/conf.py index 719f94d4838..952b962aca2 100644 --- a/docs/cugraph/source/conf.py +++ b/docs/cugraph/source/conf.py @@ -19,6 +19,10 @@ import os import sys +from packaging.version import Version + +import cugraph + # If extensions (or modules to document with autodoc) are in another # directory, add these directories to sys.path here. If the directory # is relative to the documentation root, use os.path.abspath to make it @@ -76,10 +80,11 @@ # |version| and |release|, also used in various other places throughout the # built documents. # +CUGRAPH_VERSION = Version(cugraph.__version__) # The short X.Y version. -version = '24.04' +version = f"{CUGRAPH_VERSION.major:02}.{CUGRAPH_VERSION.minor:02}" # The full version, including alpha/beta/rc tags. -release = '24.04.00' +release = f"{CUGRAPH_VERSION.major:02}.{CUGRAPH_VERSION.minor:02}.{CUGRAPH_VERSION.micro:02}" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/fetch_rapids.cmake b/fetch_rapids.cmake deleted file mode 100644 index 596908d01cd..00000000000 --- a/fetch_rapids.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# ============================================================================= -# Copyright (c) 2022-2024, 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. -# ============================================================================= -if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/CUGRAPH_RAPIDS.cmake) - file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-24.04/RAPIDS.cmake - ${CMAKE_CURRENT_BINARY_DIR}/CUGRAPH_RAPIDS.cmake - ) -endif() -include(${CMAKE_CURRENT_BINARY_DIR}/CUGRAPH_RAPIDS.cmake) diff --git a/python/cugraph/CMakeLists.txt b/python/cugraph/CMakeLists.txt index 79510f9bf8d..dfccf02d042 100644 --- a/python/cugraph/CMakeLists.txt +++ b/python/cugraph/CMakeLists.txt @@ -14,9 +14,7 @@ cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR) -set(cugraph_version 24.04.00) - -include(../../fetch_rapids.cmake) +include(../../rapids_config.cmake) # We always need CUDA for cuML because the raft dependency brings in a # header-only cuco dependency that enables CUDA unconditionally. @@ -25,7 +23,7 @@ rapids_cuda_init_architectures(cugraph-python) project( cugraph-python - VERSION ${cugraph_version} + VERSION "${RAPIDS_VERSION}" LANGUAGES CXX CUDA ) @@ -43,7 +41,7 @@ endif() # If the user requested it, we attempt to find CUGRAPH. if(FIND_CUGRAPH_CPP) - find_package(cugraph ${cugraph_version} REQUIRED) + find_package(cugraph "${RAPIDS_VERSION}" REQUIRED) else() set(cugraph_FOUND OFF) endif() diff --git a/python/nx-cugraph/nx_cugraph/VERSION b/python/nx-cugraph/_nx_cugraph/VERSION similarity index 100% rename from python/nx-cugraph/nx_cugraph/VERSION rename to python/nx-cugraph/_nx_cugraph/VERSION diff --git a/python/nx-cugraph/_nx_cugraph/__init__.py b/python/nx-cugraph/_nx_cugraph/__init__.py index b2f13d25ff3..4f8bc824afa 100644 --- a/python/nx-cugraph/_nx_cugraph/__init__.py +++ b/python/nx-cugraph/_nx_cugraph/__init__.py @@ -23,12 +23,18 @@ $ python _nx_cugraph/__init__.py """ +from packaging.version import Version + +from _nx_cugraph._version import __version__ + +_nx_cugraph_version = Version(__version__) + # Entries between BEGIN and END are automatically generated _info = { "backend_name": "cugraph", "project": "nx-cugraph", "package": "nx_cugraph", - "url": "https://github.com/rapidsai/cugraph/tree/branch-24.04/python/nx-cugraph", + "url": f"https://github.com/rapidsai/cugraph/tree/branch-{_nx_cugraph_version.major:02}.{_nx_cugraph_version.minor:02}/python/nx-cugraph", "short_summary": "GPU-accelerated backend.", # "description": "TODO", "functions": { @@ -202,9 +208,6 @@ def get_info(): return d -# FIXME: can this use the standard VERSION file and update mechanism? -__version__ = "24.04.00" - if __name__ == "__main__": from pathlib import Path diff --git a/python/nx-cugraph/nx_cugraph/_version.py b/python/nx-cugraph/_nx_cugraph/_version.py similarity index 91% rename from python/nx-cugraph/nx_cugraph/_version.py rename to python/nx-cugraph/_nx_cugraph/_version.py index a528a3bfe1b..dc2d2a3a3c0 100644 --- a/python/nx-cugraph/nx_cugraph/_version.py +++ b/python/nx-cugraph/_nx_cugraph/_version.py @@ -19,6 +19,6 @@ # to update version info (including commit hashes) without modifying # source files. __version__ = ( - importlib.resources.files("nx_cugraph").joinpath("VERSION").read_text().strip() + importlib.resources.files("_nx_cugraph").joinpath("VERSION").read_text().strip() ) __git_commit__ = "" diff --git a/python/nx-cugraph/nx_cugraph/__init__.py b/python/nx-cugraph/nx_cugraph/__init__.py index 3a8f0996e9c..2c54da87898 100644 --- a/python/nx-cugraph/nx_cugraph/__init__.py +++ b/python/nx-cugraph/nx_cugraph/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023, NVIDIA CORPORATION. +# Copyright (c) 2023-2024, 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 @@ -29,4 +29,4 @@ from . import algorithms from .algorithms import * -from nx_cugraph._version import __git_commit__, __version__ +from _nx_cugraph._version import __git_commit__, __version__ diff --git a/python/nx-cugraph/pyproject.toml b/python/nx-cugraph/pyproject.toml index 07ec0eab264..0ae83b653ba 100644 --- a/python/nx-cugraph/pyproject.toml +++ b/python/nx-cugraph/pyproject.toml @@ -71,7 +71,7 @@ cugraph = "_nx_cugraph:get_info" license-files = ["LICENSE"] [tool.setuptools.dynamic] -version = {file = "nx_cugraph/VERSION"} +version = {file = "_nx_cugraph/VERSION"} [tool.setuptools.packages.find] include = [ diff --git a/python/pylibcugraph/CMakeLists.txt b/python/pylibcugraph/CMakeLists.txt index cc76ab5ba2b..f43b7db1279 100644 --- a/python/pylibcugraph/CMakeLists.txt +++ b/python/pylibcugraph/CMakeLists.txt @@ -14,9 +14,7 @@ cmake_minimum_required(VERSION 3.26.4 FATAL_ERROR) -set(pylibcugraph_version 24.04.00) - -include(../../fetch_rapids.cmake) +include(../../rapids_config.cmake) # We always need CUDA for cuML because the raft dependency brings in a # header-only cuco dependency that enables CUDA unconditionally. @@ -25,7 +23,7 @@ rapids_cuda_init_architectures(pylibcugraph-python) project( pylibcugraph-python - VERSION ${pylibcugraph_version} + VERSION "${RAPIDS_VERSION}" LANGUAGES CXX CUDA ) @@ -43,7 +41,7 @@ endif() # If the user requested it we attempt to find CUGRAPH. if(FIND_CUGRAPH_CPP) - find_package(cugraph ${pylibcugraph_version} REQUIRED) + find_package(cugraph "${RAPIDS_VERSION}" REQUIRED) else() set(cugraph_FOUND OFF) endif() diff --git a/rapids_config.cmake b/rapids_config.cmake new file mode 100644 index 00000000000..50b1054b7b9 --- /dev/null +++ b/rapids_config.cmake @@ -0,0 +1,34 @@ +# ============================================================================= +# Copyright (c) 2018-2024, 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. +# ============================================================================= +file(READ "${CMAKE_CURRENT_LIST_DIR}/VERSION" _rapids_version) +if(_rapids_version MATCHES [[^([0-9][0-9])\.([0-9][0-9])\.([0-9][0-9])]]) + set(RAPIDS_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(RAPIDS_VERSION_MINOR "${CMAKE_MATCH_2}") + set(RAPIDS_VERSION_PATCH "${CMAKE_MATCH_3}") + set(RAPIDS_VERSION_MAJOR_MINOR "${RAPIDS_VERSION_MAJOR}.${RAPIDS_VERSION_MINOR}") + set(RAPIDS_VERSION "${RAPIDS_VERSION_MAJOR}.${RAPIDS_VERSION_MINOR}.${RAPIDS_VERSION_PATCH}") +else() + string(REPLACE "\n" "\n " _rapids_version_formatted " ${_rapids_version}") + message( + FATAL_ERROR + "Could not determine RAPIDS version. Contents of VERSION file:\n${_rapids_version_formatted}") +endif() + +if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/CUGRAPH_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake") + file( + DOWNLOAD + "https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_VERSION_MAJOR_MINOR}/RAPIDS.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/CUGRAPH_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake") +endif() +include("${CMAKE_CURRENT_BINARY_DIR}/CUGRAPH_RAPIDS-${RAPIDS_VERSION_MAJOR_MINOR}.cmake")