diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..a193fff41 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +23.12.00 diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index e290374fd..4e1b7bd2a 100755 --- a/ci/build_cpp.sh +++ b/ci/build_cpp.sh @@ -9,8 +9,10 @@ export CMAKE_GENERATOR=Ninja rapids-print-env +version=$(rapids-generate-version) + rapids-logger "Begin cpp build" -rapids-conda-retry mambabuild conda/recipes/libwholegraph +RAPIDS_PACKAGE_VERSION=${version} rapids-conda-retry mambabuild conda/recipes/libwholegraph rapids-upload-conda-to-s3 cpp diff --git a/ci/build_python.sh b/ci/build_python.sh index e4382400e..b79ba92b1 100755 --- a/ci/build_python.sh +++ b/ci/build_python.sh @@ -13,15 +13,18 @@ PACKAGES="libwholegraph" CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp) -rapids-mamba-retry install \ - --channel "${CPP_CHANNEL}" \ - "${PACKAGES}" +version=$(rapids-generate-version) +git_commit=$(git rev-parse HEAD) +export RAPIDS_PACKAGE_VERSION=${version} +echo "${version}" > VERSION rapids-logger "Begin py build" # TODO: Remove `--no-test` flags once importing on a CPU # node works correctly rapids-logger "Begin pylibwholegraph build" +version_file_pylibwholegraph="python/pylibwholegraph/pylibwholegraph/_version.py" +sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" ${version_file_pylibwholegraph} rapids-conda-retry mambabuild \ --no-test \ --channel "${CPP_CHANNEL}" \ diff --git a/ci/build_wheel.sh b/ci/build_wheel.sh index 6e2c9f73c..dd7ce7737 100755 --- a/ci/build_wheel.sh +++ b/ci/build_wheel.sh @@ -9,9 +9,8 @@ package_dir="python/pylibwholegraph" source rapids-configure-sccache source rapids-date-string -# Use gha-tools rapids-pip-wheel-version to generate wheel version then -# update the necessary files -version_override="$(rapids-pip-wheel-version ${RAPIDS_DATE_STRING})" +version=$(rapids-generate-version) +git_commit=$(git rev-parse HEAD) RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" @@ -21,9 +20,11 @@ PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}" # Patch project metadata files to include the CUDA version suffix and version override. pyproject_file="${package_dir}/pyproject.toml" +version_file="${package_dir}/${package_name}/_version.py" -sed -i "s/^version = .*/version = \"${version_override}\"/g" ${pyproject_file} sed -i "s/name = \"${package_name}\"/name = \"${package_name}${PACKAGE_CUDA_SUFFIX}\"/g" ${pyproject_file} +echo "${version}" > VERSION +sed -i "/^__git_commit__ / s/= .*/= \"${git_commit}\"/g" ${version_file} # For nightlies we want to ensure that we're pulling in alphas as well. The # easiest way to do so is to augment the spec with a constraint containing a diff --git a/ci/release/update-version.sh b/ci/release/update-version.sh index aba3b8403..0f64b213e 100755 --- a/ci/release/update-version.sh +++ b/ci/release/update-version.sh @@ -57,11 +57,8 @@ sed_runner '/set(RAPIDS_VERSION/ s/".*"/'\"${NEXT_SHORT_TAG}\"'/g' python/pylibw sed_runner 's/version = .*/version = '"'${NEXT_SHORT_TAG}'"'/g' docs/wholegraph/source/conf.py sed_runner 's/release = .*/release = '"'${NEXT_FULL_TAG}'"'/g' docs/wholegraph/source/conf.py -# Python __init__.py updates -sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/pylibwholegraph/pylibwholegraph/__init__.py - -# Python pyproject.toml updates -sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/pylibwholegraph/pyproject.toml +# Centralized version file update +echo "${NEXT_FULL_TAG}" > VERSION DEPENDENCIES=( libraft diff --git a/conda/recipes/libwholegraph/meta.yaml b/conda/recipes/libwholegraph/meta.yaml index c3551fc62..624c78bd5 100644 --- a/conda/recipes/libwholegraph/meta.yaml +++ b/conda/recipes/libwholegraph/meta.yaml @@ -1,6 +1,6 @@ # Copyright (c) 2019-2023, NVIDIA CORPORATION. -{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %} +{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') + environ.get('VERSION_SUFFIX', '') %} {% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %} {% set cuda_version = '.'.join(environ['RAPIDS_CUDA_VERSION'].split('.')[:2]) %} {% set cuda_major = cuda_version.split('.')[0] %} @@ -11,7 +11,7 @@ package: name: libwholegraph-split source: - git_url: ../../.. + path: ../../.. build: script_env: diff --git a/conda/recipes/pylibwholegraph/meta.yaml b/conda/recipes/pylibwholegraph/meta.yaml index 7237eb3df..0c7d57dc3 100644 --- a/conda/recipes/pylibwholegraph/meta.yaml +++ b/conda/recipes/pylibwholegraph/meta.yaml @@ -1,6 +1,6 @@ # Copyright (c) 2022-2023, NVIDIA CORPORATION. -{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %} +{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') + environ.get('VERSION_SUFFIX', '') %} {% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %} {% set cuda_version = '.'.join(environ['RAPIDS_CUDA_VERSION'].split('.')[:2]) %} {% set cuda_major = cuda_version.split('.')[0] %} @@ -12,7 +12,7 @@ package: version: {{ version }} source: - git_url: ../../.. + path: ../../.. build: number: {{ GIT_DESCRIBE_NUMBER }} diff --git a/python/pylibwholegraph/pylibwholegraph/VERSION b/python/pylibwholegraph/pylibwholegraph/VERSION new file mode 120000 index 000000000..d62dc733e --- /dev/null +++ b/python/pylibwholegraph/pylibwholegraph/VERSION @@ -0,0 +1 @@ +../../../VERSION \ No newline at end of file diff --git a/python/pylibwholegraph/pylibwholegraph/__init__.py b/python/pylibwholegraph/pylibwholegraph/__init__.py index d3184e8d0..f416c96cf 100644 --- a/python/pylibwholegraph/pylibwholegraph/__init__.py +++ b/python/pylibwholegraph/pylibwholegraph/__init__.py @@ -11,4 +11,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "23.12.00" +from pylibwholegraph._version import __git_commit__, __version__ diff --git a/python/pylibwholegraph/pylibwholegraph/_version.py b/python/pylibwholegraph/pylibwholegraph/_version.py new file mode 100644 index 000000000..394252fd0 --- /dev/null +++ b/python/pylibwholegraph/pylibwholegraph/_version.py @@ -0,0 +1,21 @@ +# Copyright (c) 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 importlib.resources + +__version__ = ( + importlib.resources.files("pylibwholegraph").joinpath("VERSION").read_text().strip() +) +__git_commit__ = "" diff --git a/python/pylibwholegraph/pyproject.toml b/python/pylibwholegraph/pyproject.toml index 0e3cf966e..ccb14b831 100644 --- a/python/pylibwholegraph/pyproject.toml +++ b/python/pylibwholegraph/pyproject.toml @@ -24,7 +24,7 @@ requires = [ [project] name = "pylibwholegraph" -version = "23.12.00" +dynamic = ["version"] description = "pylibwholegraph - GPU Graph Storage for GNN feature and graph structure" authors = [ { name = "NVIDIA Corporation" }, @@ -45,3 +45,6 @@ classifiers = [ [tool.setuptools] license-files = ["LICENSE"] + +[tool.setuptools.dynamic] +version = {file = "pylibwholegraph/VERSION"} diff --git a/python/pylibwholegraph/setup.py b/python/pylibwholegraph/setup.py index 64b20e762..0a1f3fa42 100644 --- a/python/pylibwholegraph/setup.py +++ b/python/pylibwholegraph/setup.py @@ -53,7 +53,8 @@ def run(self): ] ), package_data={ - "pylibwholegraph": ["torch_cpp_ext/*.cpp", "torch_cpp_ext/*.h"], + "pylibwholegraph": ["VERSION", "torch_cpp_ext/*.cpp", + "torch_cpp_ext/*.h"], }, include_package_data=True, cmdclass=cmdclass,