Skip to content

Commit

Permalink
Update versioning strategy (rapidsai#997)
Browse files Browse the repository at this point in the history
See rapidsai/rmm#1347

Authors:
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Peter Andreas Entschev (https://github.com/pentschev)
  - https://github.com/jakirkham

Approvers:
  - Peter Andreas Entschev (https://github.com/pentschev)
  - Lawrence Mitchell (https://github.com/wence-)
  - AJ Schmidt (https://github.com/ajschmidt8)

URL: rapidsai#997
  • Loading branch information
vyasr authored Oct 31, 2023
1 parent 412b1e3 commit c6ab353
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 11 deletions.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.35.00
8 changes: 7 additions & 1 deletion ci/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions ci/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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})"

Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions conda/recipes/ucx-py/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'] %}
Expand All @@ -12,7 +12,7 @@ package:
version: {{ version }}

source:
git_url: ../../..
path: ../../..

build:
number: {{ GIT_DESCRIBE_NUMBER }}
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -117,3 +117,6 @@ zip-safe = false

[tool.setuptools.packages.find]
exclude=["tests*"]

[tool.setuptools.dynamic]
version = {file = "ucp/VERSION"}
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@
setup(
ext_modules=ext_modules,
cmdclass={"build_ext": new_build_ext},
package_data={"ucp": ["VERSION"]},
)
1 change: 1 addition & 0 deletions ucp/VERSION
2 changes: 1 addition & 1 deletion ucp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
18 changes: 18 additions & 0 deletions ucp/_version.py
Original file line number Diff line number Diff line change
@@ -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__ = ""

0 comments on commit c6ab353

Please sign in to comment.