Skip to content

New API bits for pip: plugin loading, and wheel file supported check #87

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 8 commits into from
May 8, 2025

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented May 7, 2025

Quite a big and not yet complete: I still need to add more checks and tests.

  1. With this change, we have three metadata classes:
    • DistMetadata for distribution METADATA files
    • VariantPyProjectToml for pyproject.toml
    • VariantsJson for variants.json
  2. All of them derive from shared VariantMetadata model that covers the common bits, plus have their own extra fields.
  3. PluginLoader now has a constructor that accepts any VariantMetadata subclass and loads plugins from it.
  4. For get_variant_hashes_by_priority(), plugin_loader is now optional, so you can either pass your own or let it load plugins from variants.json. This is similar to Variant Plugin Auto install #86 but it preserves the ability to provide custom loader, which will probably be useful for pip isolated envs.
  5. There is a new check_variant_supported() function that can be used to check whether a single variant description can be installed — now used by pip when installing local files.

The classes are pretty robust now, and I think we will use them in the future to reimplement some of the commands that now inline metadata reading and writing.

@mgorny mgorny requested a review from DEKHTIARJonathan May 7, 2025 19:24
@mgorny mgorny marked this pull request as ready for review May 8, 2025 14:38
@mgorny mgorny force-pushed the new-pip-api branch 2 times, most recently from 5fdf3ec to 2ef6a3c Compare May 8, 2025 16:50
@DEKHTIARJonathan DEKHTIARJonathan merged commit bbbd107 into dev May 8, 2025
44 checks passed
@DEKHTIARJonathan DEKHTIARJonathan deleted the new-pip-api branch May 8, 2025 22:37
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