Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions tools/rapids-generate-pip-constraints
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Positional arguments:
#
# 1) file key to be passed to `rapids-dependency-file-generator --file-key`
# 2) filepath to write the constraint data to
# 2) filepath to append the constraint data to (creates it if it doesn't exist)
#
# [usage]
#
Expand All @@ -23,14 +23,8 @@ export RAPIDS_SCRIPT_NAME="rapids-generate-pip-constraints"
file_key="${1}"
out_file="${2}"

# 'latest' should be a no-op and not constrain dependencies at all
# (pip will prefer the latest versions of dependencies by default)
if [[ "${RAPIDS_DEPENDENCIES}" == "latest" ]]; then
echo "" > "${out_file}"
else
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}"
fi
rapids-dependency-file-generator \
--output requirements \
--file-key "${file_key}" \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};dependencies=${RAPIDS_DEPENDENCIES};use_cuda_wheels=true" \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice I'm slipping in use_cuda_wheels=true here.

That key is used in dependencies.yaml files across RAPIDS to avoid things like nvidia-cusparse or cuda-toolkit making it into output lists in RAPIDS devcontainers or DLFW builds.

We always want those lists in all the places rapids-generate-pip-constraints is used, though, so this passes it unconditionally.

| tee -a "${out_file}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here's the change switching from overwriting to appending

Copy link
Contributor

@bdice bdice Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why append instead of overwrite? I think the caller should handle that explicitly, like

rapids-generate-pip-constraints >> append_to_me

Maybe we should make this write to stdout if no output file is provided, and refactor towards removing the outfile entirely.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why append instead of overwrite

So you can build up a constraints file over multiple steps if you want, for example for a mix of constraints from dependencies.yaml and {package} @ file:// stuff from downloaded files.

Appending makes updates to whatever file PIP_CONSTRAINT points to idempotent and allows you to do that in any order. With overwriting, you'd right multiple files and then pass each on the command line with --constraint, which is just more opportunity to mistakenly forget one.

Maybe we should make this write to stdout if no output file is provided, and refactor towards removing the outfile entirely.

I don't personally see that as any better than the behavior currently in this PR, but it is harder to get right because you have to think about output redirection (for example, you have to be sure to use rapids-echo-stderr instead of rapids-logger.

It'd also create PR churn because it'd require coordinating code changes in all the repos using this (which this PR does not).


If you read that and are unconvinced, say it and I'll switch this to writing to stdout and make changes in the repos. I care more about moving this forward than I do the exact form.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷‍♂️ Okay! I agree moving it forward is better. We can refactor later if needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright yep definitely! Thank you. I'll merge this right now, I'm around to help if it breaks something.

Loading