Skip to content

rapids-generate-pip-constraints: stop special-casing 'latest'#247

Merged
rapids-bot[bot] merged 4 commits intomainfrom
generate-pip-constraints
Mar 5, 2026
Merged

rapids-generate-pip-constraints: stop special-casing 'latest'#247
rapids-bot[bot] merged 4 commits intomainfrom
generate-pip-constraints

Conversation

@jameslamb
Copy link
Member

@jameslamb jameslamb commented Feb 26, 2026

Contributes to rapidsai/build-planning#256

rapids-generate-pip-constraints currently special-cases RAPIDS_DEPENDENCIES="latest" and skips generating constraints in that case.

This will be helpful in rapidsai/build-planning#256, where we want to start constraining cuda-toolkit in wheels CI based on the CTK version in the CI image being used.

Notes for Reviewers

How I tested this

Looked for projects using this (GitHub search) and tested in them.

It's just a few:

On all of those, wheels CI jobs worked exactly as expected and without needing any code changes or dependencies.yaml updates... so this PR is safe to merge any time.

Is this safe?

It should be (see "How I tested this").

This is only used to add constraints (not requirements), so it shouldn't change our ability to catch problems like "forgot to declare a dependency" in CI.

It WILL increase the risk of [test] extras being underspecified. For example, if cuml[test] has scikit-learn>=1.3 and the constraints have scikit-learn>=1.5, we might never end up testing scikit-learn>=1.3,<1.5 (unless it's explicitly accounted for in a dependencies: "oldest" block).

The other risk here is that this creates friction because constraints passed to --constraint cannot contain extras. So e.g. if you want to depend on xgboost[dask], that cannot be in any of the lists generated by rapids-generate-pipe-constraints. I think we can work around that though when we hit those cases.

Overall, I think these are acceptable tradeoffs.

@jameslamb jameslamb added breaking Introduces a breaking change improvement Improves an existing functionality labels Feb 26, 2026
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.

--output requirements \
--file-key "${file_key}" \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION};dependencies=${RAPIDS_DEPENDENCIES};use_cuda_wheels=true" \
| 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.

@jameslamb
Copy link
Member Author

It looks to me like merging this would not break CI anywhere (see the draft PRs in "How I tested this"), I think it's ready for review.

@jameslamb jameslamb changed the title WIP: [NOT READY FOR REVIEW] rapids-generate-pip-constraints: stop special-casing 'latest' rapids-generate-pip-constraints: stop special-casing 'latest' Mar 4, 2026
@jameslamb jameslamb marked this pull request as ready for review March 4, 2026 22:38
@jameslamb jameslamb requested a review from a team as a code owner March 4, 2026 22:38
@jameslamb jameslamb requested review from bdice and removed request for a team March 4, 2026 22:38
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

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

Approving to unblock but would like to think more about appending/overwriting before merge.

@jameslamb
Copy link
Member Author

/merge

@rapids-bot rapids-bot bot merged commit 89b6f27 into main Mar 5, 2026
3 checks passed
@jameslamb jameslamb deleted the generate-pip-constraints branch March 5, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Introduces a breaking change improvement Improves an existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants