docling icon indicating copy to clipboard operation
docling copied to clipboard

ocrmac should be an optional extra, not a hard install_requires dependency

Open noho opened this issue 7 months ago • 1 comments

Summary

docling currently declares ocrmac as a hard runtime dependency in install_requires. Since ocrmac transitively depends on pyobjc-framework-Vision — which only ships wheels for macOS and has no buildable sdist on Linux — pip install docling fails on any non-macOS platform.

This blocks Linux CI for every downstream project that uses docling, even when the user has no intention of using the Apple Vision OCR backend.

Reproduce

On any Linux machine (or Linux CI runner):

pip install docling

Fails while resolving / building pyobjc-framework-Vision (no Linux wheel, sdist cannot be built without the Apple frameworks).

Why this is a metadata bug, not a platform limitation

docling already supports multiple OCR backends (EasyOCR / Tesseract / RapidOCR / OnnxTR / OcrMac). ocrmac is only one of them and is the only macOS-exclusive one. It should not be a mandatory runtime dependency.

Suggested fix

Move ocrmac out of the default install_requires and into an optional extra, for example:

[project.optional-dependencies]
ocrmac = ["ocrmac>=x.y.z; platform_system == 'Darwin'"]

Users who want the Apple Vision backend would install docling[ocrmac] on macOS. Linux / Windows users would get a working install out of the box with the other OCR backends still available.

Workarounds we've tried

  • pip constraints file with ocrmac; platform_system == "Darwin" — does not work. pip constraints only control which version of a package gets installed, not whether it gets installed. The dependency edge from docling → ocrmac still resolves on Linux and fails.
  • Stub wheel pre-declaring ocrmac as installed — technically works but has to track ocrmac's version bounds on every docling release; high maintenance.
  • macOS-only CI — what we currently do. Works, but costs ~10× runner minutes on GitHub Actions and excludes Linux contributors from running CI locally on their native platform.

Moving ocrmac to an extra would eliminate all of these.

Impact

Any project that depends on docling and wants cross-platform CI is forced to either pay the macOS runner cost or maintain fragile workaround code. A clean metadata fix upstream would unblock the whole downstream ecosystem.

Happy to send a PR if the direction is acceptable.

noho avatar Apr 17 '26 07:04 noho

Closing this as invalid — the issue premise is wrong on our side.

I opened this without first reading docling's actual pyproject.toml. Checking it now:

  • v2.15.0: ocrmac = { version = "^1.0.0", markers = "sys_platform == 'darwin'", optional = true }
  • main: ocrmac (>=1.0.0,<2.0.0) ; sys_platform == "darwin"

The sys_platform == "darwin" marker is already there, so pip skips ocrmac on Linux/Windows and pip install docling works fine on non-macOS platforms. The "Linux install fails because of ocrmac" premise in the original report is false — that failure must have come from something else in our setup, not from docling's metadata.

Apologies for the noise, and thanks for maintaining docling.

noho avatar Apr 17 '26 07:04 noho