docling-java icon indicating copy to clipboard operation
docling-java copied to clipboard

Explore direct Docling integration

Open edeandrea opened this issue 1 year ago • 11 comments

Explore direct docling integration using GraalPy (or something similar).

edeandrea avatar Dec 01 '25 12:12 edeandrea

Some preliminary exploration with GraalPy happened here:

https://github.com/andreaTP/graalpy-build-docling

andreaTP avatar Dec 10 '25 09:12 andreaTP

@Sanne didn't you work with the Graalvm team (or know someone who did) on doing a poc running Docling on Graalvm?

Is this what you were referring to? https://github.com/fniephaus/graalpy-quarkus-summarize

edeandrea avatar Jan 27 '26 16:01 edeandrea

There's also https://www.graalvm.org/python/ and https://github.com/docling-project/docling4j, which was started by @ceberam . Maybe he has some input here too?

edeandrea avatar Jan 27 '26 17:01 edeandrea

@Sanne didn't you work with the Graalvm team (or know someone who did) on doing a poc running Docling on Graalvm?

It wasn't docling, it was https://github.com/microsoft/markitdown - they have a demo in which the entire app and all its dependencies are embedded into a Quarkus application & compiled to native. My understanding is that markitdown and docling are similar tools? I might be wrong, not really used either tool.

(and sorry for the delay in responding!)

Sanne avatar Mar 06 '26 15:03 Sanne

@Sanne is this (https://github.com/fniephaus/graalpy-spring-boot-summarize) what you are referring to?

edeandrea avatar Mar 17 '26 20:03 edeandrea

This one:

  • https://github.com/fniephaus/graalpy-quarkus-summarize

Sanne avatar Mar 17 '26 21:03 Sanne

Thanks!

edeandrea avatar Mar 17 '26 21:03 edeandrea

Research by @galaxyman2424: https://github.com/galaxyman2424/doclingGraalvm/blob/main/DoclingGraalVM%20Technical%20Report.md

edeandrea avatar May 04 '26 19:05 edeandrea

Hi,

Below I have linked my repository where I made various attempts at direct integration using GraalVM / GraalPy, as part of a project @edeandrea proposed to myself and some fellow students.

Each folder contains a different environment (gradle, maven, etc), as I tried a few different things to get around some of the dependency issues / conflicts that I encountered. Each attempt has a README explaining more about it and what I encountered. Some of them were early experiments just playing around with GraalVM in general, so those can be ignored.

Didn't end up getting it working, but hopefully this could provide some guidance in the future!

https://github.com/osullc2/GraalVM-Docling-attempts

osullc2 avatar May 04 '26 23:05 osullc2

Hi! I'm one of the students that worked with @edeandrea and @osullc2. Here's my repo: https://github.com/kolya93/docling-java-api

I tried direct Docling integration using GraalPy, focusing on getting Docling installed and running on GraalPy in a WSL2 environment. I confirmed that Docling itself is pure Python with no native extensions, and imports all of PyTorch, but the main challenge was getting PyTorch to compile from source, as no pre-built GraalPy wheel is available for it. The build process was repeatedly killed by the Linux OOM killer due to GraalPy's large JVM memory footprint consuming RAM before the compilation could complete. I was able to make progress by adding a 16GB swapfile and using torch==2.2.1 with PIP_NO_BUILD_ISOLATION=1.

I hope this helps!

kolya93 avatar May 19 '26 22:05 kolya93

Took very long to get back to this but here you have this new experiment: https://github.com/roastedroot/cpython4j Docling integration was the initial use-case and is tested in CI: https://github.com/roastedroot/cpython4j/blob/main/it/src/test/java/io/roastedroot/cpython4j/it/DoclingTest.java

CPython4J dynamically links to any available libpython at runtime rather than targeting a fixed system installation. Through tight integration with uv, it manages virtual environments, dependency resolution, and even Python installation automatically. The result: any library that works with standard CPython works here unchanged, with no recompilation and no JVM reimplementation required.

andreaTP avatar Jun 03 '26 14:06 andreaTP