python3Packages.pymupdf4llm: init at 0.0.17 (#409244)

This commit is contained in:
OTABI Tomoya 2025-05-31 15:32:03 +09:00 committed by GitHub
commit 80a02a3337
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 64 additions and 0 deletions

View file

@ -21768,6 +21768,12 @@
githubId = 7309170;
name = "Ryota Kameoka";
};
ryota2357 = {
email = "contact@ryota2357.com";
github = "ryota2357";
githubId = 61523777;
name = "Ryota Otsuki";
};
rypervenche = {
email = "git@ryper.org";
github = "rypervenche";

View file

@ -0,0 +1,56 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
pymupdf,
}:
buildPythonPackage rec {
pname = "pymupdf4llm";
version = "0.0.17";
pyproject = true;
src = fetchFromGitHub {
owner = "pymupdf";
repo = "RAG";
tag = "v${version}";
hash = "sha256-+RLK+UorkU8eVQJGrc7pVNZPtIpxMgA9mBKA6GeWUa0=";
};
sourceRoot = "${src.name}/pymupdf4llm";
build-system = [ setuptools ];
dependencies = [ pymupdf ];
checkPhase = ''
runHook preCheck
python3 - <<'EOF'
import fitz
import pymupdf4llm
doc = fitz.open()
page = doc.new_page()
page.insert_text((72, 72), "Hello, Nix!")
doc.save("input.pdf")
md = pymupdf4llm.to_markdown("input.pdf")
assert isinstance(md, str), "Returned value is not a string"
assert "Hello, Nix!" in md, "Returned value does not contain the expected text"
EOF
runHook postCheck
'';
pythonImportsCheck = [ "pymupdf4llm" ];
meta = {
description = "PyMuPDF Utilities for LLM/RAG - converts PDF pages to Markdown format for Retrieval-Augmented Generation";
homepage = "https://github.com/pymupdf/RAG";
changelog = "https://github.com/pymupdf/RAG/blob/${src.tag}/CHANGES.md";
license = lib.licenses.agpl3Only;
maintainers = with lib.maintainers; [ ryota2357 ];
};
}

View file

@ -12918,6 +12918,8 @@ self: super: with self; {
pymupdf-fonts = callPackage ../development/python-modules/pymupdf-fonts { };
pymupdf4llm = callPackage ../development/python-modules/pymupdf4llm { };
pymvglive = callPackage ../development/python-modules/pymvglive { };
pymysensors = callPackage ../development/python-modules/pymysensors { };