Skip to content

Commit

Permalink
Setup Consistent Nightly Versions for Pip and Conda (#3933)
Browse files Browse the repository at this point in the history
See rapidsai/rmm#1347

Authors:
  - Divye Gala (https://github.com/divyegala)

Approvers:
  - AJ Schmidt (https://github.com/ajschmidt8)
  - Chuck Hastings (https://github.com/ChuckHastings)
  - Rick Ratzel (https://github.com/rlratzel)

URL: #3933
  • Loading branch information
divyegala authored Nov 1, 2023
1 parent 5c0bc8a commit f4bcdc2
Show file tree
Hide file tree
Showing 47 changed files with 296 additions and 62 deletions.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
23.12.00
4 changes: 3 additions & 1 deletion ci/build_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/libcugraph
RAPIDS_PACKAGE_VERSION=${version} rapids-conda-retry mambabuild conda/recipes/libcugraph

rapids-upload-conda-to-s3 cpp
15 changes: 15 additions & 0 deletions ci/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,19 @@ rapids-print-env

CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp)

version=$(rapids-generate-version)
git_commit=$(git rev-parse HEAD)
export RAPIDS_PACKAGE_VERSION=${version}
echo "${version}" > VERSION

rapids-logger "Begin py build"

package_dir="python"
for package_name in pylibcugraph cugraph nx-cugraph cugraph-pyg cugraph-dgl; do
underscore_package_name=$(echo "${package_name}" | tr "-" "_")
sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" "${package_dir}/${package_name}/${underscore_package_name}/_version.py"
done

# TODO: Remove `--no-test` flags once importing on a CPU
# node works correctly
rapids-conda-retry mambabuild \
Expand Down Expand Up @@ -40,6 +51,10 @@ rapids-conda-retry mambabuild \
# built on each CUDA platform to ensure they are included in each set of
# artifacts, since test scripts only install from one set of artifacts based on
# the CUDA version used for the test run.
version_file_cugraph_service_client="python/cugraph-service/client/cugraph_service_client/_version.py"
sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" ${version_file_cugraph_service_client}
version_file_cugraph_service_server="python/cugraph-service/server/cugraph_service_server/_version.py"
sed -i "/^__git_commit__/ s/= .*/= \"${git_commit}\"/g" ${version_file_cugraph_service_server}
rapids-conda-retry mambabuild \
--no-test \
--channel "${CPP_CHANNEL}" \
Expand Down
10 changes: 6 additions & 4 deletions ci/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ set -euo pipefail

package_name=$1
package_dir=$2
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})"

Expand All @@ -21,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}/${underscore_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}
echo "${version}" > VERSION
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
Expand Down
22 changes: 4 additions & 18 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,10 @@ sed_runner "s/set(cugraph_version .*)/set(cugraph_version ${NEXT_FULL_TAG})/g" p
sed_runner 's/version = .*/version = '"'${NEXT_SHORT_TAG}'"'/g' docs/cugraph/source/conf.py
sed_runner 's/release = .*/release = '"'${NEXT_FULL_TAG}'"'/g' docs/cugraph/source/conf.py

# Python __init__.py updates
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugraph/cugraph/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugraph-dgl/cugraph_dgl/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugraph-pyg/cugraph_pyg/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugraph-service/client/cugraph_service_client/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/cugraph-service/server/cugraph_service_server/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/pylibcugraph/pylibcugraph/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/nx-cugraph/nx_cugraph/__init__.py
sed_runner "s/__version__ = .*/__version__ = \"${NEXT_FULL_TAG}\"/g" python/nx-cugraph/_nx_cugraph/__init__.py

# Python pyproject.toml updates
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/cugraph/pyproject.toml
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/cugraph-dgl/pyproject.toml
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/cugraph-pyg/pyproject.toml
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/cugraph-service/client/pyproject.toml
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/cugraph-service/server/pyproject.toml
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/pylibcugraph/pyproject.toml
sed_runner "s/^version = .*/version = \"${NEXT_FULL_TAG}\"/g" python/nx-cugraph/pyproject.toml
# Centralized version file update
# NOTE: Any script that runs in CI will need to use gha-tool `rapids-generate-version`
# and echo it to `VERSION` file to get an alpha spec of the current version
echo "${NEXT_FULL_TAG}" > VERSION

# Wheel testing script
sed_runner "s/branch-.*/branch-${NEXT_SHORT_TAG}/g" ci/test_wheel_cugraph.sh
Expand Down
4 changes: 2 additions & 2 deletions conda/recipes/cugraph-dgl/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2023, NVIDIA CORPORATION.

{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %}
{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') + environ.get('VERSION_SUFFIX', '') %}
{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %}
{% set py_version = environ['CONDA_PY'] %}
{% set date_string = environ['RAPIDS_DATE_STRING'] %}
Expand All @@ -10,7 +10,7 @@ package:
version: {{ version }}

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

build:
number: {{ GIT_DESCRIBE_NUMBER }}
Expand Down
4 changes: 2 additions & 2 deletions conda/recipes/cugraph-pyg/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2022-2023, NVIDIA CORPORATION.

{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %}
{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') + environ.get('VERSION_SUFFIX', '') %}
{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %}
{% set py_version = environ['CONDA_PY'] %}
{% set date_string = environ['RAPIDS_DATE_STRING'] %}
Expand All @@ -10,7 +10,7 @@ package:
version: {{ version }}

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

build:
number: {{ GIT_DESCRIBE_NUMBER }}
Expand Down
4 changes: 2 additions & 2 deletions conda/recipes/cugraph-service/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2018-2023, NVIDIA CORPORATION.

{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %}
{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') + environ.get('VERSION_SUFFIX', '') %}
{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %}
{% set py_version = environ['CONDA_PY'] %}
{% set date_string = environ['RAPIDS_DATE_STRING'] %}
Expand All @@ -9,7 +9,7 @@ package:
name: cugraph-service-split

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

outputs:
- name: cugraph-service-client
Expand Down
4 changes: 2 additions & 2 deletions conda/recipes/cugraph/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2018-2023, NVIDIA CORPORATION.

{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %}
{% set version = environ['RAPIDS_PACKAGE_VERSION'].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]) %}
Expand All @@ -12,7 +12,7 @@ package:
version: {{ version }}

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

build:
number: {{ GIT_DESCRIBE_NUMBER }}
Expand Down
4 changes: 2 additions & 2 deletions conda/recipes/libcugraph/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2018-2023, NVIDIA CORPORATION.

{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %}
{% set version = environ['RAPIDS_PACKAGE_VERSION'].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] %}
Expand All @@ -10,7 +10,7 @@ package:
name: libcugraph-split

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

build:
script_env:
Expand Down
4 changes: 2 additions & 2 deletions conda/recipes/nx-cugraph/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2023, NVIDIA CORPORATION.

{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %}
{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') + environ.get('VERSION_SUFFIX', '') %}
{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %}
{% set py_version = environ['CONDA_PY'] %}
{% set date_string = environ['RAPIDS_DATE_STRING'] %}
Expand All @@ -10,7 +10,7 @@ package:
version: {{ version }}

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

build:
number: {{ GIT_DESCRIBE_NUMBER }}
Expand Down
4 changes: 2 additions & 2 deletions conda/recipes/pylibcugraph/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2023, NVIDIA CORPORATION.

{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') %}
{% set version = environ['RAPIDS_PACKAGE_VERSION'].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]) %}
Expand All @@ -12,7 +12,7 @@ package:
version: {{ version }}

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

build:
number: {{ GIT_DESCRIBE_NUMBER }}
Expand Down
1 change: 1 addition & 0 deletions python/cugraph-dgl/cugraph_dgl/VERSION
2 changes: 1 addition & 1 deletion python/cugraph-dgl/cugraph_dgl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
import cugraph_dgl.dataloading
import cugraph_dgl.nn

__version__ = "23.12.00"
from cugraph_dgl._version import __git_commit__, __version__
26 changes: 26 additions & 0 deletions python/cugraph-dgl/cugraph_dgl/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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

# Read VERSION file from the module that is symlinked to VERSION file
# in the root of the repo at build time or copied to the moudle at
# installation. VERSION is a separate file that allows CI build-time scripts
# to update version info (including commit hashes) without modifying
# source files.
__version__ = (
importlib.resources.files("cugraph_dgl").joinpath("VERSION").read_text().strip()
)
__git_commit__ = ""
5 changes: 4 additions & 1 deletion python/cugraph-dgl/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "cugraph-dgl"
version = "23.12.00"
dynamic = ["version"]
description = "cugraph extensions for DGL"
readme = { file = "README.md", content-type = "text/markdown" }
authors = [
Expand All @@ -35,6 +35,9 @@ Documentation = "https://docs.rapids.ai/api/cugraph/stable/"
[tool.setuptools]
license-files = ["LICENSE"]

[tool.setuptools.dynamic]
version = {file = "cugraph_dgl/VERSION"}

[tool.setuptools.packages.find]
include = [
"cugraph_dgl*",
Expand Down
7 changes: 5 additions & 2 deletions python/cugraph-dgl/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from setuptools import setup
from setuptools import find_packages, setup

setup()
packages = find_packages(include=["cugraph_dgl*"])
setup(
package_data={key: ["VERSION"] for key in packages},
)
1 change: 1 addition & 0 deletions python/cugraph-pyg/cugraph_pyg/VERSION
2 changes: 1 addition & 1 deletion python/cugraph-pyg/cugraph_pyg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "23.12.00"
from cugraph_pyg._version import __git_commit__, __version__
26 changes: 26 additions & 0 deletions python/cugraph-pyg/cugraph_pyg/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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

# Read VERSION file from the module that is symlinked to VERSION file
# in the root of the repo at build time or copied to the moudle at
# installation. VERSION is a separate file that allows CI build-time scripts
# to update version info (including commit hashes) without modifying
# source files.
__version__ = (
importlib.resources.files("cugraph_pyg").joinpath("VERSION").read_text().strip()
)
__git_commit__ = ""
5 changes: 4 additions & 1 deletion python/cugraph-pyg/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ testpaths = ["cugraph_pyg/tests"]

[project]
name = "cugraph_pyg"
version = "23.12.00"
dynamic = ["version"]
description = "cugraph_pyg - PyG support for cuGraph massive-scale, ultra-fast GPU graph analytics."
authors = [
{ name = "NVIDIA Corporation" },
Expand All @@ -38,6 +38,9 @@ Documentation = "https://docs.rapids.ai/api/cugraph/stable/"
[tool.setuptools]
license-files = ["LICENSE"]

[tool.setuptools.dynamic]
version = {file = "cugraph_pyg/VERSION"}

[tool.setuptools.packages.find]
include = [
"cugraph_pyg*",
Expand Down
4 changes: 3 additions & 1 deletion python/cugraph-pyg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import os
import shutil

from setuptools import Command, setup
from setuptools import Command, find_packages, setup

from setuputils import get_environment_option

Expand Down Expand Up @@ -59,6 +59,8 @@ def run(self):
os.system("rm -rf *.egg-info")


packages = find_packages(include=["cugraph_pyg*"])
setup(
cmdclass={"clean": CleanCommand},
package_data={key: ["VERSION"] for key in packages},
)
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
from cugraph_service_client.client import CugraphServiceClient
from cugraph_service_client.remote_graph import RemoteGraph

__version__ = "23.12.00"
from cugraph_service_client._version import __git_commit__, __version__
Loading

0 comments on commit f4bcdc2

Please sign in to comment.