-
-
Notifications
You must be signed in to change notification settings - Fork 281
feat(plugins): Switch to an importlib.metadata.EntryPoint-based plugin loading #632
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
Conversation
Fantastic PR! Thanks a lot for the contribution. Could you add some documentation? As you can see this would be outdated: https://commitizen-tools.github.io/commitizen/customization/#2-customize-through-customizing-a-class And if possible a migration guide from the old system, on that same page. |
8276b11
to
8e0c6f5
Compare
Sorry, the branch wasn't up to date and was missing the documentation part. |
8e0c6f5
to
26707d6
Compare
There it is, migration section added 👍🏼 |
Looks like we'll need to wait for #633 for the CI ? |
Yes, as soon as #633 is merged, I'll rebase this PR to pass the CI (I also have some other PR not yet submitted) |
91ca554
to
741339f
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## v3 #632 +/- ##
=====================================
Coverage ? 98.42%
=====================================
Files ? 39
Lines ? 1650
Branches ? 0
=====================================
Hits ? 1624
Misses ? 26
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
803740c
to
d5048ef
Compare
Retargetted and rebased on
|
d5048ef
to
dbd27d3
Compare
…n loading Plugins are now loaded using the `commitizen.plugin` entrypoint while legacy plugin are not loaded anymore but a warning is raised when one is seen. Fixes commitizen-tools#495 BREAKING CHANGE: Plugins are now exposed as `commitizen.plugin` entrypoints
dbd27d3
to
83cb00e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mechanism looks so great! @woile I plan to merge it later this week. Let me know if you want to take a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks a lot 💪🏻
Hi @noirbizarre I'm trying to install the plugins and test it locally. How did you do it on your local side? |
It depends:
I did the migration on https://github.com/noirbizarre/emotional but did not yet push because |
I somehow solve it on my side. Just pushed the latest v3 🙌 |
Description
This PR is proposal implementation for #495
It switches to an
importlib.metadata.EntryPoint
-based plugin loading instead of pattern matching on the module name.Plugins are now loaded using the
commitizen.plugin
entrypoint while legacy plugins are not loaded anymore but a warning is raised for each legacy plugin seen.BREAKING CHANGE: Plugins are now exposed as
commitizen.plugin
entrypointsChecklist
./scripts/format
and./scripts/test
locally to ensure this change passes linter check and testExpected behavior
Internal plugins are exposed as
commitizen.plugin
entrypoint. and seen as plugins.External plugins are seen too as soon as they are exposed as
commitizen.plugin
entrypoint.Legacy plugins are not loaded and a warning is raised for each legacy plugin detected.
Steps to Test This Pull Request
Try to use any internal plugin without changes in configuration: should work
Try a legacy plugin: KO
Try a plugin migrated to the
commitizen.plugin
: should workAdditional context
I chose not to have a deprecation warning on this because:
cz_
namingdiscover_this
and entrypoint expose raise a bit the complexityBut I can switch to this if required:
Fixes #495