feat(build): let a plugin own a package's install command - #6
Merged
Conversation
The install command template is an index-wide string, so it can only say what is true of every package. That is the right default, but some ecosystems need the line to vary per package. dsh-index is the case that surfaced it. Its packages install through the ecosystem's own tool, and the spec differs per package: a bundle published to npm installs by name and version, while an unpublished neighbour -- 50 of its 68 packages -- installs from a pinned git commit. No single template covers both, and only the plugin knows which applies. _install_commands ran after every plugin hook and assigned unconditionally, so a plugin that set the command in on_package had it silently overwritten. That reads as the plugin API being ignored rather than as a precedence rule. It now skips a package whose command is already set. A package no plugin claims still gets the template, so opting one package in does not opt the whole index out.
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.
Summary
The
install_command_templateis one index-wide string, so it can only express what is true of every package. Some ecosystems need this line to vary per package.The case that surfaced it is
dsh-index, whose packages install through the ecosystem's own tool with a per-package spec:dsh plugin --profile web add dsh-cc-tui@0.1.6dsh plugin --profile web add github:owner/repo#<40-hex>No single template covers both, and only the plugin knows which applies.
_install_commandsruns after every plugin hook and assigned unconditionally, so a plugin that set the command inon_packagehad it silently overwritten — the plugin API appearing to be ignored rather than a documented precedence rule.It now skips a package whose command is already set.
Test plan
test_plugin_may_own_the_install_command: a plugin claims one of the fixture's two packages. The claimed one keeps its command; the unclaimed one still gets the template, so opting one package in does not opt the whole index out.python3 -m pytest tests/ -q→ 46 passed.