Skip to content

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.yml
new file mode 100644
index 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_ENV
diff --git a/.github/constraints.txt b/.github/constraints.txt
index 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.yml
index 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: 7
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 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 tools
if: 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 packages
run: pip install "./packages/markitdown[all]" ./packages/markitdown-mcp pytest
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 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.1
hooks:
- id: black
diff --git a/packages/markitdown-mcp/tests/test_http_transports.py b/packages/markitdown-mcp/tests/test_http_transports.py
index 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 httpx
from 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.toml
index 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.py
index 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 DocxConverterWithOCR
from ._pptx_converter_with_ocr import PptxConverterWithOCR
from ._xlsx_converter_with_ocr import XlsxConverterWithOCR
-
__plugin_interface_version__ = 1
diff --git a/packages/markitdown-ocr/tests/test_docx_inheritance.py b/packages/markitdown-ocr/tests/test_docx_inheritance.py
index 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_module
from markitdown_ocr._docx_converter_with_ocr import DocxConverterWithOCR
from 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.py
index 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_metadata
from markitdown_ocr._pptx_converter_with_ocr import PptxConverterWithOCR
from 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.py
index 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_module
from markitdown_ocr._ocr_service import LLMVisionOCRService, OCRResult
from 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.py
index 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_module
from markitdown_ocr._ocr_service import OCRResult
from 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.py
index 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__.py
index 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():
OR
markitdown 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.py
index 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] = None
extension: Optional[str] = None
charset: 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 disk
url: Optional[str] = None # If read from url
diff --git a/packages/markitdown/src/markitdown/converter_utils/_xlsx_images.py b/packages/markitdown/src/markitdown/converter_utils/_xlsx_images.py
index 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 ET
from .._stream_info import StreamInfo
from ._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.py
index 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 InvalidFileReferenceError
from ..._stream_info import StreamInfo
from .._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.py
index ed341448..5b75075d 100644
--- a/packages/markitdown/src/markitdown/converters/_markdownify.py
+++ b/packages/markitdown/src/markitdown/converters/_markdownify.py
@@ -4,7 +4,6 @@ import markdownify
from typing import Any, Optional
from 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.py
index 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 main
from 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.py
index d21742bf..fcfe82d7 100644
--- a/packages/markitdown/tests/test_csv.py
+++ b/packages/markitdown/tests/test_csv.py
@@ -6,7 +6,6 @@ import pytest
from markitdown import MarkItDown, StreamInfo
-
# Record separators
diff --git a/packages/markitdown/tests/test_cu.py b/packages/markitdown/tests/test_cu.py
index 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.py
index 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 Intelligence
diff --git a/packages/markitdown/tests/test_docx.py b/packages/markitdown/tests/test_docx.py
index 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, oMat
from markitdown.converter_utils.docx.pre_process import _pre_process_styles
from 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.py
index f87f4d44..37d0e713 100644
--- a/packages/markitdown/tests/test_epub.py
+++ b/packages/markitdown/tests/test_epub.py
@@ -8,7 +8,6 @@ import pytest
from markitdown import MarkItDown, StreamInfo
from markitdown.converters import EpubConverter
-
# Archive href resolution
CONTAINER_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.py
index 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 Path
import pymupdf
-
FIXTURES = Path(__file__).resolve().parent
diff --git a/packages/markitdown/tests/test_files/generate_pptx_missing_text_fixtures.py b/packages/markitdown/tests/test_files/generate_pptx_missing_text_fixtures.py
index 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 Path
from pptx import Presentation
from 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 presentation
diff --git a/packages/markitdown/tests/test_html.py b/packages/markitdown/tests/test_html.py
index 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, StreamInfo
from markitdown.converters import WikipediaConverter
from markitdown.converters._markdownify import _CustomMarkdownify
-
# HTML rendering
diff --git a/packages/markitdown/tests/test_image.py b/packages/markitdown/tests/test_image.py
index 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 captions
IMAGE_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.py
index 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 formats
skip_remote = (
diff --git a/packages/markitdown/tests/test_outlook_msg.py b/packages/markitdown/tests/test_outlook_msg.py
index 8a1547f1..b34b9320 100644
--- a/packages/markitdown/tests/test_outlook_msg.py
+++ b/packages/markitdown/tests/test_outlook_msg.py
@@ -11,7 +11,6 @@ import pytest
from markitdown import DocumentConverterResult, MarkItDown, StreamInfo
from markitdown.converters._outlook_msg_converter import OutlookMsgConverter
-
# Message encodings
TEST_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.py
index 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 extraction
TEST_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.py
index 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 titles
BODY_TEXT = "Some body text on the slide."
diff --git a/packages/markitdown/tests/test_rss.py b/packages/markitdown/tests/test_rss.py
index 89d2cbb7..3fff786b 100644
--- a/packages/markitdown/tests/test_rss.py
+++ b/packages/markitdown/tests/test_rss.py
@@ -8,7 +8,6 @@ import pytest
from markitdown import MarkItDown, StreamInfo
from 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.py
index 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, StreamInfo
from markitdown.converter_utils import _xlsx_images
from 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.py
index 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_module
from markitdown import MarkItDown, StreamInfo
from markitdown.converters import HtmlConverter, YouTubeConverter
-
# Extraction and fallback
diff --git a/packages/markitdown/tests/test_zip.py b/packages/markitdown/tests/test_zip.py
index 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 conversion
TEST_FILES_DIR = os.path.join(os.path.dirname(__file__), "test_files")