diff --git a/tools/rapids-generate-pip-constraints b/tools/rapids-generate-pip-constraints new file mode 100755 index 0000000..76426ca --- /dev/null +++ b/tools/rapids-generate-pip-constraints @@ -0,0 +1,37 @@ +#!/bin/bash + +# Write out a constraints.txt file for use with 'pip'. +# +# For more context: +# * https://github.com/rapidsai/shared-workflows/pull/228 +# * https://github.com/rapidsai/cudf/pull/16570#discussion_r1735300231 +# +# Positional arguments: +# +# 1) file key to be passed to `rapids-dependency-file-generator --file-key` +# 2) filepath to write the constraint data to +# +# [usage] +# +# rapids-generate-pip-constraints test_python ./constraints.txt +# + +set -euo pipefail + +export RAPIDS_SCRIPT_NAME="rapids-generate-pip-constraints" + +file_key="${1}" +out_file="${2}" + +if [[ "${RAPIDS_DEPENDENCIES}" == "oldest" ]]; then + rapids-dependency-file-generator \ + --output requirements \ + --file-key "${file_key}" \ + --matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};dependencies=${RAPIDS_DEPENDENCIES}" \ + | tee "${out_file}" +elif [[ "${RAPIDS_DEPENDENCIES}" == "latest" ]]; then + echo "" > "${out_file}" +else + rapids-echo-stderr "Got unrecognized value for RAPIDS_DEPENDENCIES: '${RAPIDS_DEPENDENCIES}'. Expected one of ('latest', 'oldest')." + exit 1 +fi