-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathpyproject.toml
More file actions
190 lines (173 loc) · 6.23 KB
/
Copy pathpyproject.toml
File metadata and controls
190 lines (173 loc) · 6.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
[tool.poetry]
name = "reactome-chatbot"
version = "0.1.0"
description = "Chatbot for reactome's data portal"
authors = ["Helia Mohammadi <hmohammadi@oicr.on.ca>",
"Adam Wright <awright@oicr.on.ca>",
"Greg Hogue <ghogue@oicr.on.ca>"]
license = "Apache2"
readme = "README.md"
packages = [
{ include = "src", from = "." }
]
#lark is needed for langchain -> SelfQueryRetriever
[tool.poetry.dependencies]
python = ">=3.12, <4"
langchain = "^0.3.4"
openai = "^1.12.0"
chromadb = "<1.0"
pandas = "^2.2.1"
pyasn1 = "^0.5.1"
langchain-openai = "^0.2.3"
neo4j = "4.3.6"
python-dotenv = "^1.0.1"
pyfiglet = "^1.0.2"
chainlit = "^2.0.3"
asyncpg = "^0.30.0"
sqlalchemy = "^2.0.30"
langchain-community = "^0.3.3"
langchain-core = "^0.3.13"
langchain-huggingface = "^0.1.0"
einops = "^0.8.0"
boto3 = "^1.34.148"
torch = [
{ version = "2.4.1+cpu", markers = "sys_platform == 'linux' and platform_machine == 'x86_64'", source = "pytorch_cpu" },
{ version = "2.2.*", markers = "sys_platform != 'linux' or platform_machine != 'x86_64'", source = "PyPI" },
]
langchain-chroma = "0.2.3"
langchain-ollama = "^0.2.0"
lark = "^1.2.2"
langgraph = "^0.2.39"
langgraph-checkpoint-postgres = "^2.0.2"
rank-bm25 = "^0.2.2"
psycopg = {extras = ["binary"], version = "^3.2.3"}
pydantic = "^2.10.5"
pyyaml = "^6.0.2"
tavily-python = "^0.5.0"
openpyxl = "^3.1.5"
nltk = "^3.9.1"
beautifulsoup4 = "^4.12.0"
lxml = "^5.0.0"
requests = "^2.32.0"
[tool.poetry.group.dev.dependencies]
ruff = "^0.7.1"
pytest = "^8.3.3"
mypy = "^1.13.0"
black = "^24.10.0"
isort = "^5.13.2"
pandas-stubs = "^2.2.3.241009"
types-requests = "^2.32.0.20241016"
types-pyyaml = "^6.0.12.20241230"
datasets = "^3.2.0"
ragas = "^0.2.11"
[[tool.poetry.source]]
name = "PyPI"
priority = "primary"
[[tool.poetry.source]]
name = "pytorch_cpu"
url = "https://download.pytorch.org/whl/cpu"
priority = "explicit"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.ruff]
line-length = 88
target-version = "py312"
src = ["src", "bin"]
extend-exclude = ["embeddings", "records", "data", ".venv"]
[tool.ruff.lint]
# One rule set for the whole repo. E501 is the formatter's job -- it cannot split
# long string literals anyway -- and RUF001 fires on intentional typography inside
# LLM prompt text.
select = [
"E", "F", "I", "UP", "B", "SIM", "RUF", # the core set
"S", # bandit: security
"C4", # comprehensions
"RET", # return-statement hygiene
"PIE", "PT", "ISC", "INT", "ICN", "TID", "A", "LOG", "G", "ERA", "N",
]
ignore = ["E501", "RUF001", "ISC001"]
# Not yet enforced. Each needs a decision rather than a mechanical fix, so they
# are listed here instead of being silently dropped:
# PTH ~41 os.path -> pathlib rewrites; mechanical but touches files the
# retriever work will rewrite. Worth its own commit afterwards.
# DTZ datetime.now() without tzinfo. The rate limiter and static-message
# throttle deliberately store naive local timestamps in user metadata;
# changing that is a storage-format decision, not a lint fix.
# ARG unused arguments -- several are required by LangGraph node signatures.
# BLE blind `except Exception` in top-level scripts.
# C901 two functions over the complexity threshold.
[tool.ruff.lint.isort]
known-first-party = [
"agent",
"data_generation",
"evaluation",
"retrievers",
"tools",
"util",
]
[tool.ruff.lint.per-file-ignores]
# Entry-point scripts intentionally configure the app at import time.
"bin/*" = ["E402"]
# assert is how pytest asserts.
"tests/*" = ["S101"]
[tool.ruff.format]
docstring-code-format = true
[tool.pytest.ini_options]
testpaths = ["tests"]
pythonpath = ["src", "bin"]
addopts = "-q --strict-markers --strict-config"
markers = [
"requires_embeddings: needs an installed embeddings bundle (see ./bin/embeddings_manager)",
"requires_retrieval_stack: needs the full langchain/chromadb dependency set installed",
]
[tool.mypy]
python_version = "3.12"
files = ["bin", "src", "tests", ".github", "export_csvs.py"]
exclude = "^(data|embeddings|records)/"
mypy_path = "src"
explicit_package_bases = true
ignore_missing_imports = true
# --- ratchet: currently-enforced floor (the code already largely satisfies this) ---
check_untyped_defs = true
no_implicit_optional = true
strict_equality = true
warn_redundant_casts = true
# Annotation coverage reached 100%, so these are enforced repo-wide rather than
# per-module. There is now one standard for every file.
disallow_untyped_defs = true
disallow_incomplete_defs = true
warn_no_return = true
warn_return_any = true
extra_checks = true
# disallow_untyped_decorators stays off: chainlit's @cl.* decorators are
# untyped upstream, so it only ever fires on bin/chat-chainlit.py.
# --- mypy baseline -------------------------------------------------------------
# Modules that do not yet meet the floor above. Each entry is debt: fix the module,
# then delete its block. Do not add to this list without a TODO.
[[tool.mypy.overrides]]
# TODO(phase-2): every node returns a partial state; the TypedDict needs
# `total=False` or per-node Partial* types.
module = ["agent.profiles.cross_database"]
disable_error_code = ["typeddict-item", "no-any-return"]
[[tool.mypy.overrides]]
# A module may appear in only one override section, so both TODOs live here.
# TODO(phase-2): partial-state returns, as for cross_database above.
# TODO(phase-2): preprocess() narrows BaseState to ReactToMeState, which is an LSP
# violation -- parameters may widen, not narrow. The fix is to make BaseGraphBuilder
# generic in its state type (BaseGraphBuilder[StateT]) so each profile declares its
# own. Deferred because base.py is also modified by the safetycheck and analysis
# branches, and a generics refactor there would collide with both.
module = ["agent.profiles.react_to_me"]
disable_error_code = ["typeddict-item", "override"]
[[tool.mypy.overrides]]
# TODO(phase-2): `EmbeddingEnvironment.get_dir()` returns `Path | None` but the
# parameter is typed `Path`, so an uninstalled bundle passes None straight through.
# Fixed properly by moving the lookup out of the default argument (see ruff B008).
module = [
"retrievers.reactome.rag",
"retrievers.uniprot.rag",
"retrievers.plantreactome.rag",
"retrievers.userguide.rag",
]
disable_error_code = ["assignment"]