Python tool for converting files and office documents to Markdown.
Update Black, Pillow, and Windows ARM Cryptography baselines (#2731)
Adam Fourney3cf47504c5d3
diff --git a/.github/actions/build-arm-cryptography/action.yml b/.github/actions/build-arm-cryptography/action.ymlnew file mode 100644index 00000000..6a089870--- /dev/null+++ b/.github/actions/build-arm-cryptography/action.yml@@ -0,0 +1,30 @@+name: Build Windows ARM64 Cryptography+description: Provide a current native wheel to pip and Hatch until PyPI publishes one.+runs:+ using: composite+ steps:+ - name: Build OpenSSL and Cryptography+ shell: pwsh+ run: |+ $ErrorActionPreference = 'Stop'+ $vcpkgRoot = $env:VCPKG_INSTALLATION_ROOT+ & "$vcpkgRoot/vcpkg.exe" install openssl:arm64-windows-static-md+ if ($LASTEXITCODE -ne 0) { throw 'OpenSSL build failed' }++ $env:OPENSSL_DIR = "$vcpkgRoot/installed/arm64-windows-static-md"+ $env:OPENSSL_STATIC = '1'+ $env:CARGO_BUILD_TARGET = 'aarch64-pc-windows-msvc'+ rustup target add aarch64-pc-windows-msvc+ if ($LASTEXITCODE -ne 0) { throw 'Rust target installation failed' }++ $wheelhouse = Join-Path $env:RUNNER_TEMP 'cryptography-wheels'+ New-Item -ItemType Directory -Force -Path $wheelhouse | Out-Null+ python -m pip wheel --no-deps --no-binary cryptography --wheel-dir $wheelhouse -c "$env:GITHUB_WORKSPACE/.github/constraints.txt" cryptography+ if ($LASTEXITCODE -ne 0) { throw 'Cryptography wheel build failed' }+ if (-not (Get-ChildItem "$wheelhouse/cryptography-*-win_arm64.whl")) {+ throw 'Expected a native Windows ARM64 wheel'+ }++ # Hatch creates its own environment; make the wheel available to both installers.+ "PIP_FIND_LINKS=$wheelhouse" >> $env:GITHUB_ENV+ "UV_FIND_LINKS=$wheelhouse" >> $env:GITHUB_ENVdiff --git a/.github/constraints.txt b/.github/constraints.txtindex 55c1be3e..b99c5d21 100644--- a/.github/constraints.txt+++ b/.github/constraints.txt@@ -1,3 +1,3 @@-# Temporary CI workaround until Windows ARM64 wheels return.+# Build a current release locally until Windows ARM64 wheels return to PyPI.# https://github.com/pyca/cryptography/pull/15350-cryptography==46.0.3; sys_platform == "win32" and platform_machine == "ARM64"+cryptography==50.0.2; sys_platform == "win32" and platform_machine == "ARM64"diff --git a/.github/dependabot.yml b/.github/dependabot.ymlindex 6cc00712..3dcb028b 100644--- a/.github/dependabot.yml+++ b/.github/dependabot.yml@@ -6,3 +6,13 @@ updates:interval: "weekly"cooldown:default-days: 7+ - package-ecosystem: "pip"+ directories:+ - "/packages/markitdown"+ - "/packages/markitdown-mcp"+ - "/packages/markitdown-ocr"+ - "/packages/markitdown-sample-plugin"+ schedule:+ interval: "weekly"+ cooldown:+ default-days: 7diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex c653d523..0bd6ef99 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -29,6 +29,10 @@ jobs:with:python-version: ${{ matrix.python-version }}+ - name: Build native Cryptography wheel+ if: runner.os == 'Windows' && runner.arch == 'ARM64'+ uses: ./.github/actions/build-arm-cryptography+- name: Install media toolsif: runner.os == 'Linux'run: |@@ -64,6 +68,10 @@ jobs:with:python-version: ${{ matrix.python-version }}+ - name: Build native Cryptography wheel+ if: runner.os == 'Windows' && runner.arch == 'ARM64'+ uses: ./.github/actions/build-arm-cryptography+# Install markitdown from the local checkout rather than PyPI, so the# plugin is tested against the sibling package it ships alongside.- name: Install packages@@ -93,6 +101,10 @@ jobs:with:python-version: ${{ matrix.python-version }}+ - name: Build native Cryptography wheel+ if: runner.os == 'Windows' && runner.arch == 'ARM64'+ uses: ./.github/actions/build-arm-cryptography+- name: Install packagesrun: pip install "./packages/markitdown[all]" ./packages/markitdown-mcp pytestdiff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex 3ed7a92a..2545c773 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -1,5 +1,5 @@repos:- repo: https://github.com/psf/black- rev: 23.7.0 # Use the latest version of Black+ rev: 26.10.1hooks:- id: blackdiff --git a/packages/markitdown-mcp/tests/test_http_transports.py b/packages/markitdown-mcp/tests/test_http_transports.pyindex 9f364515..c4fd7c4d 100644--- a/packages/markitdown-mcp/tests/test_http_transports.py+++ b/packages/markitdown-mcp/tests/test_http_transports.py@@ -9,7 +9,6 @@ import httpx2 as httpxfrom markitdown_mcp.__main__ import create_starlette_app, mcp-BASE_URL = "http://127.0.0.1:3001"INITIALIZE = {"jsonrpc": "2.0",diff --git a/packages/markitdown-ocr/pyproject.toml b/packages/markitdown-ocr/pyproject.tomlindex ff38d735..9e2daf46 100644--- a/packages/markitdown-ocr/pyproject.toml+++ b/packages/markitdown-ocr/pyproject.toml@@ -34,7 +34,7 @@ dependencies = ["python-pptx","pandas","openpyxl",- "Pillow>=9.0.0",+ "Pillow>=12.1.1",]# llm_client is passed in by the user (same as for markitdown image descriptions);diff --git a/packages/markitdown-ocr/src/markitdown_ocr/_plugin.py b/packages/markitdown-ocr/src/markitdown_ocr/_plugin.pyindex f4d7bcf5..71173199 100644--- a/packages/markitdown-ocr/src/markitdown_ocr/_plugin.py+++ b/packages/markitdown-ocr/src/markitdown_ocr/_plugin.py@@ -12,7 +12,6 @@ from ._docx_converter_with_ocr import DocxConverterWithOCRfrom ._pptx_converter_with_ocr import PptxConverterWithOCRfrom ._xlsx_converter_with_ocr import XlsxConverterWithOCR-__plugin_interface_version__ = 1diff --git a/packages/markitdown-ocr/tests/test_docx_inheritance.py b/packages/markitdown-ocr/tests/test_docx_inheritance.pyindex 7cf02d70..8fa7f826 100644--- a/packages/markitdown-ocr/tests/test_docx_inheritance.py+++ b/packages/markitdown-ocr/tests/test_docx_inheritance.py@@ -18,7 +18,6 @@ import markitdown._markitdown as markitdown_modulefrom markitdown_ocr._docx_converter_with_ocr import DocxConverterWithOCRfrom markitdown_ocr._ocr_service import OCRResult-_INFO = StreamInfo(extension=".docx")diff --git a/packages/markitdown-ocr/tests/test_ocr_metadata.py b/packages/markitdown-ocr/tests/test_ocr_metadata.pyindex de7c6a27..d3b5b745 100644--- a/packages/markitdown-ocr/tests/test_ocr_metadata.py+++ b/packages/markitdown-ocr/tests/test_ocr_metadata.py@@ -13,7 +13,6 @@ from markitdown_ocr._ocr_service import OCRResult, _extract_text_with_metadatafrom markitdown_ocr._pptx_converter_with_ocr import PptxConverterWithOCRfrom markitdown_ocr._xlsx_converter_with_ocr import XlsxConverterWithOCR-_Converter = DocxConverterWithOCR | PptxConverterWithOCR | XlsxConverterWithOCR_CONVERTERS = [DocxConverterWithOCR, PptxConverterWithOCR, XlsxConverterWithOCR]_SVG = b'<svg xmlns="http://www.w3.org/2000/svg"><text>recognized</text></svg>'diff --git a/packages/markitdown-ocr/tests/test_pptx_inheritance.py b/packages/markitdown-ocr/tests/test_pptx_inheritance.pyindex 6ee3b89d..e2ac8a22 100644--- a/packages/markitdown-ocr/tests/test_pptx_inheritance.py+++ b/packages/markitdown-ocr/tests/test_pptx_inheritance.py@@ -20,7 +20,6 @@ import markitdown._markitdown as markitdown_modulefrom markitdown_ocr._ocr_service import LLMVisionOCRService, OCRResultfrom markitdown_ocr._pptx_converter_with_ocr import PptxConverterWithOCR-_INFO = StreamInfo(extension=".pptx")_CORE_FILES = Path(__file__).parents[2] / "markitdown" / "tests" / "test_files"diff --git a/packages/markitdown-ocr/tests/test_xlsx_inheritance.py b/packages/markitdown-ocr/tests/test_xlsx_inheritance.pyindex c94c8fac..c3b080c0 100644--- a/packages/markitdown-ocr/tests/test_xlsx_inheritance.py+++ b/packages/markitdown-ocr/tests/test_xlsx_inheritance.py@@ -25,7 +25,6 @@ import markitdown._markitdown as markitdown_modulefrom markitdown_ocr._ocr_service import OCRResultfrom markitdown_ocr._xlsx_converter_with_ocr import XlsxConverterWithOCR-_INFO = StreamInfo(extension=".xlsx")diff --git a/packages/markitdown-sample-plugin/src/markitdown_sample_plugin/_plugin.py b/packages/markitdown-sample-plugin/src/markitdown_sample_plugin/_plugin.pyindex f47bba6a..ced1fcd7 100644--- a/packages/markitdown-sample-plugin/src/markitdown_sample_plugin/_plugin.py+++ b/packages/markitdown-sample-plugin/src/markitdown_sample_plugin/_plugin.py@@ -9,7 +9,6 @@ from markitdown import (StreamInfo,)-__plugin_interface_version__ = (1 # The version of the plugin interface that this plugin uses)diff --git a/packages/markitdown/src/markitdown/__main__.py b/packages/markitdown/src/markitdown/__main__.pyindex 170308cf..37334ad9 100644--- a/packages/markitdown/src/markitdown/__main__.py+++ b/packages/markitdown/src/markitdown/__main__.py@@ -18,8 +18,7 @@ def main():description="Convert various file formats to markdown.",prog="markitdown",formatter_class=argparse.RawDescriptionHelpFormatter,- usage=dedent(- """+ usage=dedent("""SYNTAX:markitdown <OPTIONAL: FILENAME>@@ -44,8 +43,7 @@ def main():ORmarkitdown example.pdf > example.md- """- ).strip(),+ """).strip(),)parser.add_argument(diff --git a/packages/markitdown/src/markitdown/_stream_info.py b/packages/markitdown/src/markitdown/_stream_info.pyindex 84a1f640..9c38c81e 100644--- a/packages/markitdown/src/markitdown/_stream_info.py+++ b/packages/markitdown/src/markitdown/_stream_info.py@@ -11,9 +11,9 @@ class StreamInfo:mimetype: Optional[str] = Noneextension: Optional[str] = Nonecharset: Optional[str] = None- filename: Optional[- str- ] = None # From local path, url, or Content-Disposition header+ filename: Optional[str] = (+ None # From local path, url, or Content-Disposition header+ )local_path: Optional[str] = None # If read from diskurl: Optional[str] = None # If read from urldiff --git a/packages/markitdown/src/markitdown/converter_utils/_xlsx_images.py b/packages/markitdown/src/markitdown/converter_utils/_xlsx_images.pyindex bc26378d..3ea4bc3a 100644--- a/packages/markitdown/src/markitdown/converter_utils/_xlsx_images.py+++ b/packages/markitdown/src/markitdown/converter_utils/_xlsx_images.py@@ -12,7 +12,6 @@ from defusedxml import ElementTree as ETfrom .._stream_info import StreamInfofrom ._image import _parse_image_html-_NS = {"s": "http://schemas.openxmlformats.org/spreadsheetml/2006/main","r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",diff --git a/packages/markitdown/src/markitdown/converter_utils/docx/_images.py b/packages/markitdown/src/markitdown/converter_utils/docx/_images.pyindex 99ee670f..cd2ce1de 100644--- a/packages/markitdown/src/markitdown/converter_utils/docx/_images.py+++ b/packages/markitdown/src/markitdown/converter_utils/docx/_images.py@@ -12,7 +12,6 @@ from mammoth.docx.files import InvalidFileReferenceErrorfrom ..._stream_info import StreamInfofrom .._image import _parse_image_html-_BLOCK_ELEMENTS = HTMLTreeBuilder.DEFAULT_BLOCK_ELEMENTS | {"details","dialog",diff --git a/packages/markitdown/src/markitdown/converters/_markdownify.py b/packages/markitdown/src/markitdown/converters/_markdownify.pyindex ed341448..5b75075d 100644--- a/packages/markitdown/src/markitdown/converters/_markdownify.py+++ b/packages/markitdown/src/markitdown/converters/_markdownify.py@@ -4,7 +4,6 @@ import markdownifyfrom typing import Any, Optionalfrom urllib.parse import quote, urlparse, urlunparse-_PERCENT_ENCODED_OCTET = re.compile(r"%[0-9A-Fa-f]{2}")diff --git a/packages/markitdown/tests/test_cli_misc.py b/packages/markitdown/tests/test_cli_misc.pyindex 5e42b16b..708de303 100644--- a/packages/markitdown/tests/test_cli_misc.py+++ b/packages/markitdown/tests/test_cli_misc.py@@ -13,7 +13,6 @@ from markitdown import __version__from markitdown.__main__ import mainfrom markitdown.converters._cu_converter import ContentUnderstandingFileType-# CLI behavior# This file contains CLI tests that are not directly tested by the FileTestVectors.diff --git a/packages/markitdown/tests/test_csv.py b/packages/markitdown/tests/test_csv.pyindex d21742bf..fcfe82d7 100644--- a/packages/markitdown/tests/test_csv.py+++ b/packages/markitdown/tests/test_csv.py@@ -6,7 +6,6 @@ import pytestfrom markitdown import MarkItDown, StreamInfo-# Record separatorsdiff --git a/packages/markitdown/tests/test_cu.py b/packages/markitdown/tests/test_cu.pyindex 88d1b72e..a8764ebb 100644--- a/packages/markitdown/tests/test_cu.py+++ b/packages/markitdown/tests/test_cu.py@@ -22,7 +22,6 @@ from markitdown.converters._cu_converter import (_resolve_analyzer_modality,)-# Content Understanding# ---------------------------------------------------------------------------diff --git a/packages/markitdown/tests/test_docintel.py b/packages/markitdown/tests/test_docintel.pyindex 0e242652..2d494746 100644--- a/packages/markitdown/tests/test_docintel.py+++ b/packages/markitdown/tests/test_docintel.py@@ -8,7 +8,6 @@ from markitdown.converters._doc_intel_converter import (DocumentIntelligenceFileType,)-# Document Intelligencediff --git a/packages/markitdown/tests/test_docx.py b/packages/markitdown/tests/test_docx.pyindex 4fa67684..4b8f47ce 100644--- a/packages/markitdown/tests/test_docx.py+++ b/packages/markitdown/tests/test_docx.py@@ -35,7 +35,6 @@ from markitdown.converter_utils.docx.math.omml import OMML_NS, load_string, oMatfrom markitdown.converter_utils.docx.pre_process import _pre_process_stylesfrom markitdown.converters import DocxConverter, HtmlConverter, _docx_converter-# Math functions@@ -373,9 +372,7 @@ def styles_xml(request: pytest.FixtureRequest) -> bytes:<{prefix}:style {prefix}:type="paragraph" {prefix}:styleId="Normal"><{prefix}:name {prefix}:val="Normal"/></{prefix}:style>-</{prefix}:styles>""".encode(- "utf-8"- )+</{prefix}:styles>""".encode("utf-8")def test_valid_styles_are_returned_unchanged(styles_xml: bytes) -> None:diff --git a/packages/markitdown/tests/test_epub.py b/packages/markitdown/tests/test_epub.pyindex f87f4d44..37d0e713 100644--- a/packages/markitdown/tests/test_epub.py+++ b/packages/markitdown/tests/test_epub.py@@ -8,7 +8,6 @@ import pytestfrom markitdown import MarkItDown, StreamInfofrom markitdown.converters import EpubConverter-# Archive href resolutionCONTAINER_XML = """<?xml version="1.0"?>diff --git a/packages/markitdown/tests/test_files/generate_pdf_cleanup_fixtures.py b/packages/markitdown/tests/test_files/generate_pdf_cleanup_fixtures.pyindex d13a113c..ef198fc7 100644--- a/packages/markitdown/tests/test_files/generate_pdf_cleanup_fixtures.py+++ b/packages/markitdown/tests/test_files/generate_pdf_cleanup_fixtures.py@@ -8,7 +8,6 @@ from pathlib import Pathimport pymupdf-FIXTURES = Path(__file__).resolve().parentdiff --git a/packages/markitdown/tests/test_files/generate_pptx_missing_text_fixtures.py b/packages/markitdown/tests/test_files/generate_pptx_missing_text_fixtures.pyindex d738da6d..65ec4813 100644--- a/packages/markitdown/tests/test_files/generate_pptx_missing_text_fixtures.py+++ b/packages/markitdown/tests/test_files/generate_pptx_missing_text_fixtures.py@@ -8,7 +8,6 @@ from pathlib import Pathfrom pptx import Presentationfrom pptx.util import Inches-FIXTURES = Path(__file__).resolve().parent@@ -18,9 +17,9 @@ def _missing_text_presentation() -> Presentation:slide = presentation.slides.add_slide(presentation.slide_layouts[1])slide.shapes.title.text = "Preserved slide title"slide.placeholders[1].text = "Preserved body text"- slide.shapes.add_textbox(- Inches(1), Inches(5), Inches(5), Inches(1)- ).text = "Text after empty shape"+ slide.shapes.add_textbox(Inches(1), Inches(5), Inches(5), Inches(1)).text = (+ "Text after empty shape"+ )slide.notes_slide.notes_text_frame.text = "Preserved speaker notes"return presentationdiff --git a/packages/markitdown/tests/test_html.py b/packages/markitdown/tests/test_html.pyindex 94cece47..13ed5234 100644--- a/packages/markitdown/tests/test_html.py+++ b/packages/markitdown/tests/test_html.py@@ -9,7 +9,6 @@ from markitdown import MarkItDown, StreamInfofrom markitdown.converters import WikipediaConverterfrom markitdown.converters._markdownify import _CustomMarkdownify-# HTML renderingdiff --git a/packages/markitdown/tests/test_image.py b/packages/markitdown/tests/test_image.pyindex dbbc8f2e..039e5e6d 100644--- a/packages/markitdown/tests/test_image.py+++ b/packages/markitdown/tests/test_image.py@@ -20,7 +20,6 @@ from markitdown import ()from markitdown.converters import ImageConverter-# Image captionsIMAGE_FILE = Path(__file__).parent / "test_files" / "test.jpg"diff --git a/packages/markitdown/tests/test_module_misc.py b/packages/markitdown/tests/test_module_misc.pyindex 4d6c9be5..23d6f49a 100644--- a/packages/markitdown/tests/test_module_misc.py+++ b/packages/markitdown/tests/test_module_misc.py@@ -29,7 +29,6 @@ from markitdown._uri_utils import (parse_data_uri,)-# Library behavior and remaining formatsskip_remote = (diff --git a/packages/markitdown/tests/test_outlook_msg.py b/packages/markitdown/tests/test_outlook_msg.pyindex 8a1547f1..b34b9320 100644--- a/packages/markitdown/tests/test_outlook_msg.py+++ b/packages/markitdown/tests/test_outlook_msg.py@@ -11,7 +11,6 @@ import pytestfrom markitdown import DocumentConverterResult, MarkItDown, StreamInfofrom markitdown.converters._outlook_msg_converter import OutlookMsgConverter-# Message encodingsTEST_FILES_DIR = os.path.join(os.path.dirname(__file__), "test_files")diff --git a/packages/markitdown/tests/test_pdf.py b/packages/markitdown/tests/test_pdf.pyindex c4f8c64a..b18e6a20 100644--- a/packages/markitdown/tests/test_pdf.py+++ b/packages/markitdown/tests/test_pdf.py@@ -12,7 +12,6 @@ from markitdown.converters._pdf_converter import (_merge_partial_numbering_lines,)-# Table extractionTEST_FILES_DIR = os.path.join(os.path.dirname(__file__), "test_files")diff --git a/packages/markitdown/tests/test_pptx.py b/packages/markitdown/tests/test_pptx.pyindex bfbef3e9..2eaf18f6 100644--- a/packages/markitdown/tests/test_pptx.py+++ b/packages/markitdown/tests/test_pptx.py@@ -26,7 +26,6 @@ from markitdown import ()from markitdown.converters import HtmlConverter, PptxConverter, _pptx_converter-# Slide titlesBODY_TEXT = "Some body text on the slide."diff --git a/packages/markitdown/tests/test_rss.py b/packages/markitdown/tests/test_rss.pyindex 89d2cbb7..3fff786b 100644--- a/packages/markitdown/tests/test_rss.py+++ b/packages/markitdown/tests/test_rss.py@@ -8,7 +8,6 @@ import pytestfrom markitdown import MarkItDown, StreamInfofrom markitdown.converters import RssConverter-# Feed bodies and links@@ -42,9 +41,7 @@ def test_atom_namespace_prefixes(root_prefix: str, child_prefix: str) -> None:</{child_prefix}content></{child_prefix}entry></{root_prefix}feed>-""".encode(- "utf-8"- )+""".encode("utf-8")stream_info = StreamInfo(mimetype="application/xml", extension=".xml")converter = RssConverter()stream = io.BytesIO(feed)diff --git a/packages/markitdown/tests/test_xlsx.py b/packages/markitdown/tests/test_xlsx.pyindex bb071c86..92826229 100644--- a/packages/markitdown/tests/test_xlsx.py+++ b/packages/markitdown/tests/test_xlsx.py@@ -25,7 +25,6 @@ from markitdown import MarkItDown, MissingDependencyException, StreamInfofrom markitdown.converter_utils import _xlsx_imagesfrom markitdown.converters import XlsConverter, XlsxConverter, _xlsx_converter-# Image hooks_INFO = StreamInfo(extension=".xlsx")diff --git a/packages/markitdown/tests/test_youtube.py b/packages/markitdown/tests/test_youtube.pyindex 1ec139de..92aa6e0c 100644--- a/packages/markitdown/tests/test_youtube.py+++ b/packages/markitdown/tests/test_youtube.py@@ -10,7 +10,6 @@ import markitdown.converters._youtube_converter as youtube_modulefrom markitdown import MarkItDown, StreamInfofrom markitdown.converters import HtmlConverter, YouTubeConverter-# Extraction and fallbackdiff --git a/packages/markitdown/tests/test_zip.py b/packages/markitdown/tests/test_zip.pyindex aa253f91..cf993c37 100644--- a/packages/markitdown/tests/test_zip.py+++ b/packages/markitdown/tests/test_zip.py@@ -15,7 +15,6 @@ from markitdown import ()from markitdown.converters._zip_converter import ZipConverter-# Nested conversionTEST_FILES_DIR = os.path.join(os.path.dirname(__file__), "test_files")