diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..15f305fb --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.35.00 diff --git a/ci/build_python.sh b/ci/build_python.sh index de97365a..e658a857 100755 --- a/ci/build_python.sh +++ b/ci/build_python.sh @@ -7,9 +7,15 @@ source rapids-env-update rapids-print-env +version=$(rapids-generate-version) +commit=$(git rev-parse HEAD) + +echo "${version}" > VERSION +sed -i "/^__git_commit__/ s/= .*/= \"${commit}\"/g" ucp/_version.py + rapids-logger "Begin py build" -rapids-conda-retry mambabuild \ +RAPIDS_PACKAGE_VERSION=${version} rapids-conda-retry mambabuild \ conda/recipes/ucx-py rapids-upload-conda-to-s3 python diff --git a/ci/build_wheel.sh b/ci/build_wheel.sh index 51644bfd..f6bf9aeb 100755 --- a/ci/build_wheel.sh +++ b/ci/build_wheel.sh @@ -9,9 +9,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) +commit=$(git rev-parse HEAD) RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" @@ -22,8 +21,9 @@ PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}" # Patch project metadata files to include the CUDA version suffix and version override. pyproject_file="pyproject.toml" -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/= .*/= \"${commit}\"/g" ucp/_version.py # 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 70e21b19..c28efe79 100755 --- a/ci/release/update-version.sh +++ b/ci/release/update-version.sh @@ -50,5 +50,4 @@ for FILE in .github/workflows/*.yaml; do sed_runner "/shared-workflows/ s/@.*/@branch-${NEXT_RAPIDS_SHORT_TAG}/g" "${FILE}" done -sed_runner "s/^version = .*/version = \"${NEXT_RAPIDS_FULL_TAG_PEP440}\"/g" pyproject.toml -sed_runner "s/^__version__ = .*/__version__ = \"${NEXT_RAPIDS_FULL_TAG_PEP440}\"/g" ucp/__init__.py +echo "${NEXT_RAPIDS_FULL_TAG_PEP440}" > VERSION diff --git a/conda/recipes/ucx-py/meta.yaml b/conda/recipes/ucx-py/meta.yaml index f87feff3..d2186fa1 100644 --- a/conda/recipes/ucx-py/meta.yaml +++ b/conda/recipes/ucx-py/meta.yaml @@ -2,7 +2,7 @@ {% set data = load_file_data("pyproject.toml") %} -{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %} +{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') %} {% set py_version = environ['CONDA_PY'] %} {% set cuda_version = '.'.join(environ['RAPIDS_CUDA_VERSION'].split('.')[:2]) %} {% set date_string = environ['RAPIDS_DATE_STRING'] %} @@ -12,7 +12,7 @@ package: version: {{ version }} source: - git_url: ../../.. + path: ../../.. build: number: {{ GIT_DESCRIBE_NUMBER }} diff --git a/pyproject.toml b/pyproject.toml index 1109cd8f..fe37b67d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ requires = [ [project] name = "ucx-py" -version = "0.35.0" +dynamic = ["version"] description = "Python Bindings for the Unified Communication X library (UCX)" readme = { file = "README.md", content-type = "text/markdown" } authors = [ @@ -117,3 +117,6 @@ zip-safe = false [tool.setuptools.packages.find] exclude=["tests*"] + +[tool.setuptools.dynamic] +version = {file = "ucp/VERSION"} diff --git a/setup.py b/setup.py index f09911e1..9a52b30c 100644 --- a/setup.py +++ b/setup.py @@ -41,4 +41,5 @@ setup( ext_modules=ext_modules, cmdclass={"build_ext": new_build_ext}, + package_data={"ucp": ["VERSION"]}, ) diff --git a/ucp/VERSION b/ucp/VERSION new file mode 120000 index 00000000..6ff19de4 --- /dev/null +++ b/ucp/VERSION @@ -0,0 +1 @@ +../VERSION \ No newline at end of file diff --git a/ucp/__init__.py b/ucp/__init__.py index 89ac836e..791860b1 100644 --- a/ucp/__init__.py +++ b/ucp/__init__.py @@ -20,6 +20,7 @@ from .core import get_ucx_version # noqa from .utils import get_ucxpy_logger # noqa from ._libs.utils import get_address # noqa +from ._version import __git_commit__, __version__ try: import pynvml @@ -90,7 +91,6 @@ def _is_mig_device(handle): os.environ["UCX_MAX_RNDV_RAILS"] = "1" -__version__ = "0.35.0" __ucx_version__ = "%d.%d.%d" % get_ucx_version() if get_ucx_version() < (1, 11, 1): diff --git a/ucp/_version.py b/ucp/_version.py new file mode 100644 index 00000000..ab2f6e9f --- /dev/null +++ b/ucp/_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. + +import importlib.resources + +__version__ = importlib.resources.files("ucp").joinpath("VERSION").read_text().strip() +__git_commit__ = ""