-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathpyproject.toml
More file actions
325 lines (298 loc) · 10.8 KB
/
pyproject.toml
File metadata and controls
325 lines (298 loc) · 10.8 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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
[project]
name = "galileo"
version = "1.28.0"
description = "Client library for the Galileo platform."
authors = [{ name = "Galileo Technologies Inc.", email = "team@galileo.ai" }]
readme = "README.md"
requires-python = ">=3.9,<3.14"
dynamic = ["dependencies"]
[tool.poetry.dependencies]
python = "^3.9,<3.14"
pydantic = "^2.11.7"
pyjwt = "^2.8.0"
wrapt = "^1.14"
attrs = ">=22.2.0"
python-dateutil = "^2.8.0"
langchain-core = { version = "^0.3.68", optional = true }
openai = { version = "<1.96.0", optional = true }
openai-agents = { version = "<0.2.1", optional = true }
galileo-core = "~=3.67.3"
backoff = "^2.2.1"
crewai = { version = ">=0.152.0,<=0.201.1", optional = true, python = ">=3.10,<3.14" }
[tool.poetry.group.test.dependencies]
pytest = "^8.4.0"
coverage = "^7.9.2"
pytest-cov = "^6.0.0"
pytest-xdist = "^3.7.0"
pytest-socket = "^0.7"
pytest-asyncio = "^1.0.0"
requests-mock = "^1.11.0"
galileo-core = { extras = ["testing"], version = "~=3.67.3" }
pytest-env = "^1.1.5"
langchain-core = "^0.3.68"
pytest-sugar = "^1.0.0"
vcrpy = "^7.0.0"
time-machine = "^2.17.0" # freezegun causes problems with pydantic model validations
[tool.poetry.group.dev.dependencies]
pre-commit = "^4.0.1"
mypy = "^1.16.0"
openai = "^1.95.1"
codeflash = ">=0.12.3"
ruff = "^0.12.3"
openapi-python-client = "^0.26.1"
yq = "^3.4.3"
pyyaml = "^6.0.2"
[tool.pytest.ini_options]
pythonpath = ["./src/"]
env = [
"GALILEO_CONSOLE_URL=http://localtest:8088",
"GALILEO_API_KEY=api-1234567890",
"GALILEO_PROJECT=test-project",
"GALILEO_LOG_STREAM=test-log-stream",
]
addopts = [
# Run tests in parallel.
"-n",
"auto",
# Show local variables in tracebacks.
"--showlocals",
# Show extra test summary info as specified by chars.
"-o",
"console_output_style=progress",
# Disable warnings.
"--disable-warnings",
# Show slowest 10 test durations.
"--durations=10",
# Disable internet access.
"--disable-socket",
# Enable local socket access.
"--allow-hosts=127.0.0.1,localhost",
]
asyncio_default_fixture_loop_scope = "function"
# Linters and formatters.
[tool.ruff]
line-length = 120
fix = true
src = ["src"]
unsafe-fixes = true
target-version = "py39"
exclude = [
"src/galileo/resources",
]
[tool.ruff.format]
skip-magic-trailing-comma = true
[tool.ruff.lint]
select = [
# Pyflakes (basic errors)
"F",
# Pycodestyle (style errors)
"E4", "E7", "E9", "W6",
# Import sorting
"I",
# Pyupgrade (Python version upgrades)
"UP",
# Async-related checks
"ASYNC",
# Flake8-bugbear (common bugs)
"B",
# Flake8-comprehensions (list/set/dict comprehension issues)
"C4",
# Flake8-pie (unnecessary code patterns)
"PIE",
# Flake8-simplify (code simplification)
"SIM",
# Pylint-like rules (selective)
"PLC", "PLE", "PLW",
# Ruff-specific rules
"RUF",
# Flake8-bandit (security issues)
"S",
# Flake8-blind-except (bare except clauses)
"BLE",
# Flake8-boolean-trap (boolean trap antipattern)
"FBT",
# Flake8-unused-arguments
"ARG",
# Flake8-pytest-style
"PT",
# Flake8-return (return statement issues)
"RET",
# Flake8-implicit-str-concat
"ISC",
# Type checking related (important for bug catching)
"ANN001", "ANN201", "ANN202", "ANN205", "ANN206",
# Flake8-print (no print statements in production code)
"T201",
# Import outside top-level (prevent local imports)
"PLC0415",
# pydocstyle (docstring conventions)
"D",
]
ignore = [
# Ignore overly strict rules (aligned with popular frameworks)
"S101", # Use of assert (needed for tests)
"PLR0913", # Too many arguments
"PLR2004", # Magic value used in comparison
"B008", # Do not perform function calls in argument defaults
"FBT001", # Boolean positional arg in function definition
"FBT002", # Boolean default arg in function definition
"S603", # subprocess call: check for execution of untrusted input
"S607", # Starting a process with a partial executable path
"PLR0911", # Too many return statements
"PLR0912", # Too many branches
"PLR0915", # Too many statements
"PLW2901", # Redefined loop variable
# Type annotation related (balance strictness)
"ANN101", # Missing type annotation for `self` (unnecessary)
"ANN102", # Missing type annotation for `cls` (unnecessary)
"ANN002", # Missing type annotation for `*args` (impractical to enforce)
"ANN003", # Missing type annotation for `**kwargs` (impractical to enforce)
"ANN401", # Dynamically typed expressions (Any) are disallowed
# Unused arguments (often legitimate in wrappers, callbacks, etc.)
"ARG001", # Unused function argument
"ARG002", # Unused method argument
"ARG005", # Unused lambda argument (common in callbacks)
# Exception handling (often too strict)
"BLE001", # Do not catch blind exception (sometimes necessary)
"B904", # Use raise ... from err (not always needed)
# Style preferences (overly pedantic)
"SIM102", # Use single if statement (readability preference)
"PLC0206", # Extracting value from dictionary without calling .items()
"PLW0127", # Self-assignment of variable (sometimes needed)
# Additional common ignores from popular frameworks
"S311", # Standard pseudo-random generators (false positive for backoff/timing)
"S324", # Insecure hash functions (sometimes needed for non-crypto)
"PLR0914", # Too many local variables
# Docstring rules - allow missing docstrings but enforce format when present
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class
"D107", # Missing docstring in __init__
"D205", # 1 blank line required between summary line and description
"D401", # First line of docstring should be in imperative mood
"D404", # First word of the docstring should not be "This"
]
[tool.ruff.lint.per-file-ignores]
# Ignore most linting rules for test files (focus on functionality, not style)
"tests/**/*.py" = [
# Type annotations (not critical for tests)
"ANN", # All annotation rules
# Complexity (tests can be complex)
"PLR", # All pylint refactor rules (complexity, etc.)
# Security (tests often need assertions, subprocess, etc.)
"S", # All bandit security rules
# Style preferences (less important in tests)
"FBT", # Boolean trap rules
"ARG", # Unused argument rules
"RET", # Return statement rules
"SIM", # Simplify rules
"C4", # Comprehension rules
"PIE", # Unnecessary code patterns
"ISC", # Implicit string concatenation
# Common test patterns
"B008", # Function calls in argument defaults
"B017", # Do not assert blind exception (needed for pytest.raises)
"PT", # Pytest style rules (can be overly strict)
"T201", # Print statements (allowed in tests for debugging)
"D", # All docstring rules (not critical for tests)
]
# Allow print statements in examples (they're documentation) and scripts (utility tools)
"examples/**/*.py" = [
"T201", # Print statements (allowed in examples)
"D", # All docstring rules (examples focus on usage, not documentation)
]
"scripts/**/*.py" = [
"T201", # Print statements (allowed in scripts)
"BLE001", # Catching too general exception (utility scripts need flexibility)
"D", # All docstring rules (scripts are utility tools)
]
# Allow local imports in these files (needed to avoid circular dependencies or conditional imports)
"src/galileo/utils/prompts.py" = ["PLC0415"]
"src/galileo/utils/datasets.py" = ["PLC0415"]
"src/galileo/utils/serialization.py" = ["PLC0415"] # Optional dependency conditional imports
"src/galileo/handlers/crewai/handler.py" = ["PLC0415"] # Version-specific conditional imports
[tool.ruff.lint.isort]
known-first-party = ["galileo_core"]
split-on-trailing-comma = false
[tool.ruff.lint.pydocstyle]
convention = "numpy"
[tool.docformatter]
style = "numpy"
recursive = true
wrap-summaries = 120
wrap-descriptions = 120
[tool.mypy]
mypy_path = ["src"]
# Type checking strictness (balanced for production use)
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = false # Often problematic with third-party decorators
disallow_untyped_calls = false # Set to false to avoid issues with external libraries
# Error detection
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = false # Too noisy with external APIs
warn_unreachable = true
# Import handling
ignore_missing_imports = true
follow_imports = "skip"
# Optional handling
no_implicit_optional = true # Good practice for modern Python
strict_optional = true
# Error codes (balanced approach)
disable_error_code = [
"import-untyped",
"misc", # Disable misc warnings (like untyped decorators we can't control)
]
enable_error_code = ["truthy-bool", "redundant-expr", "unused-awaitable"]
# Plugins
plugins = ["pydantic.mypy"]
# Additional strictness (keep what catches real bugs)
check_untyped_defs = true
strict_equality = true
extra_checks = true
# Performance and compatibility
show_error_codes = true
pretty = true
show_column_numbers = true
# Incremental mode for better performance on individual files
incremental = true
sqlite_cache = true
# Release.
[tool.semantic_release]
version_variables = ["src/galileo/__init__.py:__version__"]
version_toml = ["pyproject.toml:project.version"]
version_source = "tag"
commit_message = "chore(release): v{version}\n\nAutomatically generated by python-semantic-release"
[tool.semantic_release.commit_parser_options]
# Release patch version on these tags,
# https://python-semantic-release.readthedocs.io/en/latest/configuration.html#commit-parser-options-dict-str-any
patch_tags = ["fix", "perf", "chore", "docs", "style", "refactor"]
[tool.coverage.run]
omit = [
# ignore autogenerated code
"./src/galileo/resources/*",
]
[tool.codeflash]
# All paths are relative to this pyproject.toml's directory.
module-root = "./src/galileo"
tests-root = "tests"
test-framework = "pytest"
ignore-paths = [
"./src/galileo/resources/" # Exclude auto-generated API endpoint functions.
]
disable-telemetry = false
formatter-cmds = ["ruff check --exit-zero --fix $file", "ruff format $file"]
[project.optional-dependencies]
langchain = ["langchain-core"]
openai = ["openai", "packaging (>=24.2,<25.0)", "openai-agents"]
crewai = ["crewai (>=0.152.0,<=0.201.1)"]
all = ["langchain-core", "openai", "crewai"]
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
# Test.