Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
215 lines (192 loc) · 6.29 KB
/
Copy pathpyproject.toml
File metadata and controls
215 lines (192 loc) · 6.29 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# spell-checker:disable
# Check for outdated: uv tree --outdated --depth 1
# Upgrade within constraints: uv lock --upgrade
[build-system]
requires = ["setuptools>=80.0.0", "setuptools_scm", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "ai-optimizer"
dynamic = ["version"]
description = "Oracle AI Optimizer and Toolkit"
requires-python = ">=3.12,<3.15,!=3.14.1"
license = "UPL-1.0"
authors = [
{name = "Oracle", email = "obaas_ww@oracle.com"}
]
# - common dependencies that are always needed
dependencies = [
"langchain==1.4.5",
"httpx==0.28.1",
"oracledb~=26.0",
"pydantic-settings==2.15.0"
]
[project.optional-dependencies]
# Server component dependencies
# - server: server side only
server = [
"docling==2.138.0",
"faiss-cpu==1.15.1",
"fastapi==0.143.0",
"fastmcp==3.4.7",
"giskard==3.0.1",
"langchain-litellm==0.11.0",
"langchain-mcp-adapters==0.3.2",
"langchain-oracledb==1.6.0",
"litellm==1.105.0",
"llama-index-core==0.14.25",
"oci~=2.0",
"pyagentspec==26.3.1",
"pypdf==6.20.1",
"torch", # Direct requirement to select the CPU-only PyTorch distribution for Docling.
"torchvision", # Direct requirement to select the CPU-only PyTorch distribution for Docling.
]
# - client: client side only
client = [
"streamlit==1.65.0",
]
# - otel: opentelemetry collector for server-side observability
otel = [
"opentelemetry-distro==0.66b1",
"opentelemetry-exporter-otlp==1.45.1",
"opentelemetry-instrumentation-fastapi==0.66b1",
"opentelemetry-instrumentation-httpx==0.66b1",
"opentelemetry-instrumentation-logging==0.66b1",
"opentelemetry-instrumentation-requests==0.66b1",
"openinference-instrumentation-langchain==0.1.79"
]
# - all: all-in-one installation (server (langgraph) + client)
all = [
"ai-optimizer[server]",
"ai-optimizer[client]",
"ai-optimizer[otel]",
]
[dependency-groups]
# Development-only tooling. Install explicitly with `uv sync --group dev`.
dev = [
"bandit",
"docker",
"mypy",
"types-psutil",
"pandas-stubs",
"ruff",
"pyright[nodejs]",
"pytest-asyncio",
"pytest-cov",
"types-jsonschema",
"yamllint"
]
[tool.uv]
# Application installs should not include development tooling.
default-groups = []
# Ensure packages without source distributions are installable on every supported platform.
required-environments = [
"sys_platform == 'linux' and platform_machine == 'x86_64'",
"sys_platform == 'linux' and platform_machine == 'aarch64'",
"sys_platform == 'darwin' and platform_machine == 'arm64'",
"sys_platform == 'win32' and platform_machine == 'AMD64'",
]
[tool.uv.sources]
torch = { index = "pytorch-cpu" }
torchvision = { index = "pytorch-cpu" }
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true
[tool.setuptools]
# ``src/`` is the package root; the wheel ships its contents at the top
# level (``server``, ``client``, plus the bare-name modules below) so
# runtime imports like ``from server.app...`` resolve directly.
py-modules = ["_version", "entrypoint", "logging_config", "logging_redaction", "net_addressing", "runtime_config_fields", "url_safety"]
[tool.setuptools.package-dir]
"" = "src"
[tool.setuptools.packages.find]
where = ["src"]
namespaces = false
include = ["server*", "client*"]
[tool.pytest.ini_options]
pythonpath = ["src", "tests"]
addopts = "--import-mode=importlib"
# anyio is the single async-test backend (see the root conftest.py). ``anyio_mode =
# auto`` makes anyio claim every coroutine test and its async fixtures at collection
# time, with no per-test marker. pytest-asyncio stays installed but pinned to
# ``strict`` so it only ever acts on the (unused) ``@pytest.mark.asyncio`` marker,
# never auto-claiming async tests/fixtures and racing anyio for the event loop.
anyio_mode = "auto"
asyncio_mode = "strict"
filterwarnings = [
"ignore::DeprecationWarning",
"ignore::RuntimeWarning:litellm",
"ignore::requests.exceptions.RequestsDependencyWarning",
# LiteLLM's ReadOnly field is enforced by type checkers.
"ignore:Item 'summary' on TypedDict class 'ChatCompletionReasoningItem'.*`ReadOnly`:UserWarning:pydantic",
]
markers = [
"unit: Unit tests (mocked dependencies, fast execution)",
"integration: Integration tests (real components, may require external services)",
"slow: Slow tests (deselect with '-m \"not slow\"')",
"db: Tests requiring Oracle database container (deselect with '-m \"not db\"')",
"live_oci: Live tests against OCI GenAI (needs AIO_GENAI_COMPARTMENT_ID + AIO_GENAI_REGION; auto-skips otherwise)",
]
norecursedirs = ["tmp", "build"]
[tool.pyright]
pythonVersion = "3.12"
extraPaths = ["src"]
exclude = [
"**/.*",
"**/.venv",
"**/__pycache__",
"**/node_modules",
"build",
"src/client/source",
"tmp/"
]
[tool.ruff]
line-length = 120
target-version = "py312"
src = ["src"]
extend-exclude = ["**/wip/**", "src/client/mcp", "docs/themes/relearn", "docs/public", "docs/static/demoware", "docs/demo"]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"F", # pyflakes
"W", # pycodestyle warnings
"I", # isort
"PL", # pylint (PLC, PLE, PLR, PLW)
"SIM", # flake8-simplify
"SLF", # flake8-self (protected-access)
"ARG", # flake8-unused-arguments
]
ignore = [
"BLE001", # broad-exception-caught
"PLR2004", # magic-value-comparison
"SIM102", # collapsible-if
]
[tool.ruff.lint.pylint]
max-args = 10
max-branches = 15
max-locals = 16
max-returns = 6
max-statements = 50
max-nested-blocks = 6
max-bool-expr = 6
[tool.ruff.lint.per-file-ignores]
"src/client/source/**" = ["ALL"]
"**/tests/**" = [
"E402", # module-import-not-at-top-of-file
"SLF001", # protected-access
"PLC0415", # import-outside-toplevel
"ARG001", # unused-function-argument
"ARG002", # unused-method-argument
"ARG005", # unused-lambda-argument
"PLR0913", # too-many-arguments
"PLR0915", # too-many-statements
"PLR2004", # magic-value-comparison
]
[tool.ruff.format]
quote-style = "double"
[tool.bandit]
# Run as: bandit -c pyproject.toml -r .
exclude_dirs = [".venv", "tests", "src/tests", "src/client/tests", "src/server/tests", "build", "docs", "opentofu"]
[tool.setuptools_scm]
root = "."
fallback_version = "0.0.0"