Skip to content

Allow bytes-like inputs in MarkItDown.convert#1588

Open
lavish0000 wants to merge 1 commit intomicrosoft:mainfrom
lavish0000:fix/bytes-input-287
Open

Allow bytes-like inputs in MarkItDown.convert#1588
lavish0000 wants to merge 1 commit intomicrosoft:mainfrom
lavish0000:fix/bytes-input-287

Conversation

@lavish0000
Copy link

Closes #287

Summary:

  • accept bytes, bytearray, and memoryview inputs in MarkItDown.convert()
  • route bytes-like inputs through io.BytesIO so they follow the existing stream conversion path
  • add a regression test covering all supported bytes-like inputs

Testing:

  • uv run --project packages/markitdown --with pytest,mypy python -m pytest packages/markitdown/tests/test_module_misc.py -k 'bytes_like or input_as_strings'
  • uv run --project packages/markitdown --with ruff python -m ruff check packages/markitdown/src/markitdown/_markitdown.py packages/markitdown/tests/test_module_misc.py
  • uv run --project packages/markitdown --with ruff python -m ruff format --check packages/markitdown/src/markitdown/_markitdown.py packages/markitdown/tests/test_module_misc.py

Note:

  • running targeted mypy against this package in this checkout still surfaces pre-existing unrelated issues in untouched files, so I limited type-check validation to the touched path plus the regression test.

@lavish0000
Copy link
Author

@microsoft-github-policy-service agree

1 similar comment
@lavish0000
Copy link
Author

@microsoft-github-policy-service agree

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.

Please allow bytestream as an argument to convert

1 participant