From 9166649c3ee430bd9a5d20c2b62ec311ac6a4f68 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Feb 2023 11:18:41 +0100 Subject: [PATCH 1/2] khoj: add changelog to meta --- pkgs/servers/search/khoj/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/servers/search/khoj/default.nix b/pkgs/servers/search/khoj/default.nix index b49be53ec207..b440b8681d5e 100644 --- a/pkgs/servers/search/khoj/default.nix +++ b/pkgs/servers/search/khoj/default.nix @@ -69,6 +69,7 @@ python3Packages.buildPythonApplication rec { meta = with lib; { description = "Natural Language Search Assistant for your Org-Mode and Markdown notes, Beancount transactions and Photos"; homepage = "https://github.com/debanjum/khoj"; + changelog = "https://github.com/debanjum/khoj/releases/tag/${version}"; license = licenses.gpl3Only; maintainers = with maintainers; [ dit7ya ]; }; From 9c1c08a57e2d565195340e5b810e3300b63522c9 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 27 Feb 2023 11:46:23 +0100 Subject: [PATCH 2/2] khoj: 0.2.6 -> 0.3.0 Changelog: https://github.com/debanjum/khoj/releases/tag/0.3.0 --- pkgs/servers/search/khoj/default.nix | 104 ++++++++++++++++++--------- 1 file changed, 69 insertions(+), 35 deletions(-) diff --git a/pkgs/servers/search/khoj/default.nix b/pkgs/servers/search/khoj/default.nix index b440b8681d5e..6859562d4f62 100644 --- a/pkgs/servers/search/khoj/default.nix +++ b/pkgs/servers/search/khoj/default.nix @@ -1,27 +1,56 @@ { lib , fetchFromGitHub -, python3Packages +, python3 , qt6 }: -python3Packages.buildPythonApplication rec { +python3.pkgs.buildPythonApplication rec { pname = "khoj"; - version = "0.2.6"; - format = "setuptools"; + version = "0.3.0"; + format = "pyproject"; src = fetchFromGitHub { owner = "debanjum"; repo = "khoj"; rev = "refs/tags/${version}"; - hash = "sha256-QcxP+USj7vlLKPno2mV53nFonZM38VzL8D4zY6d8y3k="; + hash = "sha256-9kKK0DXpLfPB2LMnYcC6BKgZaoRsNHBZVe4thI7b9tk="; }; - propagatedBuildInputs = with python3Packages; [ - aiofiles + SETUPTOOLS_SCM_PRETEND_VERSION = version; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace "dateparser == 1.1.1" "dateparser" \ + --replace "defusedxml == 0.7.1" ""defusedxml"" \ + --replace "fastapi == 0.77.1" "fastapi" \ + --replace "jinja2 == 3.1.2" "jinja2" \ + --replace "openai == 0.20.0" "openai" \ + --replace "pillow == 9.3.0" "pillow" \ + --replace "pydantic == 1.9.1" "pydantic" \ + --replace "pyyaml == 6.0" "pyyaml" \ + --replace "pyqt6 == 6.3.1" "pyqt6" \ + --replace "rich >= 13.3.1" "rich" \ + --replace "schedule == 1.1.0" "schedule" \ + --replace "sentence-transformers == 2.2.2" "sentence-transformers" \ + --replace "torch == 1.13.1" "torch" \ + --replace "uvicorn == 0.17.6" "uvicorn" + ''; + + nativeBuildInputs = with python3.pkgs; [ + hatch-vcs + hatchling + ] ++ (with qt6; [ + wrapQtAppsHook + ]); + + buildInputs = with qt6; [ + qtwayland + ]; + + propagatedBuildInputs = with python3.pkgs; [ dateparser defusedxml fastapi - huggingface-hub jinja2 numpy openai @@ -29,43 +58,48 @@ python3Packages.buildPythonApplication rec { pydantic pyqt6 pyyaml + rich schedule sentence-transformers torch - torchvision - transformers uvicorn ]; - buildInputs = with qt6; [ - qtwayland + nativeCheckInputs = with python3.pkgs; [ + pytestCheckHook ]; - nativeBuildInputs = with qt6; [ - wrapQtAppsHook - ]; - - checkInputs = with python3Packages; [ - pytest - ]; - - postPatch = '' - substituteInPlace setup.py \ - --replace "aiofiles == 0.8.0" "aiofiles >= 0.8.0" \ - --replace "openai == 0.20.0" "openai >= 0.20.0" \ - --replace "pytest == 7.1.2" "pytest >= 7.1.2" \ - --replace "fastapi == 0.77.1" "fastapi >= 0.77.1" \ - --replace "numpy == 1.22.4" "numpy >= 1.22.4" \ - --replace "huggingface_hub == 0.8.1" "huggingface_hub >= 0.8.1" \ - --replace "dateparser == 1.1.1" "dateparser >= 1.1.1" \ - --replace "sentence-transformers == 2.1.0" "sentence-transformers >= 2.1.0" \ - --replace "transformers == 4.21.0" "transformers >= 4.21.0" \ - --replace "torchvision == 0.14.1" "torchvision" \ - --replace "pydantic == 1.9.1" "pydantic >= 1.9.1" \ - --replace "pyqt6 == 6.3.1" "pyqt6 >= 6.3.1" \ - --replace "uvicorn == 0.17.6" "uvicorn >= 0.17.6" + preCheck = '' + export HOME=$(mktemp -d) ''; + pythonImportsCheck = [ + "khoj" + ]; + + disabledTests = [ + # Tests require network access + "test_search_with_valid_content_type" + "test_update_with_valid_content_type" + "test_regenerate_with_valid_content_type" + "test_image_search" + "test_notes_search" + "test_notes_search_with_only_filters" + "test_notes_search_with_include_filter" + "test_notes_search_with_exclude_filter" + "test_image_metadata" + "test_image_search" + "test_image_search_query_truncated" + "test_image_search_by_filepath" + "test_asymmetric_setup_with_missing_file_raises_error" + "test_asymmetric_setup_with_empty_file_raises_error" + "test_asymmetric_reload" + "test_asymmetric_setup" + "test_asymmetric_search" + "test_entry_chunking_by_max_tokens" + "test_incremental_update" + ]; + meta = with lib; { description = "Natural Language Search Assistant for your Org-Mode and Markdown notes, Beancount transactions and Photos"; homepage = "https://github.com/debanjum/khoj";