Let a project override the PyPI to conda name map - #21
Merged
Conversation
The vendored table only covers what conda-forge knows about. A project depending on distributions packaged elsewhere had no way to say how those names translate, short of waiting for the table to be regenerated. Add two optional tables to the [tool.nepenthe] stanza. package-mappings renames a distribution, taking precedence over the vendored entry. extras-mappings maps a requirement's extras group onto several conda packages, which a rename cannot express: conda has no equivalent of an extras group, so a distribution that splits its optional features into separate packages is a one-to-many translation. parse_requirement now returns the extras group instead of discarding it. check requires every package an extras group expands to, reporting the first that is missing or in conflict, and try adds one spec per package. An extras group with no mapping still resolves to the distribution name alone, so existing behaviour is unchanged.
Test Results189 tests +7 189 ✅ +7 8s ⏱️ +2s Results for commit 0925860. ± Comparison against base commit d5202b1. This pull request removes 1 and adds 8 tests. Note that renamed tests count towards both. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The vendored PyPI→conda table only covers what conda-forge knows about. A project depending on distributions packaged elsewhere — or packaging its own — had no way to say how those names translate, short of waiting for the table to be regenerated from grayskull.
Adds two optional tables to the
[tool.nepenthe]stanza:package-mappingsrenames a distribution, taking precedence over the vendored entry (or supplying one where there is none).extras-mappingscovers a case a rename cannot express. conda has no equivalent of a PyPI extras group, so a distribution that splits its optional features into separate conda packages is a one-to-many translation.parse_requirementpreviously discarded the extras group outright, which made this invisible.Behaviour
checkrequires every package an extras group expands to, reporting the first that is missing or in conflict.tryadds one conda spec per package, each carrying the requirement's specifier.extras-mappingskey with no[…]group is ignored.try --projectreads both tables without requiring the rest of the stanza.API
check_dependenciesandrequirements_to_conda_specstake a&name_map::Overrides;parse_requirementreturns the extras group. New:name_map::Overrides,name_map::extras_key,ProjectRef::name_overrides,project::read_name_overrides. The Python surface is unchanged.