-
Notifications
You must be signed in to change notification settings - Fork 1
/
pyproject.toml
205 lines (183 loc) · 5.06 KB
/
pyproject.toml
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
requires-python = ">=3.9"
name = "sparql-llm"
description = "Reusable components and complete chat system to improve Large Language Models (LLMs) capabilities when generating SPARQL queries for a given set of endpoints, using Retrieval-Augmented Generation (RAG) and SPARQL query validation from the endpoint schema."
readme = "README.md"
license = { file = "LICENSE.txt" }
authors = [
{ name = "Vincent Emonet", email = "vincent.emonet@gmail.com" },
]
maintainers = [
{ name = "Vincent Emonet", email = "vincent.emonet@gmail.com" },
]
keywords = [
"SPARQL",
"LLM",
"Expasy",
"KGQA",
]
classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dynamic = ["version"]
dependencies = [
"requests",
"rdflib",
"bs4",
"langchain",
"langchain-core",
"curies-rs >=0.1.3",
]
[project.optional-dependencies]
chat = [
"fastapi",
"pydantic >=2.0.0",
"pydantic-settings",
"openai",
"azure-ai-inference",
"qdrant_client",
"fastembed",
]
test = [
"pytest",
"pytest-cov",
"ruff",
"mypy",
"pyright",
"pip-tools",
"SPARQLWrapper",
"ipykernel",
"python-dotenv",
"pandas",
# "oxrdflib",
# "langchain-community",
# "jupyter",
# "ipywidgets",
# "tqdm",
]
gpu = [
"onnxruntime-gpu",
"fastembed-gpu",
]
[project.urls]
Homepage = "https://github.com/sib-swiss/sparql-llm"
Documentation = "https://github.com/sib-swiss/sparql-llm"
History = "https://github.com/sib-swiss/sparql-llm/releases"
Tracker = "https://github.com/sib-swiss/sparql-llm/issues"
Source = "https://github.com/sib-swiss/sparql-llm"
# Required for onnxruntime-gpu on CUDA 12
[tool.hatch.envs.default.env-vars]
PIP_EXTRA_INDEX_URL = "https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/"
# ENVIRONMENTS AND SCRIPTS
[tool.hatch.envs.default]
features = [
"test",
"chat",
]
post-install-commands = []
[tool.hatch.envs.default.scripts]
fmt = [
"ruff format",
"ruff check --fix",
]
test = [
"fmt",
# "mypy",
# "pyright",
"pytest {args}",
]
cov = [
"fmt",
"pytest --cov-report html {args}",
]
cov-check = [
"python -c 'import webbrowser; webbrowser.open(\"http://0.0.0.0:3000\")'",
"python -m http.server 3000 --directory ./htmlcov",
]
compile = "pip-compile -o requirements.txt pyproject.toml"
## TOOLS
[tool.hatch.version]
path = "src/sparql_llm/__init__.py"
[tool.hatch.build.targets.wheel]
packages = ["src/sparql_llm"]
# If you need to import packages from git URLs:
# [tool.hatch.metadata]
# allow-direct-references = true
[tool.mypy]
files = ["src/"]
strict = true
implicit_reexport = true
follow_imports = "normal"
ignore_missing_imports = true
pretty = true
show_column_numbers = true
warn_no_return = true
warn_unused_ignores = true
warn_redundant_casts = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_any_generics = true
# TODO: Use mypy or pyright for static type checking? Mypy is slow
# But pyright does not recognize the type of the curies Converter ("unknown import symbol"), while mypy does.
# So I guess pyright is garbage, I don't have time to fix all their bs, they should be better, classic microsoft
# https://microsoft.github.io/pyright/#/configuration?id=sample-pyprojecttoml-file
[tool.pytest.ini_options]
addopts = [
"-vvv", # Verbose level 3
"--durations=10", # Show 10 slowest tests durations
"--cov=src",
"--color=yes",
"--cov-report=term-missing",
]
# https://github.com/astral-sh/ruff#configuration
[tool.ruff]
target-version = "py39"
line-length = 120
exclude = [
"notebooks",
"**/__init__.py",
]
[tool.ruff.lint]
select = [
"I", # isort
"N", # pep8-naming
"S", # bandit
"A", # flake8-builtins
"YTT", # flake8-2020
"B", # flake8-bugbear
"C", # flake8-comprehensions
"ICN", # flake8-import-conventions
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"Q", # flake8-quotes
# "FBT", # flake8-boolean-trap
"F", # pyflakes
"UP", # pyupgrade
"E", # pycodestyle errors
"W", # pycodestyle warnings
"PLC", # pylint convention
"PLE", # pylint error
# "PLR", # pylint refactor Magic value used in comparison, consider replacing 400 with a constant variable
"PLW", # pylint warning
"RUF", # ruff specific
"T",
]
ignore = [
"E501", # line too long
"C901", # too complex
"T201", # do not use print
"B008", # do not perform function calls in argument defaults
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["I", "F401"] # module imported but unused
# Tests can use magic values, assertions, and relative imports:
"tests/**/*" = ["PLR2004", "S101", "S105", "TID252"]