Skip to content

[Resolver] Basic Logic for Filtering & Sorting added #25

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

Merged
merged 9 commits into from
Apr 18, 2025

Conversation

DEKHTIARJonathan
Copy link
Member

@DEKHTIARJonathan DEKHTIARJonathan commented Apr 4, 2025

This PR introduces the basis for the variant resolver inside variantlib.

It attempts to define a start of User Configuration file format:

variants.toml:

# ============= Top-Most Priority ============= #

# 1. Define the variant properties `VariantProperty` to "bump to the top of the priority list"
#     Expected format: "namespace::feature::value"
# OPTIONAL: In most cases - the user will not specify the following
# Note: This is a lazy-list: Only specify the ones you want to "bump up" to the top of the list
property_priority = [
    "fictional_hw::architecture::mother",
    "fictional_tech::risk_exposure:25",
]

# ============= Second-Most Priority ============= #

# 2. Define the variant features: `VariantFeature` to "bump to the top of the priority list" 
#     These come after the ones defined in 1) [`property_priority`]
# Expected format: "namespace::feature"
# OPTIONAL: In most cases - the user will not specify the following
# Note: This is a lazy-list: Only specify the ones you want to "bump up" to the top of the list
features_priority = [
    "fictional_hw::architecture",
    "fictional_tech::risk_exposure",
    "simd_x86_64::feature3",
]

# ============= Default Priority Ordering ============= #

# 3. Define the variant namespaces by priority
# MANDATORY: as long as there is more than 1 variant plugin installed. This field must be specified
#                          If not one installed plugin is missing => should error out. 
#                          Namespaces can be specified but not installed.
namespaces_priority = [
    "fictional_hw",
    "fictional_tech",
    "simd_x86_64",
    "non_existent_provider",
]

Open Question:

  • The user configuration detection relies on the "third-party library" platformdirs. Shouldn't be a problem given that pip already vendors it: https://github.com/pypa/pip/tree/main/src/pip/_vendor/platformdirs. Do we agree on that ?
  • Same remark with tomllib unsupported with Python < 3.11 - Already vendored in pip under: import pip._vendor.tomli as tomllib

@DEKHTIARJonathan DEKHTIARJonathan requested a review from mgorny April 4, 2025 20:12
@DEKHTIARJonathan DEKHTIARJonathan self-assigned this Apr 4, 2025
@DEKHTIARJonathan
Copy link
Member Author

This PR is linked to the following discussion: wheelnext/pep_xxx_wheel_variants#21

@DEKHTIARJonathan DEKHTIARJonathan marked this pull request as draft April 4, 2025 21:12
@DEKHTIARJonathan DEKHTIARJonathan force-pushed the sorting_and_filtering branch 6 times, most recently from 8b3e895 to 43d7a07 Compare April 6, 2025 19:49
Copy link
Contributor

@mgorny mgorny left a comment

Choose a reason for hiding this comment

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

Hm, do I understand correctly that this currently only accounts for explicit namespace, feature, property priorities specified by user, but doesn't define fallback feature and property priorities based on the order returned by plugins?

@DEKHTIARJonathan DEKHTIARJonathan force-pushed the sorting_and_filtering branch 6 times, most recently from 884d20b to 513a11c Compare April 16, 2025 21:04
@DEKHTIARJonathan DEKHTIARJonathan marked this pull request as ready for review April 17, 2025 15:35
@DEKHTIARJonathan DEKHTIARJonathan merged commit b56a879 into main Apr 18, 2025
16 checks passed
@DEKHTIARJonathan DEKHTIARJonathan deleted the sorting_and_filtering branch April 18, 2025 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants