Skip to content

Conversation

@elliot-barn
Copy link
Contributor

@elliot-barn elliot-barn commented Nov 5, 2025

Sorting requirements and constraints for raydepsets

Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
@elliot-barn elliot-barn requested a review from a team as a code owner November 5, 2025 22:43
@elliot-barn elliot-barn requested a review from aslonnie November 5, 2025 22:43
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces sorting for flags, requirements, and constraints when generating dependency lock files with raydepsets. This is a valuable change for ensuring deterministic and reproducible builds in the CI environment. The core logic change in ci/raydepsets/cli.py is correct, and the updated lock files reflect the intended deterministic ordering. I have one minor suggestion to improve the code's conciseness.

Comment on lines +324 to 325
for requirement in sorted(requirements):
args.extend([requirement])
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This loop can be made more concise and Pythonic. Instead of iterating through the sorted requirements and appending them one by one, you can use list.extend() to add all of them in a single operation.

            args.extend(sorted(requirements))

args.extend(["-c", constraint])
if requirements:
for requirement in requirements:
for requirement in sorted(requirements):
Copy link

Choose a reason for hiding this comment

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

Bug: Dependency resolution breaks with sorted requirements files

Sorting requirements files alphabetically can change dependency resolution behavior. The order of requirements files matters in pip/uv because later files can override or add constraints from earlier files. By sorting the requirements list, files that were intentionally ordered (e.g., base requirements before specific overrides) may be processed in the wrong order, potentially leading to different dependency versions being resolved. For example, docker/base-deps/requirements.in will now be processed before release/ray_release/byod/ray_dev_py3.10.in due to alphabetical sorting, which may not be the intended precedence order.

Fix in Cursor Fix in Web

@ray-gardener ray-gardener bot added the devprod label Nov 6, 2025
args.extend(["--cache-dir", self._uv_cache_dir])
if override_flags:
args = _override_uv_flags(override_flags, args)
args = _override_uv_flags(sorted(override_flags), args)
Copy link
Collaborator

Choose a reason for hiding this comment

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

any unit test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing the flag sorting in preparation of building the flag class to handle defaulting, removal and setting flags

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added unit tests for requirements and constraints

Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
@elliot-barn elliot-barn changed the title [ci] sorting flags, reqs, and constraints for raydepsets [ci] sorting requirements, and constraints for raydepsets Nov 6, 2025
@elliot-barn elliot-barn changed the title [ci] sorting requirements, and constraints for raydepsets [ci] sorting requirements and constraints for raydepsets Nov 6, 2025
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
@elliot-barn elliot-barn requested a review from aslonnie November 6, 2025 18:21
@aslonnie aslonnie added the go add ONLY when ready to merge, run all tests label Nov 6, 2025
@aslonnie aslonnie self-requested a review November 6, 2025 19:25
@aslonnie aslonnie enabled auto-merge (squash) November 6, 2025 19:25
@aslonnie aslonnie merged commit 342bd78 into master Nov 6, 2025
8 checks passed
@aslonnie aslonnie deleted the elliot-barn/raydepsets-sort-reqs-and-constraints branch November 6, 2025 20:52
YoussefEssDS pushed a commit to YoussefEssDS/ray that referenced this pull request Nov 8, 2025
…#58414)

Sorting requirements and constraints for raydepsets

---------

Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
landscapepainter pushed a commit to landscapepainter/ray that referenced this pull request Nov 17, 2025
…#58414)

Sorting requirements and constraints for raydepsets

---------

Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Aydin-ab pushed a commit to Aydin-ab/ray-aydin that referenced this pull request Nov 19, 2025
…#58414)

Sorting requirements and constraints for raydepsets

---------

Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
ykdojo pushed a commit to ykdojo/ray that referenced this pull request Nov 27, 2025
…#58414)

Sorting requirements and constraints for raydepsets

---------

Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Signed-off-by: YK <1811651+ykdojo@users.noreply.github.com>
SheldonTsen pushed a commit to SheldonTsen/ray that referenced this pull request Dec 1, 2025
…#58414)

Sorting requirements and constraints for raydepsets

---------

Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devprod go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants