Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor constraints module #537

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

tiran
Copy link
Collaborator

@tiran tiran commented Jan 23, 2025

Refactor and modify the API of fromager.constraints module to prepare the code for multiple constraints files.

The Constraints class no longer takes an mapping of package name to Requirement. Instead it has a new method add_constraints() that takes one or more requirements strings. The method does not take Requirements object, because we might want to modify and merge constraints in the future.

The load() module-level function has been replaced by Constraints.load_constraints_file() method.

@mergify mergify bot added the ci label Jan 23, 2025
@tiran tiran force-pushed the refactor-constraints branch from 8aa89b9 to 70d6955 Compare January 23, 2025 12:56
@tiran tiran requested a review from dhellmann January 23, 2025 13:14
@tiran tiran force-pushed the refactor-constraints branch from 70d6955 to 28d5be0 Compare January 23, 2025 13:17
Copy link
Member

@dhellmann dhellmann left a comment

Choose a reason for hiding this comment

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

This looks good, just one question before I approve.

src/fromager/constraints.py Outdated Show resolved Hide resolved
src/fromager/constraints.py Outdated Show resolved Hide resolved
Refactor and modify the API of `fromager.constraints` module to prepare
the code for multiple constraints files.

The `Constraints` class no longer takes an mapping of package name to
`Requirement`. Instead it has a new method `add_constraint()` that takes
a requirements strings. The method does not take a `Requirements` object,
because we might want to modify and merge constraints in the future.

The `load()` module-level function has been replaced by
`Constraints.load_constraints_file()` method.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
@tiran tiran force-pushed the refactor-constraints branch from 28d5be0 to a3cf190 Compare January 23, 2025 15:03
@mergify mergify bot merged commit d7f5395 into python-wheel-build:main Jan 23, 2025
74 checks passed
@tiran tiran deleted the refactor-constraints branch January 24, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants