From f690e5c8c38b847ce15290298ad3808ba97c542a Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 4 Jun 2024 09:55:20 -0500 Subject: [PATCH] ensure update-version.sh preserves alpha spec, add tests on version constants (#2344) Contributes to https://github.com/rapidsai/build-planning/issues/31 Follow-up to #2331 * ensures that `update-version.sh` does not remove alpha specs like `,>=0.0.0a0` in `pyproject.toml` and conda environment files * consolidates `rapids-build-backend` versions in `dependencies.yaml` - *since I was pushing a new commit here anyway, figured I'd take the opportunity to include that simplification recommended in https://github.com/rapidsai/cudf/pull/15245#discussion_r1617724287* * adds tests that `__git_commit__` and `__version__` constants are present and that `__version__` is populated Authors: - James Lamb (https://github.com/jameslamb) Approvers: - Bradley Dice (https://github.com/bdice) - Corey J. Nolet (https://github.com/cjnolet) URL: https://github.com/rapidsai/raft/pull/2344 --- .pre-commit-config.yaml | 2 +- ci/release/update-version.sh | 20 +++++++++---------- dependencies.yaml | 5 +++-- .../pylibraft/pylibraft/test/test_version.py | 12 +++++++++++ .../raft-dask/raft_dask/test/test_version.py | 12 +++++++++++ 5 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 python/pylibraft/pylibraft/test/test_version.py create mode 100644 python/raft-dask/raft_dask/test/test_version.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ecbaceb20f..0fa9b12409 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -95,7 +95,7 @@ repos: args: ["--toml", "pyproject.toml"] exclude: (?x)^(^CHANGELOG.md$) - repo: https://github.com/rapidsai/dependency-file-generator - rev: v1.13.9 + rev: v1.13.11 hooks: - id: rapids-dependency-file-generator args: ["--clean"] diff --git a/ci/release/update-version.sh b/ci/release/update-version.sh index 9554a7dde8..194ad9a07b 100755 --- a/ci/release/update-version.sh +++ b/ci/release/update-version.sh @@ -56,21 +56,21 @@ DEPENDENCIES=( ) for FILE in dependencies.yaml conda/environments/*.yaml; do for DEP in "${DEPENDENCIES[@]}"; do - sed_runner "/-.* ${DEP}==/ s/==.*/==${NEXT_SHORT_TAG_PEP440}\.*/g" ${FILE}; + sed_runner "/-.* ${DEP}==/ s/==.*/==${NEXT_SHORT_TAG_PEP440}\.*,>=0.0.0a0/g" ${FILE}; done - sed_runner "/-.* ucx-py==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*/g" ${FILE}; - sed_runner "/-.* ucx-py-cu11==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*/g" ${FILE}; - sed_runner "/-.* ucx-py-cu12==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*/g" ${FILE}; - sed_runner "/-.* libucxx==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*/g" ${FILE}; - sed_runner "/-.* distributed-ucxx==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*/g" ${FILE}; - sed_runner "/-.* distributed-ucxx-cu11==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*/g" ${FILE}; - sed_runner "/-.* distributed-ucxx-cu12==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*/g" ${FILE}; + sed_runner "/-.* ucx-py==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*,>=0.0.0a0/g" ${FILE}; + sed_runner "/-.* ucx-py-cu11==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*,>=0.0.0a0/g" ${FILE}; + sed_runner "/-.* ucx-py-cu12==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*,>=0.0.0a0/g" ${FILE}; + sed_runner "/-.* libucxx==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*,>=0.0.0a0/g" ${FILE}; + sed_runner "/-.* distributed-ucxx==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*,>=0.0.0a0/g" ${FILE}; + sed_runner "/-.* distributed-ucxx-cu11==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*,>=0.0.0a0/g" ${FILE}; + sed_runner "/-.* distributed-ucxx-cu12==/ s/==.*/==${NEXT_UCX_PY_SHORT_TAG_PEP440}\.*,>=0.0.0a0/g" ${FILE}; done for FILE in python/*/pyproject.toml; do for DEP in "${DEPENDENCIES[@]}"; do - sed_runner "/\"${DEP}==/ s/==.*\"/==${NEXT_SHORT_TAG_PEP440}.*\"/g" ${FILE} + sed_runner "/\"${DEP}==/ s/==.*\"/==${NEXT_SHORT_TAG_PEP440}.*,>=0.0.0a0\"/g" ${FILE} done - sed_runner "/\"ucx-py==/ s/==.*\"/==${NEXT_UCX_PY_SHORT_TAG_PEP440}.*\"/g" ${FILE} + sed_runner "/\"ucx-py==/ s/==.*\"/==${NEXT_UCX_PY_SHORT_TAG_PEP440}.*,>=0.0.0a0\"/g" ${FILE} done sed_runner "/^ucx_py_version:$/ {n;s/.*/ - \"${NEXT_UCX_PY_VERSION}\"/}" conda/recipes/raft-dask/conda_build_config.yaml diff --git a/dependencies.yaml b/dependencies.yaml index b0e5706a7f..3d5de9bdc2 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -149,13 +149,14 @@ channels: dependencies: build: common: - - output_types: [conda] + - output_types: [conda, requirements, pyproject] packages: - rapids-build-backend>=0.3.0,<0.4.0.dev0 + - output_types: [conda] + packages: - scikit-build-core>=0.7.0 - output_types: [requirements, pyproject] packages: - - rapids-build-backend>=0.3.0,<0.4.0.dev0 - scikit-build-core[pyproject]>=0.7.0 rapids_build: common: diff --git a/python/pylibraft/pylibraft/test/test_version.py b/python/pylibraft/pylibraft/test/test_version.py new file mode 100644 index 0000000000..6d6c107bcc --- /dev/null +++ b/python/pylibraft/pylibraft/test/test_version.py @@ -0,0 +1,12 @@ +# Copyright (c) 2024, NVIDIA CORPORATION. + +import pylibraft + + +def test_version_constants_are_populated(): + # __git_commit__ will only be non-empty in a built distribution + assert isinstance(pylibraft.__git_commit__, str) + + # __version__ should always be non-empty + assert isinstance(pylibraft.__version__, str) + assert len(pylibraft.__version__) > 0 diff --git a/python/raft-dask/raft_dask/test/test_version.py b/python/raft-dask/raft_dask/test/test_version.py new file mode 100644 index 0000000000..94ba33d051 --- /dev/null +++ b/python/raft-dask/raft_dask/test/test_version.py @@ -0,0 +1,12 @@ +# Copyright (c) 2024, NVIDIA CORPORATION. + +import raft_dask + + +def test_version_constants_are_populated(): + # __git_commit__ will only be non-empty in a built distribution + assert isinstance(raft_dask.__git_commit__, str) + + # __version__ should always be non-empty + assert isinstance(raft_dask.__version__, str) + assert len(raft_dask.__version__) > 0