refactor: Move from `variant`+`name` to a unique `plugin_id`
See original GitHub issueBackground
In the early days of Meltano, we managed all supported Meltano plugins in a single discovery.yml
file. At that time, we had <40 taps, whereas this week (2022-11-28) we have 400+ unique plugins on the hub, with about a thousand total registrations variants.
The initial plugin_name
was expanded to support a variant
qualifier, which we defaulted to the organization or user name matching the owner ID of the repo in GitHub or GitLab.
Reasons to change
- A single
plugin_id
string orplugin_ref
URL would simplify project maintenance. Plugins would still havename
values inmeltano.yml
but there’d be a looser expectation around the name having unique significance outside of themeltano.yml
file itself.
Proposal
In place of the current {plugin_name
, variant
}, adopt a new unique identifier such as plugin_id
or just use the existing ref
as the ID.
In place of…
plugins:
extractors:
- name: tap-github
variant: meltanolabs
#...
We’d have:
plugins:
extractors:
- name: tap-github
id: tap-github--meltanolabs
#...
Or perhaps better:
plugins:
extractors:
- name: tap-github
ref: https://hub.meltano.com/meltano/api/v1/plugins/extractors/tap-github--meltanolabs
#...
Or we could let the local lock file name server as the ID, which itself could still reference back to the remote Meltano Hub URL ref:
plugins:
extractors:
- name: tap-github
ref: plugins/extractors/tap-github--meltanolabs.lock
#...
Backwards compatibility
Backwards compatibility could be accomplished by making the new ID or Ref field optional, and when missing, calculating it on the fly as '{plugin_id}--{variant}'
or 'meltano://{plugin_id}:{variant}'
or similar.
Migrated from GitLab: https://gitlab.com/meltano/hub/-/issues/213
Originally created by @aaronsteers on 2022-03-11 17:28:32
Original thread
Wanted to log this question as related to the new tap-gitlab port. I created the new port as a fresh branch under the MeltanoLabs GitHub project. I’m not sure if I’ll be able to 100% match the prior behavior and at the same time, the tap can be “working” well for newer user cases.
The ideal delivery mechanism is probably to get reasonable amount of backwards compatibility but not 100%, and then publish as a variant name like meltanolabs-2
or similar. This would be a break from our current naming though, since the variant names today are expected to be exactly the same as the org name in GitHub or GitLab.
@tayloramurphy - Thoughts on this?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
@aaronsteers I like that plan. I’d only add
--variant
flag inmeltano add
would need to come between 2 and 3 abovevariant
is set in the plugin definition after 2 is implemented?Also, the Hub is deeply coupled with variants since they’re used to group plugins for the same domain, e.g.
tap-github
. So, it may require a change to the data model to group them by domain instead. Wdyt?@edgarrmondragon and @tayloramurphy - I think there’s an order we could roll this out so that it would not need to be a breaking change.
This might not be the shortest path to resolution, but the below implementation path would (in theory) be incrementally deliverable.
plugin_id
property for plugins in Meltano.plugin_id
would be defined as a property using the pseudocodereturn self._plugin_id
orf"{plugin_name}--{variant}"
. In other words,plugin_id
would always be non-null and would default to our current naming convention for lock files and the Hub JSON API.${MELTANO_PROJECT_ROOT}/plugin/{plugin_id}.lock
, which is equivalent to it’s current definition:${MELTANO_PROJECT_ROOT}/plugin/{plugin_name}--{variant_name}.lock
.plugin_id
is specified explicitly, theplugin_id
value will have precedence over the calculated default value ({plugin_name}--{variant_name}
).meltano add
to ignorevariant
and instead register new plugins inmeltano.yml
usingplugin_id
.meltano.yml
viameltano add
, the plugins will not get avariant
key but instead they will get aplugin_id
key.{name: tap-github, variant: meltanolabs}
, the same plugin would be added using the identifiers{name: tap-github, plugin_id: tap-github--meltanolabs}
.1
above is already implemented, so that an explicitplugin_id
value take precedence over the concatenation"{plugin_name}--{variant_name}"
.plugin_name
is purely cosmetic or referential in function.plugin_name
should be more or less cosmetic at, at least for all plugins that have aplugin_id
explicitly defined.plugin_id
is set, the user should be free to changeplugin_name
to whatever they want, without breaking the link to the lock file - except for two cases:inherits_from
relationships (if any). In other words, anyinherits_from
relationships will continue to inherit from sibling plugins via matching onplugin_name
. This is important becauseinherits_from
relationships inheritconfig
as well asplugin_id
, as well as other plugin-related descriptors defined inmeltano.yml
.tap-github
totap-my-git-project
, then this also changes the expected env var prefix fromTAP_GITHUB_
toTAP_MY_GIT_PROJECT_
.plugin_name
duringmeltano add
, then initializeplugin_name
with the value fromplugin_id
.plugin_id
itself is already taken, use{plugin_id}_{n}
as the name, where n is the lowest possible whole number that resolves the name collision.name
is purely cosmetic and referential at this point, we can initializename
to any valid string, and we can allow users to then changename
to whatever they want.