1{
2 lib,
3 fetchFromGitHub,
4 python3Packages,
5 openai,
6 pdfminer,
7
8 withOpenai ? false,
9}:
10
11python3Packages.buildPythonApplication rec {
12 pname = "pdftitle";
13 version = "0.20";
14 pyproject = true;
15
16 src = fetchFromGitHub {
17 owner = "metebalci";
18 repo = "pdftitle";
19 tag = "v${version}";
20 hash = "sha256-05SaAXYJ7l0ZldYufj0x9mYRwwGT7vlmq9a+ZF4pYiA=";
21 };
22
23 build-system = with python3Packages; [ setuptools ];
24
25 dependencies =
26 with python3Packages;
27 [
28 pdfminer
29 python-dotenv
30 ]
31 ++ lib.optional withOpenai openai;
32
33 pythonImportsCheck = [ "pdftitle" ];
34
35 meta = {
36 description = "Utility to extract the title from a PDF file";
37 homepage = "https://github.com/metebalci/pdftitle";
38 changelog = "https://github.com/metebalci/pdftitle/blob/v${version}/CHANGELOG.md";
39 license = lib.licenses.gpl3Only;
40 maintainers = with lib.maintainers; [ dansbandit ];
41 mainProgram = "pdftitle";
42 };
43}