biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / servers / search / khoj / default.nix
blob202eedb46f7bf1261d5aa845afe7a00f573a42c0
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , python3
5 , postgresql
6 , postgresqlTestHook
7 }:
9 python3.pkgs.buildPythonApplication rec {
10   pname = "khoj";
11   version = "1.0.1";
12   pyproject = true;
14   src = fetchFromGitHub {
15     owner = "debanjum";
16     repo = "khoj";
17     rev = "refs/tags/${version}";
18     hash = "sha256-lvOeYTrvW5MfhuJ3lj9n9TRlvpRwVP2vFeaEeJdqIec=";
19   };
21   env = {
22     DJANGO_SETTINGS_MODULE = "khoj.app.settings";
23     postgresqlEnableTCP = 1;
24   };
26   nativeBuildInputs = with python3.pkgs; [
27     hatch-vcs
28     hatchling
29   ];
31   propagatedBuildInputs = with python3.pkgs; [
32     aiohttp
33     anyio
34     authlib
35     beautifulsoup4
36     dateparser
37     defusedxml
38     django
39     fastapi
40     google-auth
41     # gpt4all
42     gunicorn
43     httpx
44     itsdangerous
45     jinja2
46     langchain
47     lxml
48     openai
49     openai-whisper
50     pgvector
51     pillow
52     psycopg2
53     pydantic
54     pymupdf
55     python-multipart
56     pyyaml
57     # rapidocr-onnxruntime
58     requests
59     rich
60     schedule
61     sentence-transformers
62     stripe
63     tenacity
64     tiktoken
65     torch
66     transformers
67     tzdata
68     uvicorn
69   ];
71   nativeCheckInputs = with python3.pkgs; [
72     freezegun
73     factory-boy
74     pytest-xdist
75     trio
76     psutil
77     pytest-django
78     pytestCheckHook
79   ] ++ [
80     (postgresql.withPackages (p: with p; [ pgvector ]))
81     postgresqlTestHook
82   ];
84   preCheck = ''
85     export HOME=$(mktemp -d)
86   '';
88   pythonImportsCheck = [
89     "khoj"
90   ];
92   disabledTests = [
93     # Tests require network access
94     "test_different_user_data_not_accessed"
95     "test_get_api_config_types"
96     "test_get_configured_types_via_api"
97     "test_image_metadata"
98     "test_image_search"
99     "test_image_search_by_filepath"
100     "test_image_search_query_truncated"
101     "test_index_update"
102     "test_index_update_with_no_auth_key"
103     "test_notes_search"
104     "test_notes_search_with_exclude_filter"
105     "test_notes_search_with_include_filter"
106     "test_parse_html_plaintext_file"
107     "test_regenerate_index_with_new_entry"
108     "test_regenerate_with_github_fails_without_pat"
109     "test_regenerate_with_invalid_content_type"
110     "test_regenerate_with_valid_content_type"
111     "test_search_for_user2_returns_empty"
112     "test_search_with_invalid_auth_key"
113     "test_search_with_invalid_content_type"
114     "test_search_with_no_auth_key"
115     "test_search_with_valid_content_type"
116     "test_text_index_same_if_content_unchanged"
117     "test_text_indexer_deletes_embedding_before_regenerate"
118     "test_text_search"
119     "test_text_search_setup_batch_processes"
120     "test_update_with_invalid_content_type"
121     "test_user_no_data_returns_empty"
123     # Tests require rapidocr-onnxruntime
124     "test_multi_page_pdf_to_jsonl"
125     "test_single_page_pdf_to_jsonl"
126     "test_ocr_page_pdf_to_jsonl"
127   ];
129   disabledTestPaths = [
130     # Tests require network access
131     "tests/test_conversation_utils.py"
132   ];
134   meta = with lib; {
135     description = "Natural Language Search Assistant for your Org-Mode and Markdown notes, Beancount transactions and Photos";
136     homepage = "https://github.com/debanjum/khoj";
137     changelog = "https://github.com/debanjum/khoj/releases/tag/${version}";
138     license = licenses.agpl3Plus;
139     maintainers = with maintainers; [ dit7ya ];
140     broken = true; # last successful build 2024-01-10
141   };