Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
161 lines (150 loc) · 7.02 KB
/
Copy pathpyproject.toml
File metadata and controls
161 lines (150 loc) · 7.02 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
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "fact_reasoner"
version = "0.9.0"
description = "Factuality Assessment for Foundation Models"
authors = [
{name = "Radu Marinescu", email = "radu.marinescu@ie.ibm.com"},
{name = "Javier Carnerero Cano", email = "javier.cano@ibm.com"},
{name = "Massimiliano Pronesti", email = "massimiliano.pronesti@ibm.com"},
]
license = {text = "Apache-2.0"}
readme = "README.md"
requires-python = ">=3.11"
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
# `numpy`, `scikit-learn`, `sentence-transformers`, `rouge-score` and `joblib`
# were once an optional "simbauq" extra, but none of them is actually optional:
# * numpy is imported unguarded at module scope by fact_reasoner.uncertainty,
# which core.nli imports eagerly -- so even `fact-reasoner --help` needs it.
# * the sentence-transformers similarity gate backs `--nli-mode fast`, which is
# a cost control unrelated to SIMBA-UQ.
# * joblib is imported directly by uncertainty.nli_training rather than being
# used through scikit-learn, so it is declared here rather than relied on
# transitively.
# Lower bounds are security floors, not preferences: each one is the first
# release that patches a known advisory against this dependency set (see the
# repository's security tracking issue). Raise them when new advisories land;
# do not relax them. `chromadb` is deliberately not declared anywhere in this
# file -- not even as an optional extra -- see the note below.
dependencies = [
"beautifulsoup4",
"joblib",
"langchain-community>=0.4.2",
"langchain-core>=1.3.3",
"langchain-huggingface",
"langchain-text-splitters",
"mellea==0.8.0",
"networkx",
# CVE-2026-81726 (nltk <= 3.10.3, no patched release) is in the
# TransitionParser model-file APIs; we only call sent_tokenize. nltk cannot
# be dropped -- mellea and rouge-score depend on it -- so the alert is
# dismissed as "vulnerable code not used". Raise the floor once a fix ships.
"nltk>=3.10.3",
"numpy",
# 0.6.3 adds the System One client (AsyncClient.systemone) that
# DecisionNLIExtractor uses to query decision models such as kev.
"ollama>=0.6.3",
"pandas>=2.3.1",
"pymilvus[model,milvus-lite]",
# pypdf supersedes the abandoned PyPDF2 (last release 3.0.1, CVE-2023-36464
# unpatched). Drop-in for the only API we use: PdfReader(BytesIO(...)),
# .pages and .extract_text() in core/retriever.py.
"pypdf>=6.21.1",
"python-dotenv",
"requests",
"rouge-score",
"scikit-learn",
"sentence-transformers",
"thefuzz",
"tqdm",
"wikipedia",
# Transitive pins. These are pulled in by langchain / chromadb / vllm rather
# than imported here, but the resolver will happily pick a vulnerable version
# unless we floor it.
"aiohttp>=3.14.4",
"anyio>=4.14.2",
"certifi>=2026.10.19",
"fsspec>=2026.6.0",
"idna>=3.15",
"langchain-classic>=1.0.7",
# langsmith 0.9+ switches to an httpx2 stack; the cap keeps that migration a
# deliberate change rather than a silent one.
"langsmith>=0.8.18,<0.15",
"multidict>=6.9.1",
"pillow>=13.0.0",
"pydantic-settings>=2.14.2",
"soupsieve>=2.8.4",
"urllib3>=2.7.0",
]
[project.optional-dependencies]
# There is deliberately no `chroma` extra. The `--service-type chromadb` backend is
# still supported, but `chromadb` is not declared here in any form, because every
# release up to and including 1.5.9 -- the latest on PyPI -- carries unpatched
# critical advisories: CVE-2026-45829 (pre-authentication code injection) and
# CVE-2026-45833 (code injection). No patched release exists to floor against.
#
# An optional extra would not help: `uv lock` pins every extra, so declaring
# chromadb even optionally writes a vulnerable version into uv.lock and keeps the
# whole project in scope of those alerts. Users who want the backend install it
# themselves (`pip install chromadb`), accepting that risk; ChromaReader imports it
# lazily and raises an actionable ImportError when it is absent. The other two
# backends (`google`, `wikipedia`) need no extra install.
#
# There is likewise no `vllm` extra. vLLM is invoked as an external `vllm serve`
# process (see fact_reasoner.serving) and never imported, so declaring it only
# served to pin its dependency tree into uv.lock -- which kept cryptography,
# diskcache and an old setuptools in scope of their alerts. Every vllm release
# (through 0.31.0) also caps setuptools < 81, below the CVE-2026-59890 fix
# (83.0.0), so no vllm version can be locked cleanly. Install it yourself on the
# GPU node: `pip install "vllm>=0.28"` (0.28.0 patches its own known advisories).
#
# There is likewise no `rits` extra. RITS backends need the IBM-internal
# `mellea-ibm` package, which is not on PyPI and is only reachable over git-ssh
# to github.ibm.com. Declaring it here made every `uv lock` fetch that private
# source, so nobody without IBM access could re-resolve the lock. IBM users
# install it separately (see CONTRIBUTING.md, "Internal IBM Usage").
# OpenTelemetry exporters for traces/metrics (see README, "Telemetry"). Without
# it, fact_reasoner.telemetry is a no-op. Mellea's extra is used rather than the
# bare OTel packages because Mellea configures the providers our spans join.
telemetry = ["mellea[telemetry]"]
# opentelemetry-sdk lets the test suite assert on spans and metrics in memory.
dev = ["pytest", "pytest-asyncio", "ruff", "mypy", "build", "twine", "opentelemetry-sdk"]
[project.scripts]
fact-reasoner = "fact_reasoner.cli:main"
[project.urls]
Source = "https://github.com/IBM/FactReasoner"
# Test configuration (previously a standalone pytest.ini). `pythonpath` is what
# lets the suite import `fact_reasoner` from src/ without an editable install.
[tool.pytest.ini_options]
testpaths = ["tests"]
pythonpath = ["src"]
addopts = "-ra -q"
markers = ["asyncio: mark test as asyncio"]
asyncio_mode = "auto"
[tool.uv]
# Security floors for transitive dependencies (not imported by fact_reasoner
# directly) that only matter for the lock, not for pip consumers (see the IBM
# OSPO security notification, issue #53). setuptools arrives via torch;
# < 83.0.0 is affected by CVE-2026-59890. cryptography arrives via the `dev`
# extra (twine -> keyring -> secretstorage, Linux only); < 50.0.0 is affected
# by GHSA-537c-gmf6-5ccf and CVE-2026-69247/69248/69249. pyjwt (< 2.15.0
# vulnerable) arrives via mcp whenever something in the tree pulls it in.
# filelock arrives via huggingface-hub and torch; < 4.2.1 is affected by
# CVE-2026-112940 (high) and CVE-2026-112907/112913. setuptools < 84.1.0 is also
# affected by GHSA-xmj3-9gf7-h52w (Windows-only legacy wheel install).
constraint-dependencies = [
"cryptography>=50.0.0",
"filelock>=4.2.1",
"pyjwt>=2.15.0",
"setuptools>=84.1.0",
]
[tool.hatch.build.targets.wheel]
packages = ["src/fact_reasoner"]
[tool.hatch.build.targets.sdist]
exclude = ["docs/", "data/", "lib/", "tests/", "configs/"]