diff --git a/pkgs/by-name/lo/loguru/package.nix b/pkgs/by-name/lo/loguru/package.nix new file mode 100644 index 000000000000..84fe218859c7 --- /dev/null +++ b/pkgs/by-name/lo/loguru/package.nix @@ -0,0 +1,49 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch, + cmake, +}: + +stdenv.mkDerivation { + pname = "loguru"; + version = "2.1.0-unstable-2023-04-06"; + + src = fetchFromGitHub { + owner = "emilk"; + repo = "loguru"; + rev = "4adaa185883e3c04da25913579c451d3c32cfac1"; + hash = "sha256-NpMKyjCC06bC5B3xqgDr2NgA9RsPEeiWr9GbHrHHzZ8="; + }; + + patches = [ + # See https://github.com/emilk/loguru/issues/249 + # The following patches are coming from a fork and fix builds on Darwin + # Hopefully they will be merged in the main repository soon. + (fetchpatch { + url = "https://github.com/virtuosonic/loguru/commit/e1ffdc4149083cc221d44b666a0f7e3ec4a87259.patch"; + hash = "sha256-fYdS8+qfgyj1J+T6H434jDGK/L+VYq+L22CQ7M/uiXE="; + }) + (fetchpatch { + url = "https://github.com/virtuosonic/loguru/commit/743777bea361642349d4673e6a0a55912849c14f.patch"; + hash = "sha256-3FhH7zdkzHuXSirSCr8A3uHg8UpSfEM02AkR0ZSG0Yw="; + }) + ]; + + cmakeFlags = [ + "-DLOGURU_WITH_STREAMS=1" + ]; + + nativeBuildInputs = [ + cmake + ]; + + meta = { + description = "Lightweight C++ logging library"; + homepage = "https://github.com/emilk/loguru"; + license = lib.licenses.unlicense; + maintainers = with lib.maintainers; [ drupol ]; + platforms = lib.platforms.all; + }; +} diff --git a/pkgs/development/python-modules/deepsearch-toolkit/default.nix b/pkgs/development/python-modules/deepsearch-toolkit/default.nix new file mode 100644 index 000000000000..92a88b601507 --- /dev/null +++ b/pkgs/development/python-modules/deepsearch-toolkit/default.nix @@ -0,0 +1,93 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + poetry-core, + certifi, + docling-core, + platformdirs, + pluggy, + pydantic, + pydantic-settings, + python-dateutil, + python-dotenv, + requests, + six, + tabulate, + tqdm, + typer, + urllib3, + anyio, + fastapi, + uvicorn, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "deepsearch-toolkit"; + version = "1.1.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "DS4SD"; + repo = "deepsearch-toolkit"; + rev = "refs/tags/v${version}"; + hash = "sha256-7XiI/VtXX4lRMreqUh6hJvdIULGvsCEdrd+zV5Jrne0="; + }; + + build-system = [ + poetry-core + ]; + + dependencies = [ + certifi + docling-core + platformdirs + pluggy + pydantic + pydantic-settings + python-dateutil + python-dotenv + requests + six + tabulate + tqdm + typer + urllib3 + ]; + + pythonRelaxDeps = [ + "urllib3" + ]; + + optional-dependencies = rec { + all = api; + api = [ + anyio + fastapi + uvicorn + ]; + }; + + pythonImportsCheck = [ + "deepsearch" + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + disabledTests = [ + # Tests require the creation of a deepsearch profile + "test_project_listing" + "test_system_info" + ]; + + meta = { + changelog = "https://github.com/DS4SD/deepsearch-toolkit/blob/${src.rev}/CHANGELOG.md"; + description = "Interact with the Deep Search platform for new knowledge explorations and discoveries"; + homepage = "https://github.com/DS4SD/deepsearch-toolkit"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ drupol ]; + }; +} diff --git a/pkgs/development/python-modules/docling-core/default.nix b/pkgs/development/python-modules/docling-core/default.nix new file mode 100644 index 000000000000..b790ca13ab86 --- /dev/null +++ b/pkgs/development/python-modules/docling-core/default.nix @@ -0,0 +1,59 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + poetry-core, + jsonref, + jsonschema, + pandas, + pillow, + pydantic, + tabulate, + jsondiff, + requests, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "docling-core"; + version = "2.3.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "DS4SD"; + repo = "docling-core"; + rev = "refs/tags/v${version}"; + hash = "sha256-yNsmMAeR1sbZsddpjMFWZy2UAbIWWiZmdW4/lwLvCbM="; + }; + + build-system = [ + poetry-core + ]; + + dependencies = [ + jsonref + jsonschema + pandas + pillow + pydantic + tabulate + ]; + + pythonImportsCheck = [ + "docling_core" + ]; + + nativeCheckInputs = [ + jsondiff + pytestCheckHook + requests + ]; + + meta = { + changelog = "https://github.com/DS4SD/docling-core/blob/${version}/CHANGELOG.md"; + description = "Python library to define and validate data types in Docling"; + homepage = "https://github.com/DS4SD/docling-core"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ drupol ]; + }; +} diff --git a/pkgs/development/python-modules/docling-ibm-models/default.nix b/pkgs/development/python-modules/docling-ibm-models/default.nix new file mode 100644 index 000000000000..dbd7b4e819ec --- /dev/null +++ b/pkgs/development/python-modules/docling-ibm-models/default.nix @@ -0,0 +1,75 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + poetry-core, + huggingface-hub, + jsonlines, + lxml, + mean-average-precision, + numpy, + opencv-python-headless, + pillow, + torch, + torchvision, + tqdm, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "docling-ibm-models"; + version = "2.0.3"; + pyproject = true; + + src = fetchFromGitHub { + owner = "DS4SD"; + repo = "docling-ibm-models"; + rev = "refs/tags/v${version}"; + hash = "sha256-vSEW1+mFTjUvjjUOoX3aGgT/y8iwP3JGIZaPh9RbX5I="; + }; + + build-system = [ + poetry-core + ]; + + dependencies = [ + huggingface-hub + jsonlines + lxml + mean-average-precision + numpy + opencv-python-headless + pillow + torch + torchvision + tqdm + ]; + + pythonRelaxDeps = [ + "lxml" + "mean_average_precision" + "torchvision" + ]; + + pythonImportsCheck = [ + "docling_ibm_models" + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + disabledTests = [ + # Requires network access + "test_layoutpredictor" + "test_tf_predictor" + ]; + + meta = { + changelog = "https://github.com/DS4SD/docling-ibm-models/blob/${src.rev}/CHANGELOG.md"; + description = "Docling IBM models"; + homepage = "https://github.com/DS4SD/docling-ibm-models"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ drupol ]; + }; +} diff --git a/pkgs/development/python-modules/docling-parse/default.nix b/pkgs/development/python-modules/docling-parse/default.nix new file mode 100644 index 000000000000..d03385c1a05b --- /dev/null +++ b/pkgs/development/python-modules/docling-parse/default.nix @@ -0,0 +1,81 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + cmake, + pkg-config, + cxxopts, + poetry-core, + pybind11, + tabulate, + zlib, + nlohmann_json, + utf8cpp, + libjpeg, + qpdf, + loguru-cpp, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "docling-parse"; + version = "2.0.2"; + pyproject = true; + + src = fetchFromGitHub { + owner = "DS4SD"; + repo = "docling-parse"; + rev = "refs/tags/v${version}"; + hash = "sha256-unXGmMp5xyRCqSoFmqcQAZOBzpE0EzgEEBIfZUHhRcQ="; + }; + + dontUseCmakeConfigure = true; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + build-system = [ + poetry-core + ]; + + env.NIX_CFLAGS_COMPILE = "-I${lib.getDev utf8cpp}/include/utf8cpp"; + + buildInputs = [ + pybind11 + cxxopts + libjpeg + loguru-cpp + nlohmann_json + qpdf + utf8cpp + zlib + ]; + + env.USE_SYSTEM_DEPS = true; + + cmakeFlags = [ + "-DUSE_SYSTEM_DEPS=True" + ]; + + dependencies = [ + tabulate + ]; + + pythonImportsCheck = [ + "docling_parse" + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + meta = { + changelog = "https://github.com/DS4SD/docling-parse/blob/${src.rev}/CHANGELOG.md"; + description = "Simple package to extract text with coordinates from programmatic PDFs"; + homepage = "https://github.com/DS4SD/docling-parse"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ drupol ]; + }; +} diff --git a/pkgs/development/python-modules/marko/default.nix b/pkgs/development/python-modules/marko/default.nix new file mode 100644 index 000000000000..d5aaf83d76c0 --- /dev/null +++ b/pkgs/development/python-modules/marko/default.nix @@ -0,0 +1,55 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + pdm-backend, + pygments, + objprint, + python-slugify, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "marko"; + version = "2.1.2"; + pyproject = true; + + src = fetchFromGitHub { + owner = "frostming"; + repo = "marko"; + rev = "refs/tags/v${version}"; + hash = "sha256-KqdBYmlVs00atXy7MSsriRBnL7w13io2oFZ0IyJ2Om4="; + }; + + build-system = [ + pdm-backend + ]; + + optional-dependencies = { + codehilite = [ + pygments + ]; + repr = [ + objprint + ]; + toc = [ + python-slugify + ]; + }; + + pythonImportsCheck = [ + "marko" + ]; + + nativeCheckInputs = [ + pytestCheckHook + ] ++ optional-dependencies.toc ++ optional-dependencies.codehilite; + + meta = { + changelog = "https://github.com/frostming/marko/blob/${src.rev}/CHANGELOG.md"; + description = "Markdown parser with high extensibility"; + homepage = "https://github.com/frostming/marko"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ drupol ]; + }; +} diff --git a/pkgs/development/python-modules/mean-average-precision/default.nix b/pkgs/development/python-modules/mean-average-precision/default.nix new file mode 100644 index 000000000000..24a4d65aaf67 --- /dev/null +++ b/pkgs/development/python-modules/mean-average-precision/default.nix @@ -0,0 +1,45 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + numpy, + pandas, +}: + +buildPythonPackage rec { + pname = "mean-average-precision"; + version = "2024.01.05.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "bes-dev"; + repo = "mean_average_precision"; + rev = "refs/tags/${version}"; + hash = "sha256-qo160L+oJsHERVOV0qdiRIZPMjvSlUmMTrAzThfrQSs="; + }; + + build-system = [ + setuptools + ]; + + dependencies = [ + numpy + pandas + ]; + + pythonImportsCheck = [ + "mean_average_precision" + ]; + + # No tests + doCheck = false; + + meta = { + description = "Mean Average Precision for Object Detection"; + homepage = "https://github.com/bes-dev/mean_average_precision"; + changelog = "https://github.com/bes-dev/mean_average_precision/blob/${version}/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ drupol ]; + }; +} diff --git a/pkgs/development/python-modules/objprint/default.nix b/pkgs/development/python-modules/objprint/default.nix new file mode 100644 index 000000000000..23460fe5ffc9 --- /dev/null +++ b/pkgs/development/python-modules/objprint/default.nix @@ -0,0 +1,39 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "objprint"; + version = "0.2.3"; + pyproject = true; + + src = fetchFromGitHub { + owner = "gaogaotiantian"; + repo = "objprint"; + rev = version; + hash = "sha256-IGYjDdi3JzYk53ITVOhVnm9EDsa+4HXSVtVUE3wQWTo="; + }; + + build-system = [ + setuptools + ]; + + pythonImportsCheck = [ + "objprint" + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + meta = { + description = "Library that can print Python objects in human readable format"; + homepage = "https://github.com/gaogaotiantian/objprint"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ drupol ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index f4d6dea86887..48a04dffe93b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3071,6 +3071,8 @@ self: super: with self; { deepmerge = callPackage ../development/python-modules/deepmerge { }; + deepsearch-toolkit = callPackage ../development/python-modules/deepsearch-toolkit { }; + deeptoolsintervals = callPackage ../development/python-modules/deeptoolsintervals { }; deepwave = callPackage ../development/python-modules/deepwave { }; @@ -3703,6 +3705,14 @@ self: super: with self; { dockerspawner = callPackage ../development/python-modules/dockerspawner { }; + docling-core = callPackage ../development/python-modules/docling-core { }; + + docling-ibm-models = callPackage ../development/python-modules/docling-ibm-models { }; + + docling-parse = callPackage ../development/python-modules/docling-parse { + loguru-cpp = pkgs.loguru; + }; + docloud = callPackage ../development/python-modules/docloud { }; docstr-coverage = callPackage ../development/python-modules/docstr-coverage { }; @@ -7748,6 +7758,8 @@ self: super: with self; { markdownify = callPackage ../development/python-modules/markdownify { }; + marko = callPackage ../development/python-modules/marko { }; + markupsafe = callPackage ../development/python-modules/markupsafe { }; markuppy = callPackage ../development/python-modules/markuppy { }; @@ -7870,6 +7882,8 @@ self: super: with self; { mdp = callPackage ../development/python-modules/mdp { }; + mean-average-precision = callPackage ../development/python-modules/mean-average-precision { }; + measurement = callPackage ../development/python-modules/measurement { }; meater-python = callPackage ../development/python-modules/meater-python { }; @@ -9305,6 +9319,8 @@ self: super: with self; { objexplore = callPackage ../development/python-modules/objexplore { }; + objprint = callPackage ../development/python-modules/objprint { }; + objsize = callPackage ../development/python-modules/objsize { }; objgraph = callPackage ../development/python-modules/objgraph {