Repository navigation
fix(cli): correct external plugin discovery - #4676
M-Hassan-Raza wants to merge 9 commits into
Conversation
Signed-off-by: Hassan Raza <raihassanraza10@gmail.com>
Signed-off-by: Hassan Raza <raihassanraza10@gmail.com>
Signed-off-by: Hassan Raza <raihassanraza10@gmail.com>
Signed-off-by: Hassan Raza <raihassanraza10@gmail.com>
Signed-off-by: Hassan Raza <raihassanraza10@gmail.com>
Signed-off-by: Hassan Raza <raihassanraza10@gmail.com>
Signed-off-by: Hassan Raza <raihassanraza10@gmail.com>
Signed-off-by: Hassan Raza <raihassanraza10@gmail.com>
|
✅ DCO Check Passed Thanks @M-Hassan-Raza, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit Fixes external plugin discovery in the CLI: moves plugin loading after argument parsing, adds picture-description engines to `--show-external-plugins`, stores each plugin's distribution name in `FactoryMeta`, propagates `allow_external_plugins` to all format options before constructing `DocumentConverter`, and removes module-import-time factory construction that caused `--help` to load plugins. CI safety: needs maintainer care before you approve CI.
3 related pull request(s) in the same code
The |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
dolfim-ibm
left a comment
There was a problem hiding this comment.
The fix is right, and the new subprocess tests in tests/test_factory_plugins.py fail on main for the expected reasons. One change requested before merge.
Apply the plugin policy before building the converter, not after.
The loop that sets allow_external_plugins currently runs on doc_converter.format_to_options after DocumentConverter(...) returns. Because of that, every fake converter in tests/test_cli.py and tests/test_ocr_language.py now needs self.format_to_options = format_options: 15 edits that only exist to support the post-construction mutation.
The CLI already knows the full format list: _expand_from_formats returns list(InputFormat) when --from is not given. So the default options can be filled in and the policy applied on the dict that is passed to the converter:
# Apply the CLI policy to every allowed format, including defaults.
for input_format in from_formats:
if input_format not in format_options:
format_options[input_format] = _get_default_option(input_format)
for format_option in format_options.values():
if format_option.pipeline_options is not None:
format_option.pipeline_options.allow_external_plugins = allow_external_plugins
doc_converter = DocumentConverter(
allowed_formats=from_formats,
format_options=format_options,
)The behavior stays the same: DocumentConverter.__init__ calls _get_default_option for each missing format anyway, and FormatOption.set_optional_field_default fills pipeline_options at creation. The fakes then receive a larger format_options dict. The existing assertions only read specific keys (PDF, IMAGE, AUDIO, VIDEO) and none checks that a key is absent, so the self.format_to_options = format_options edits in both test files can be reverted. test_cli_plugin_discovery still covers the default-format case end to end.
Signed-off-by: Hassan Raza <raihassanraza10@gmail.com>
|
@dolfim-ibm Please check now should be good hopefully |
Follow-up to the focused CLI fixes suggested in #3878.
Discover plugins after parsing the conversion policy, include picture-description engines in the plugin listing, and show each provider's distribution name. Fill default format options and apply the policy before constructing the converter, while preserving existing factory method signatures. Help no longer discovers plugins or lists built-in engine names; the generated CLI reference reflects that change.
230 targeted tests and changed-file checks pass locally. The full model-dependent suite was not run locally.