diff --git a/ci/build_wheel.sh b/ci/build_wheel.sh index dcc0ee1..32d1866 100755 --- a/ci/build_wheel.sh +++ b/ci/build_wheel.sh @@ -3,16 +3,12 @@ set -euo pipefail -package_name="libucx" package_dir="python/libucx" -pyproject_file="${package_dir}/pyproject.toml" source rapids-configure-sccache source rapids-date-string RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" -PACKAGE_CUDA_SUFFIX="-${RAPIDS_PY_CUDA_SUFFIX}" -sed -i -E "s/^name = \"${package_name}(.*)?\"$/name = \"${package_name}${PACKAGE_CUDA_SUFFIX}\"/g" ${pyproject_file} python -m pip wheel "${package_dir}"/ -w "${package_dir}"/dist -vvv --no-deps --disable-pip-version-check diff --git a/ci/test_wheel.sh b/ci/test_wheel.sh index a7f3ddf..4cb76db 100755 --- a/ci/test_wheel.sh +++ b/ci/test_wheel.sh @@ -8,5 +8,5 @@ package_name="libucx" WHEELHOUSE="${PWD}/dist/" RAPIDS_PY_CUDA_SUFFIX="$(rapids-wheel-ctk-name-gen ${RAPIDS_CUDA_VERSION})" RAPIDS_PY_WHEEL_NAME="ucx_${RAPIDS_PY_CUDA_SUFFIX}" rapids-download-wheels-from-s3 cpp "${WHEELHOUSE}" -python -m pip install "${package_name}-${RAPIDS_PY_CUDA_SUFFIX}" --find-links "${WHEELHOUSE}" +python -m pip install "${WHEELHOUSE}/${package_name}_${RAPIDS_PY_CUDA_SUFFIX}"*.whl python -c "import libucx; libucx.load_library(); print('Loaded libucx libraries successfully!')" diff --git a/python/libucx/libucx/__init__.py b/python/libucx/libucx/__init__.py index 35b2557..175d7d9 100644 --- a/python/libucx/libucx/__init__.py +++ b/python/libucx/libucx/__init__.py @@ -13,14 +13,11 @@ # limitations under the License. # -import importlib.resources - +from ._version import __git_commit__, __version__ from .load import load_library -__version__ = ( - importlib.resources.files("libucx").joinpath("VERSION").read_text().strip() -) - __all__ = [ + "__git_commit__", "load_library", + "__version__", ] diff --git a/python/libucx/libucx/_version.py b/python/libucx/libucx/_version.py new file mode 100644 index 0000000..b347d59 --- /dev/null +++ b/python/libucx/libucx/_version.py @@ -0,0 +1,30 @@ +# Copyright (c) 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. + +import importlib.resources + +__version__ = ( + importlib.resources.files(__package__).joinpath("VERSION").read_text().strip() +) +try: + __git_commit__ = ( + importlib.resources.files(__package__) + .joinpath("GIT_COMMIT") + .read_text() + .strip() + ) +except FileNotFoundError: + __git_commit__ = "" + +__all__ = ["__git_commit__", "__version__"] diff --git a/python/libucx/pyproject.toml b/python/libucx/pyproject.toml index c416168..3b4c367 100644 --- a/python/libucx/pyproject.toml +++ b/python/libucx/pyproject.toml @@ -1,9 +1,10 @@ +# Copyright (c) 2024, NVIDIA CORPORATION. + [build-system] -build-backend = "setuptools.build_meta" +build-backend = "rapids_build_backend.build" requires = [ - "packaging", + "rapids-build-backend>=0.3.0,<0.4.0dev0", "setuptools>=64.0.0", - "wheel", ] [project] @@ -33,6 +34,17 @@ libucx = "libucx" [project.urls] Homepage = "https://github.com/openucx/ucx" +[tool.rapids-build-backend] +build-backend = "setuptools.build_meta" +commit-files = [ + "libucx/GIT_COMMIT" +] +dependencies-file = "" +requires = [ + "packaging", + "wheel", +] + [tool.setuptools] include-package-data = true