Title: Scan for providers using metadata.entry_points in init · Issue #1258 · commitizen-tools/commitizen · GitHub
Open Graph Title: Scan for providers using metadata.entry_points in init · Issue #1258 · commitizen-tools/commitizen
X Title: Scan for providers using metadata.entry_points in init · Issue #1258 · commitizen-tools/commitizen
Description: Description Currently, when running the cz init command, Commitizen scans for plugins using the registry populated by metadata.entry_points(group="commitizen.plugin") in commitizen/cz/__init__.py. However, for providers, while the cz ver...
Open Graph Description: Description Currently, when running the cz init command, Commitizen scans for plugins using the registry populated by metadata.entry_points(group="commitizen.plugin") in commitizen/cz/__init__.py. ...
X Description: Description Currently, when running the cz init command, Commitizen scans for plugins using the registry populated by metadata.entry_points(group="commitizen.plugin") in commitizen/cz/__i...
Opengraph URL: https://github.com/commitizen-tools/commitizen/issues/1258
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Scan for providers using metadata.entry_points in init","articleBody":"### Description\n\nCurrently, when running the ```cz init``` command, Commitizen scans for plugins using the registry populated by ```metadata.entry_points(group=\"commitizen.plugin\")``` in ```commitizen/cz/__init__.py```.\r\n\r\nHowever, for providers, while the ```cz version``` command scans and detects third-party providers dynamically, the ```cz init``` command relies on a fixed list of providers. This makes it difficult to discover or configure new providers during the initialization process.\r\n\r\nTo improve usability, cz should implement dynamic discovery of providers during ```cz init```, similar to how third-party plugins are handled, allowing for easier integration of new or custom providers.\r\n\r\nI have locally implemented the feature and I'd be willing to provide a PR if possible. \r\n\n\n### Possible Solution\n\nCreate a similar registry for providers and populate it using metadata.entry_points(group=\"commitizen.provider\"). Concatenate the results with the hardcoded one in (commitizen/commands/init.py:227)\r\n\r\n## commitizen/cz/__init__.py\r\n```python\r\ndef discover_providers() -\u003e dict[str, type[VersionProvider]]:\r\n \"\"\"Discover commitizen version providers on the path\r\n\r\n Returns:\r\n Dict[str, Type[VersionProvider]]: Registry with found version providers\r\n \"\"\"\r\n\r\n return {\r\n ep.name: ep.load() for ep in metadata.entry_points(group=\"commitizen.provider\")\r\n }\r\n\r\nversioner: dict[str, type[BaseCommitizen]] = discover_providers()\r\n```\r\n\r\n## commitizen/commands/init.py - line 236\r\n```python\r\n opts = list(versioner.keys())\r\n # Merge\r\n OPTS.update(\r\n {opt: f\"{opt}: Get and set version from {opt}\" for opt in opts})\r\n```\n\n### Additional context\n\n_No response_\n\n### Additional context\n\n_No response_","author":{"url":"https://github.com/dhmmasson","@type":"Person","name":"dhmmasson"},"datePublished":"2024-10-14T18:02:07.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1258/commitizen/issues/1258"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:022f6446-37ee-b929-0b46-1d62087ea63d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B356:7DC64:552909:7BEE55:6A4E0924 |
| html-safe-nonce | f9f21dc375579e118307ee2b1c20d8b43077730c74d8da7919077c4b5f1cce95 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzU2OjdEQzY0OjU1MjkwOTo3QkVFNTU6NkE0RTA5MjQiLCJ2aXNpdG9yX2lkIjoiNjQ3NDc5MDM3MDE5MDE2NjMwOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4ed6877e09012f295d4d1686a508face8721164bba923bf6e30129c56936be68 |
| hovercard-subject-tag | issue:2586711858 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/commitizen-tools/commitizen/1258/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8b2c295a1ede1665f10ead9505c4837100d1f1b10b592f90ea93d7491b7d6fb7/commitizen-tools/commitizen/issues/1258 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8b2c295a1ede1665f10ead9505c4837100d1f1b10b592f90ea93d7491b7d6fb7/commitizen-tools/commitizen/issues/1258 |
| og:image:alt | Description Currently, when running the cz init command, Commitizen scans for plugins using the registry populated by metadata.entry_points(group="commitizen.plugin") in commitizen/cz/__init__.py. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dhmmasson |
| hostname | github.com |
| expected-hostname | github.com |
| None | df0492960db29b4938cb72070351d6b1d0c6c0767b27ceb8394bbf4fcc0223c6 |
| turbo-cache-control | no-preview |
| go-import | github.com/commitizen-tools/commitizen git https://github.com/commitizen-tools/commitizen.git |
| octolytics-dimension-user_id | 62252524 |
| octolytics-dimension-user_login | commitizen-tools |
| octolytics-dimension-repository_id | 106127589 |
| octolytics-dimension-repository_nwo | commitizen-tools/commitizen |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 106127589 |
| octolytics-dimension-repository_network_root_nwo | commitizen-tools/commitizen |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 52bde38e24398476f8eb1e0760c81346c6a00812 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width