nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 aiofiles,
12 azure-cosmos,
13 azure-identity,
14 azure-search-documents,
15 azure-storage-blob,
16 devtools,
17 environs,
18 fnllm,
19 future,
20 graspologic,
21 json-repair,
22 lancedb,
23 litellm,
24 networkx,
25 nltk,
26 numpy,
27 openai,
28 pandas,
29 pyarrow,
30 pydantic,
31 python-dotenv,
32 pyyaml,
33 spacy,
34 textblob,
35 tiktoken,
36 tqdm,
37 typer,
38 typing-extensions,
39 umap-learn,
40
41 # tests
42 nbformat,
43 pytest-asyncio,
44 pytestCheckHook,
45}:
46
47buildPythonPackage rec {
48 pname = "graphrag";
49 version = "2.7.0";
50 pyproject = true;
51
52 src = fetchFromGitHub {
53 owner = "microsoft";
54 repo = "graphrag";
55 tag = "v${version}";
56 hash = "sha256-F0MiC+14KOjCVwlcZpNo15SqDOfSYsVwH8qNQTHBKPQ=";
57 };
58
59 build-system = [
60 setuptools
61 ];
62
63 pythonRelaxDeps = true;
64
65 dependencies = [
66 aiofiles
67 azure-cosmos
68 azure-identity
69 azure-search-documents
70 azure-storage-blob
71 devtools
72 environs
73 fnllm
74 future
75 graspologic
76 json-repair
77 lancedb
78 litellm
79 networkx
80 nltk
81 numpy
82 openai
83 pandas
84 pyarrow
85 pydantic
86 python-dotenv
87 pyyaml
88 spacy
89 textblob
90 tiktoken
91 tqdm
92 typer
93 typing-extensions
94 umap-learn
95 ]
96 ++ fnllm.optional-dependencies.azure
97 ++ fnllm.optional-dependencies.openai;
98
99 env.NUMBA_CACHE_DIR = "$TMPDIR";
100
101 pythonImportsCheck = [ "graphrag" ];
102
103 nativeCheckInputs = [
104 nbformat
105 pytest-asyncio
106 pytestCheckHook
107 ];
108
109 enabledTestPaths = [ "tests/unit" ];
110
111 disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
112 # Flaky
113 "tests/unit/litellm_services/test_rate_limiter.py"
114 ];
115
116 disabledTests = [
117 # touch the network
118 "test_basic_functionality"
119 "test_child"
120 "test_dotprefix"
121 "test_find"
122 "test_load_strategy_sentence"
123 "test_mixed_whitespace_handling"
124 "test_multiple_documents"
125 "test_run_extract_entities_multiple_documents"
126 "test_run_extract_entities_single_document"
127 "test_sort_context"
128 "test_sort_context_max_tokens"
129 ];
130
131 meta = {
132 description = "Modular graph-based Retrieval-Augmented Generation (RAG) system";
133 homepage = "https://github.com/microsoft/graphrag";
134 changelog = "https://github.com/microsoft/graphrag/blob/${src.tag}/CHANGELOG.md";
135 license = lib.licenses.mit;
136 maintainers = with lib.maintainers; [ natsukium ];
137 };
138}