Repository navigation
Speed up CLI help by deferring conversion imports - #2493
Open
Çağdaş Yürekli (cagdasyurekli) wants to merge 1 commit into
Open
Çağdaş Yürekli (cagdasyurekli) wants to merge 1 commit into
Çağdaş Yürekli (cagdasyurekli) wants to merge 1 commit into
Conversation
Çağdaş Yürekli (cagdasyurekli)
force-pushed
the
fix/1438-cli-startup
branch
from
October 6, 2026 10:59
b79762b to
9f43b1c
Compare
Contributor
Author
|
Rebased onto current main ( Validation: Black 23.7.0 and git diff --check pass; core pytest: 1059 passed, 57 skipped (repository CI skip policy). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
markitdown --helpcurrently imports the conversion engine and its dependencies before argparse can exit. Defer the engine exports in the package initializer and importMarkItDownin the CLI only after argument parsing and plugin listing.This keeps the existing package, console entry point, and public Python exports, including wildcard imports and
dir(markitdown). Conversion still uses the same engine. No new dependencies are added.Addresses the startup-performance problem in #1438. The separate argcomplete suggestion is left for a follow-up.
Validation
python -m markitdown --help682 ms → 55 ms,--version675 ms → 55 ms. These are local measurements, not timing assertions in the tests.GITHUB_ACTIONS=true hatch test(Python 3.12): 872 passed, 43 skipped using the repository's CI skip policy and environment-dependent skips.pre-commit run --all-files: passed;git diff --cached --check: passed.