From 87b9e14639a133a67b35460c67204b367ad1d32f Mon Sep 17 00:00:00 2001 From: divyegala Date: Mon, 9 Oct 2023 18:23:30 -0700 Subject: [PATCH] setup versions --- ci/build_cpp.sh | 4 +++- ci/build_python.sh | 13 +++++++++++++ ci/build_wheel.sh | 9 +++++---- conda/recipes/libraft/meta.yaml | 4 ++-- conda/recipes/pylibraft/meta.yaml | 4 ++-- conda/recipes/raft-ann-bench-cpu/meta.yaml | 4 ++-- conda/recipes/raft-ann-bench/meta.yaml | 4 ++-- conda/recipes/raft-dask/meta.yaml | 4 ++-- python/pylibraft/pylibraft/__init__.py | 2 +- python/pylibraft/pylibraft/_version.py | 18 ++++++++++++++++++ python/pylibraft/pyproject.toml | 2 +- python/raft-ann-bench/pyproject.toml | 2 +- .../src/raft-ann-bench/__init__.py | 16 ++++++++++++++++ .../src/raft-ann-bench/_version.py | 18 ++++++++++++++++++ python/raft-dask/pyproject.toml | 2 +- python/raft-dask/raft_dask/__init__.py | 2 +- python/raft-dask/raft_dask/_version.py | 18 ++++++++++++++++++ 17 files changed, 106 insertions(+), 20 deletions(-) create mode 100644 python/pylibraft/pylibraft/_version.py create mode 100644 python/raft-ann-bench/src/raft-ann-bench/_version.py create mode 100644 python/raft-dask/raft_dask/_version.py diff --git a/ci/build_cpp.sh b/ci/build_cpp.sh index a41f81152d..178ce723a5 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/libraft +RAPIDS_PACKAGE_VERSION=${version} rapids-conda-retry mambabuild conda/recipes/libraft rapids-upload-conda-to-s3 cpp diff --git a/ci/build_python.sh b/ci/build_python.sh index c49677e78c..1d14b9ed21 100755 --- a/ci/build_python.sh +++ b/ci/build_python.sh @@ -13,13 +13,23 @@ rapids-logger "Begin py build" CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp) +version=$(rapids-generate-version) +git_commit=$(git rev-parse HEAD) +export RAPIDS_PACKAGE_VERSION=${version} + # TODO: Remove `--no-test` flags once importing on a CPU # node works correctly +version_file_pylibraft="python/pylibraft/pylibraft/_version.py" +sed -i "/^__version__/ s/= .*/= ${version}/g" ${version_file_pylibraft} +sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" ${version_file_pylibraft} rapids-conda-retry mambabuild \ --no-test \ --channel "${CPP_CHANNEL}" \ conda/recipes/pylibraft +version_file_raft_dask="python/raft-dask/raft_dask/_version.py" +sed -i "/^__version__/ s/= .*/= ${version}/g" ${version_file_raft_dask} +sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" ${version_file_raft_dask} rapids-conda-retry mambabuild \ --no-test \ --channel "${CPP_CHANNEL}" \ @@ -27,6 +37,9 @@ rapids-conda-retry mambabuild \ conda/recipes/raft-dask # Build ann-bench for each cuda and python version +version_file_raft_ann_bench="python/raft-ann-bench/src/raft-ann-bench/_version.py" +sed -i "/^__version__/ s/= .*/= ${version}/g" ${version_file_raft_dask} +sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" ${version_file_raft_dask} rapids-conda-retry mambabuild \ --no-test \ --channel "${CPP_CHANNEL}" \ diff --git a/ci/build_wheel.sh b/ci/build_wheel.sh index 662a11ad0e..b7be4b1d36 100755 --- a/ci/build_wheel.sh +++ b/ci/build_wheel.sh @@ -10,9 +10,8 @@ underscore_package_name=$(echo "${package_name}" | tr "-" "_") 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})" @@ -22,9 +21,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} +sed -i "/^__version__ / s/= .*/= ${version}/g" ${version_file} +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/conda/recipes/libraft/meta.yaml b/conda/recipes/libraft/meta.yaml index f4d133d714..c5d8b0ff24 100644 --- a/conda/recipes/libraft/meta.yaml +++ b/conda/recipes/libraft/meta.yaml @@ -2,7 +2,7 @@ # Usage: # conda build . -c conda-forge -c nvidia -c rapidsai -{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %} +{% set version = environ.get('RAPIDS_PACKAGE_VERSION', '0.0.0.dev').strip('"').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] %} @@ -13,7 +13,7 @@ package: name: libraft-split source: - git_url: ../../.. + path: ../../.. outputs: - name: libraft-headers-only diff --git a/conda/recipes/pylibraft/meta.yaml b/conda/recipes/pylibraft/meta.yaml index cc781d0cba..d3654a7ccd 100644 --- a/conda/recipes/pylibraft/meta.yaml +++ b/conda/recipes/pylibraft/meta.yaml @@ -2,7 +2,7 @@ # Usage: # conda build . -c conda-forge -c numba -c rapidsai -c pytorch -{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %} +{% set version = environ.get('RAPIDS_PACKAGE_VERSION', '0.0.0.dev').strip('"').lstrip('v') + environ.get('VERSION_SUFFIX', '') %} {% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %} {% set py_version = environ['CONDA_PY'] %} {% set cuda_version = '.'.join(environ['RAPIDS_CUDA_VERSION'].split('.')[:2]) %} @@ -14,7 +14,7 @@ package: version: {{ version }} source: - git_url: ../../.. + path: ../../.. build: number: {{ GIT_DESCRIBE_NUMBER }} diff --git a/conda/recipes/raft-ann-bench-cpu/meta.yaml b/conda/recipes/raft-ann-bench-cpu/meta.yaml index 06737b0497..342879449c 100644 --- a/conda/recipes/raft-ann-bench-cpu/meta.yaml +++ b/conda/recipes/raft-ann-bench-cpu/meta.yaml @@ -2,7 +2,7 @@ # Usage: # conda build . -c conda-forge -c nvidia -c rapidsai -{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %} +{% set version = environ.get('RAPIDS_PACKAGE_VERSION', '0.0.0.dev').strip('"').lstrip('v') + environ.get('VERSION_SUFFIX', '') %} {% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %} {% set py_version = environ['CONDA_PY'] %} {% set cuda_version = '.'.join(environ['RAPIDS_CUDA_VERSION'].split('.')[:2]) %} @@ -14,7 +14,7 @@ package: script: build.sh source: - git_url: ../../.. + path: ../../.. build: script_env: diff --git a/conda/recipes/raft-ann-bench/meta.yaml b/conda/recipes/raft-ann-bench/meta.yaml index a2ab0af643..ddd5296a89 100644 --- a/conda/recipes/raft-ann-bench/meta.yaml +++ b/conda/recipes/raft-ann-bench/meta.yaml @@ -2,7 +2,7 @@ # Usage: # conda build . -c conda-forge -c nvidia -c rapidsai -{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %} +{% set version = environ.get('RAPIDS_PACKAGE_VERSION', '0.0.0.dev').strip('"').lstrip('v') + environ.get('VERSION_SUFFIX', '') %} {% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %} {% set py_version = environ['CONDA_PY'] %} {% set cuda_version = '.'.join(environ['RAPIDS_CUDA_VERSION'].split('.')[:2]) %} @@ -16,7 +16,7 @@ package: script: build.sh source: - git_url: ../../.. + path: ../../.. build: script_env: diff --git a/conda/recipes/raft-dask/meta.yaml b/conda/recipes/raft-dask/meta.yaml index 04dfef5063..bf07832870 100644 --- a/conda/recipes/raft-dask/meta.yaml +++ b/conda/recipes/raft-dask/meta.yaml @@ -2,7 +2,7 @@ # Usage: # conda build . -c conda-forge -c numba -c rapidsai -c pytorch -{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %} +{% set version = environ.get('RAPIDS_PACKAGE_VERSION', '0.0.0.dev').strip('"').lstrip('v') + environ.get('VERSION_SUFFIX', '') %} {% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %} {% set py_version = environ['CONDA_PY'] %} {% set cuda_version = '.'.join(environ['RAPIDS_CUDA_VERSION'].split('.')[:2]) %} @@ -14,7 +14,7 @@ package: version: {{ version }} source: - git_url: ../../.. + path: ../../.. build: number: {{ GIT_DESCRIBE_NUMBER }} diff --git a/python/pylibraft/pylibraft/__init__.py b/python/pylibraft/pylibraft/__init__.py index b5ca0800a5..8c5e180070 100644 --- a/python/pylibraft/pylibraft/__init__.py +++ b/python/pylibraft/pylibraft/__init__.py @@ -13,4 +13,4 @@ # limitations under the License. # -__version__ = "23.12.00" +from pylibraft._version import __version__, __git_commit__ \ No newline at end of file diff --git a/python/pylibraft/pylibraft/_version.py b/python/pylibraft/pylibraft/_version.py new file mode 100644 index 0000000000..ae559168f2 --- /dev/null +++ b/python/pylibraft/pylibraft/_version.py @@ -0,0 +1,18 @@ +# 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. +# + +# Version configuration +__version__ = "23.12.00" +__git_commit__ = "" diff --git a/python/pylibraft/pyproject.toml b/python/pylibraft/pyproject.toml index 7f3a926d43..90d6577a0b 100644 --- a/python/pylibraft/pyproject.toml +++ b/python/pylibraft/pyproject.toml @@ -28,7 +28,7 @@ build-backend = "setuptools.build_meta" [project] name = "pylibraft" -version = "23.12.00" +dynamic = ["version"] description = "RAFT: Reusable Algorithms Functions and other Tools" readme = { file = "README.md", content-type = "text/markdown" } authors = [ diff --git a/python/raft-ann-bench/pyproject.toml b/python/raft-ann-bench/pyproject.toml index 6562937548..bbd4446418 100644 --- a/python/raft-ann-bench/pyproject.toml +++ b/python/raft-ann-bench/pyproject.toml @@ -9,7 +9,7 @@ requires = [ [project] name = "raft-ann-bench" -version = "23.12.00" +dynamic = ["version"] description = "RAFT ANN benchmarks" authors = [ { name = "NVIDIA Corporation" }, diff --git a/python/raft-ann-bench/src/raft-ann-bench/__init__.py b/python/raft-ann-bench/src/raft-ann-bench/__init__.py index e69de29bb2..b04cb0a433 100644 --- a/python/raft-ann-bench/src/raft-ann-bench/__init__.py +++ b/python/raft-ann-bench/src/raft-ann-bench/__init__.py @@ -0,0 +1,16 @@ +# 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. +# + +from ._version import __version__, __git_commit__ diff --git a/python/raft-ann-bench/src/raft-ann-bench/_version.py b/python/raft-ann-bench/src/raft-ann-bench/_version.py new file mode 100644 index 0000000000..ae559168f2 --- /dev/null +++ b/python/raft-ann-bench/src/raft-ann-bench/_version.py @@ -0,0 +1,18 @@ +# 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. +# + +# Version configuration +__version__ = "23.12.00" +__git_commit__ = "" diff --git a/python/raft-dask/pyproject.toml b/python/raft-dask/pyproject.toml index 1619edbbbf..1846c1ea78 100644 --- a/python/raft-dask/pyproject.toml +++ b/python/raft-dask/pyproject.toml @@ -25,7 +25,7 @@ requires = [ [project] name = "raft-dask" -version = "23.12.00" +version = ["dynamic"] description = "Reusable Accelerated Functions & Tools Dask Infrastructure" readme = { file = "README.md", content-type = "text/markdown" } authors = [ diff --git a/python/raft-dask/raft_dask/__init__.py b/python/raft-dask/raft_dask/__init__.py index 845c587caa..b28791f60b 100644 --- a/python/raft-dask/raft_dask/__init__.py +++ b/python/raft-dask/raft_dask/__init__.py @@ -13,4 +13,4 @@ # limitations under the License. # -__version__ = "23.12.00" +from raft_dask._version import __version__, __git_commit__ diff --git a/python/raft-dask/raft_dask/_version.py b/python/raft-dask/raft_dask/_version.py new file mode 100644 index 0000000000..ae559168f2 --- /dev/null +++ b/python/raft-dask/raft_dask/_version.py @@ -0,0 +1,18 @@ +# 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. +# + +# Version configuration +__version__ = "23.12.00" +__git_commit__ = ""