mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55:41 +03:00
python3Packages.pymupdf4llm: init at 0.0.17 (#409244)
This commit is contained in:
commit
80a02a3337
3 changed files with 64 additions and 0 deletions
|
@ -21768,6 +21768,12 @@
|
||||||
githubId = 7309170;
|
githubId = 7309170;
|
||||||
name = "Ryota Kameoka";
|
name = "Ryota Kameoka";
|
||||||
};
|
};
|
||||||
|
ryota2357 = {
|
||||||
|
email = "contact@ryota2357.com";
|
||||||
|
github = "ryota2357";
|
||||||
|
githubId = 61523777;
|
||||||
|
name = "Ryota Otsuki";
|
||||||
|
};
|
||||||
rypervenche = {
|
rypervenche = {
|
||||||
email = "git@ryper.org";
|
email = "git@ryper.org";
|
||||||
github = "rypervenche";
|
github = "rypervenche";
|
||||||
|
|
56
pkgs/development/python-modules/pymupdf4llm/default.nix
Normal file
56
pkgs/development/python-modules/pymupdf4llm/default.nix
Normal 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 ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -12918,6 +12918,8 @@ self: super: with self; {
|
||||||
|
|
||||||
pymupdf-fonts = callPackage ../development/python-modules/pymupdf-fonts { };
|
pymupdf-fonts = callPackage ../development/python-modules/pymupdf-fonts { };
|
||||||
|
|
||||||
|
pymupdf4llm = callPackage ../development/python-modules/pymupdf4llm { };
|
||||||
|
|
||||||
pymvglive = callPackage ../development/python-modules/pymvglive { };
|
pymvglive = callPackage ../development/python-modules/pymvglive { };
|
||||||
|
|
||||||
pymysensors = callPackage ../development/python-modules/pymysensors { };
|
pymysensors = callPackage ../development/python-modules/pymysensors { };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue