Skip to content
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

Clarify versioning blueprints in plugins #169

Closed
wants to merge 1 commit into from

Conversation

Flix6x
Copy link
Contributor

@Flix6x Flix6x commented Sep 1, 2021

Make it clear that plugins version blueprints, and, in case there are multiple blueprints, show the blueprint versions in the UI footer.

In case of a plugin with a single blueprint, it shows up as <plugin name> (v<blueprint_version>)) (the blueprint version is reported as the plugin version, which was the behaviour we had before):
image
In case of a plugin with multiple blueprints, it shows up as <plugin name> (<blueprint_name> v<blueprint_version>)):
image

…prints, show the blueprint versions in the UI footer
Comment on lines +75 to +76
f"{p_name} ({'v' + [v for v in p_bp_dict.values()][0] if len(p_bp_dict) == 1 else ', '.join(bp_name + ' v' + bp_version for bp_name, bp_version in p_bp_dict.items())})"
for p_name, p_bp_dict in current_app.config.get("LOADED_PLUGINS", {}).items()
Copy link
Contributor Author

@Flix6x Flix6x Sep 1, 2021

Choose a reason for hiding this comment

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

I can clean this up with a util function, but I first wanted to get your opinion on plugin/blueprint versioning, @nhoening.

@Flix6x Flix6x self-assigned this Sep 1, 2021
@Flix6x Flix6x requested a review from nhoening September 1, 2021 13:41
@nhoening
Copy link
Contributor

nhoening commented Sep 1, 2021

I can accept that a plugin author might want to organise their code using multiple blueprints, but my first reaction to this PR is that one version should suffice per plugin. We don't have multiple versions in FlexMeasures, either.

@Flix6x
Copy link
Contributor Author

Flix6x commented Sep 1, 2021

So perhaps we shouldn't define the plugin version based on the (first) blueprint version? Is there a good alternative for where/how to specify the plugin version?

Otherwise, we could revert to mandating only a single blueprint per plugin (i.e. partially revert #164).

@nhoening
Copy link
Contributor

nhoening commented Sep 1, 2021

Maybe the __version__ attribute can live right on the __init__ module?

@nhoening
Copy link
Contributor

nhoening commented Sep 1, 2021

(I'm not 100% sure why I placed it on the blueprint, but maybe I simply thought there'll be just one which defines the whole plugin so it's a fitting place).

(Btw, I also believe my idea was that having only one blueprint with strict naming tied to the plugin could avoid possible naming conflicts with other blueprints from within FM or other plugins ― can that happen to us now?)

@nhoening
Copy link
Contributor

nhoening commented Sep 2, 2021

I also believe this can merge into main, as it isn't connected to what the views-by-accounts branch is doing.

@Flix6x
Copy link
Contributor Author

Flix6x commented Sep 3, 2021

  • 👍 One version per plugin (not per blueprint).
  • Indeed, registered blueprint names should be unique. But I didn't touch the blueprint name, just the blueprint's import name (used for internal logic), as recommended by https://exploreflask.com/en/latest/blueprints.html.

Moved to #171

@Flix6x Flix6x closed this Sep 3, 2021
@Flix6x Flix6x deleted the fix-plugin-versioning branch March 1, 2022 00:19
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.

None yet

2 participants