-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
531 lines (496 loc) · 16.1 KB
/
Copy pathpyproject.toml
File metadata and controls
531 lines (496 loc) · 16.1 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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
[build-system]
requires = ["setuptools>=68.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "ai-autonomous-assistant"
version = "0.1.0"
description = "AI Autonomous Assistant"
readme = "README.md"
requires-python = ">=3.11"
license = "MIT"
license-files = ["LICENSE.txt"]
keywords = ["AI", "Autonomous", "Assistant","Raspberry PI"]
authors = [
{name = "Chcavignx", email = "chcavignx@gmail.com"}
]
maintainers = [
{name = "Chcavignx", email = "chcavignx@gmail.com"}
]
classifiers = [
# How mature is this project? Common values are
# 1 - Planning
# 2 - Pre-Alpha
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
"Development Status :: 2 - Pre-Alpha",
# Indicate who your project is intended for
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
# Specify the Python versions you support here.
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
# Dépendances principales (runtime)
dependencies = [
"accelerate>=0.20.3",
"blobfile",
"datasets>=2.14.5",
"dotenv>=0.9.9",
"faster-whisper>=0.1.3",
"flask-cors>=4.0.0",
"flask>=2.3.0",
"huggingface-hub>=0.18.0",
"joblib>=1.3.0",
"lazy-loader>=0.2.0",
"librosa>=0.10.0",
"loguru>=0.7.0",
"numba>=0.57.0",
"numpy>=1.24.0",
"onnxruntime>=1.18.0",
"openai-whisper==20250625",
"piper-tts>=1.4.1",
"psutil>=7.2.2",
"pydantic>=2.0.0",
"pydub>=0.25.1",
"python-dotenv",
"pyttsx3>=2.90",
"pyyaml>=6.0",
"requests>=2.31.0",
"scipy>=1.11.0",
"silero-vad>=2.0.0",
"sounddevice>=0.5.5",
"soundfile>=0.12.1",
"tiktoken>=0.4.0",
"tokenizers>=0.19.0",
"torch==2.9.1",
"torchaudio==2.9.1",
"transformers>=4.35.0",
"typing-extensions>=4.12",
]
[project.optional-dependencies]
raspberry-pi = [
"rpi-ws281x>=0.1.0",
]
vision = [
"insightface>=1.0.1",
"opencv-python>=4.13.0.92",
"picamera2>=0.3.36",
"ultralytics>=8.4.78",
]
[tool.uv.sources]
openai-whisper = { git = "https://github.com/openai/whisper.git" }
faster-whisper = { git = "https://github.com/SYSTRAN/faster-whisper.git" }
ai-autonomous-assistant = { workspace = true }
[tool.uv.workspace]
members = [
".",
]
[tool.uv]
default-groups = ["dev"]
link-mode = "copy"
override-dependencies = [
"numpy>=1.26.0,<2.0"
]
environments = [
"sys_platform == 'darwin' and platform_machine == 'arm64'",
"sys_platform == 'linux' and platform_machine == 'aarch64'",
"sys_platform == 'linux' and platform_machine == 'x86_64'",
]
[dependency-groups]
dev = [
{ include-group = "lint" },
{ include-group = "test" },
"pre-commit>=4.5.1",
"pre-commit-hooks>=4.0.1",
"prek>=0.3.8",
]
lint = [
"flake8>=6.0.0",
"ruff>=0.15.8",
"types-requests>=2.32.4.20250913",
"basedpyright>=0.1.0",
]
test = [
"pytest>=9.0.2",
"pytest-cov>=4.1.0",
"pytest-mock>=3.10.0",
"pytest-xdist>=3.0.0",
"freezegun>=1.2.2",
"factory-boy>=3.2.1",
]
[tool.ruff]
target-version = "py311"
line-length = 120
output-format = "full"
src = ["src", "tests", "examples"]
extend-exclude = [
"examples/",
"scripts/",
"src/ai_autonomous_assistant.egg-info/",
"src/audio/",
".agents/",
".source/",
]
[tool.ruff.lint]
select = ["ALL"]
preview = true
ignore = [
"CPY001", # copyright notice (really?)
"D203", # blank line before class docstring (conflicts D211)
"D213", # multiline docstring second line (conflicts D212)
"COM812", # trailing comma - conflicts with ruff format
"ISC001", # implicit string concat - conflicts with ruff format
"TD003", # missing link in TODO
"FIX002", # line contains TODO (I have TODOs and I'm not apologizing)
"D100", "D101", "D102", "D103", "D104", "DOC201", "DOC402", "DOC501", # docstrings - I don't care about docstrings, Ruff. Relax.
"FBT", # Boolean positional args
"PLW0717", # Try clause contains too many statements
"PLC0415", # Import should be at the top-level
"BLE001", # Do not catch blind exception
"PLR", # Pylint refactor (complexity, magic values, etc.)
"C901", # Too complex
"ANN401", # Dynamically typed expressions (Any)
"S110", # try-except-pass
"S404", "S607", # subprocess insecure/partial path
"TRY401", # Redundant exception object in logger
"RUF069", # Unreliable floating point equality comparison
"E501", # Line too long (let formatting handle it)
"ARG", # Unused args
"RUF001", "RUF002" # Ambiguous characters
]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # assert is fine in tests, Ruff. Relax.
"PLR2004", # magic values in tests are normal
"ANN", # type annotations can be loose in tests
"D100", "D101", "D102", "D103", "D104", # docstrings in tests? come on
"ARG001", "ARG002", "ARG005", # unused args - hello, pytest fixtures and mocks
"SLF001", # accessing private attrs in tests is fine
"TRY003", "EM101", # exception messages in tests don't matter
"ERA001", # test method names can be less strict
"N802", # function naming - mock functions need specific names
"PLR6301", # methods that could be static - mock classes often don't need it
"PLC0415", # imports at function level - sometimes necessary for mocking
"TRY300", # try-else suggestions - tests often have try-except patterns
"S404", # subprocess import flagged as insecure - needed for testing
"BLE001", # blind exception catches - intentional in error handling tests
"PLW0108", # unused lambda result - sometimes necessary for mocking
"FBT", # Boolean positional arguments are normal/necessary in mocks/tests
]
[tool.ruff.format]
docstring-code-format = false
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py", "*_test.py", "__test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"--strict-markers",
"--strict-config",
"-ra",
"--tb=short",
"--cov=src",
"--cov-report=term-missing:skip-covered",
"--cov-report=xml",
# fail-under lives in [tool.coverage.report] — see below.
# 80% is the target for the full suite; the basic marker subset achieves ~30%.
]
filterwarnings = [
"error", # Treat all warnings as errors by default
"ignore:.*estimate.*:FutureWarning",
"ignore:.*estimate.*:FutureWarning:skimage",
"ignore::FutureWarning",
"ignore::FutureWarning:skimage",
# Uncomment to selectively ignore specific third-party warnings if needed:
# "ignore::DeprecationWarning:some_noisy_library",
# "ignore::UserWarning:another_library",
]
markers = [
"basic: marks basic infrastructure tests",
"integration: marks integration or long-running tests",
]
norecursedirs = [
"**/__pycache__",
"**/tests/__pycache__",
"**/*.pyc",
"**/dist/",
"**/*.egg-info/",
"**/.pytest_cache/",
"**/.mypy_cache/",
"**/.ruff_cache/",
"**/examples/",
"**/node_modules",
".git",
".pyright_cache",
".venv",
"venv",
"env",
"logs",
"outputs",
"*.egg-info",
".source"
]
[tool.coverage.run]
# Omit hardware-dependent modules that cannot execute in CI
# (no camera, microphone, GPU, or wake-word model files present)
omit = [
"src/audio/wake_word.py",
]
[tool.coverage.report]
# Realistic threshold for the `basic` marker subset (~30-35%).
# Raise this toward 80 as more tests are marked basic or integration tests
# are added to CI.
fail_under = 70
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"raise NotImplementedError",
'^\s*\.\.\.$',
]
[tool.basedpyright]
pythonVersion = "3.11"
venvPath = "."
useLibraryCodeForTypes = true
reportMissingTypeStubs = false
enableTypeIgnoreComments = false
extraPaths = ["."]
# baseline settings
baselineFile = ".tmp/basedpyright-baseline.json"
include = ["src", "examples"]
exclude = [
"scripts/",
"src/ai_autonomous_assistant.egg-info/",
".venv",
"venv",
"env",
".env",
".pytest_cache",
".git",
".ruff_cache",
".tmp",
"**/__pycache__",
"**/node_modules",
"logs",
"output",
"data",
"build",
"dist",
"*.egg-info",
"*.egg",
".agents/",
".source",
]
# ============================================================
# STRICT NULL SAFETY (like TS strictNullChecks)
# ============================================================
reportOptionalSubscript = true
reportOptionalMemberAccess = true
reportOptionalCall = true
reportOptionalIterable = true
reportOptionalContextManager = true
reportOptionalOperand = true
reportAny = true
reportExplicitAny = true
reportIgnoreCommentWithoutRule = false
reportPrivateLocalImportUsage = true
# ============================================================
# TYPE COMPLETENESS (like TS noImplicitAny + strictFunctionTypes)
# ============================================================
reportMissingParameterType = true
reportMissingTypeArgument = true
reportUnknownParameterType = true
reportUnknownLambdaType = true
reportUnknownArgumentType = true # STRICT: Enable (can be noisy)
reportUnknownVariableType = true # STRICT: Enable (can be noisy)
reportUnknownMemberType = true # STRICT: Enable (can be noisy)
reportUntypedFunctionDecorator = true
reportUntypedClassDecorator = true
reportUntypedBaseClass = true
reportUntypedNamedTuple = true
# ============================================================
# CLASS AND INHERITANCE CHECKS
# ============================================================
reportIncompatibleMethodOverride = true
reportIncompatibleVariableOverride = true
reportInconsistentConstructor = true
reportUninitializedInstanceVariable = true
reportOverlappingOverload = true
reportMissingSuperCall = true # STRICT: Enable
# ============================================================
# CODE QUALITY (like TS noUnusedLocals + noUnusedParameters)
# ============================================================
reportPrivateUsage = true
reportConstantRedefinition = true
reportInvalidStubStatement = true
reportIncompleteStub = true
reportUnsupportedDunderAll = true
reportUnusedClass = "error" # STRICT: Error instead of warning
reportUnusedFunction = "error" # STRICT: Error instead of warning
reportUnusedVariable = "error" # STRICT: Error instead of warning
reportUnusedImport = "error" # STRICT: Error instead of warning
reportDuplicateImport = "error" # STRICT: Error instead of warning
# ============================================================
# UNNECESSARY CODE DETECTION
# ============================================================
reportUnnecessaryIsInstance = "error" # STRICT: Error
reportUnnecessaryCast = "error" # STRICT: Error
reportUnnecessaryComparison = "error" # STRICT: Error
reportUnnecessaryContains = "error" # STRICT: Error
reportUnnecessaryTypeIgnoreComment = "error" # STRICT: Error
# ============================================================
# FUNCTION/METHOD SIGNATURE STRICTNESS
# ============================================================
reportGeneralTypeIssues = true
reportPropertyTypeMismatch = true
reportFunctionMemberAccess = true
reportCallInDefaultInitializer = true
reportImplicitStringConcatenation = true # STRICT: Enable
# ============================================================
# ADDITIONAL STRICT CHECKS (Progressive Enhancement)
# ============================================================
reportImplicitOverride = true # STRICT: Require @override decorator (Python 3.12+)
reportDeprecated = "warning" # Warn on deprecated usage
# ============================================================
# ADDITIONAL TYPE CHECKS
# ============================================================
reportImportCycles = "warning"
# ============================================================
# PER-DIRECTORY OVERRIDES
# Tests are written without full annotations by design (ruff
# also skips ANN for tests). Relax the noisy strict rules
# that fire on pytest-idiomatic patterns while keeping src/
# fully strict.
# ============================================================
[[tool.basedpyright.executionEnvironments]]
root = "tests"
reportUnknownParameterType = false
reportMissingParameterType = false
reportUnknownLambdaType = false
reportUnknownArgumentType = false
reportUnknownMemberType = false
reportUnknownVariableType = false
reportPrivateUsage = false
reportPrivateLocalImportUsage = false
reportAny = false
reportExplicitAny = false
reportUnusedParameter = false
reportAttributeAccessIssue = false
reportUnusedCallResult = false
reportImplicitOverride = false
reportUnannotatedClassAttribute = false
reportMissingTypeArgument = false
reportOptionalMemberAccess = false
reportCallIssue = false
reportArgumentType = false
reportMissingSuperCall = false
reportUninitializedInstanceVariable = false
reportUntypedFunctionDecorator = false
reportUntypedClassDecorator = false
reportUntypedBaseClass = false
[[tool.basedpyright.executionEnvironments]]
root = "examples"
reportUnknownParameterType = false
reportMissingParameterType = false
reportUnknownLambdaType = false
reportUnknownArgumentType = false
reportUnknownMemberType = false
reportUnknownVariableType = false
reportPrivateUsage = false
reportPrivateLocalImportUsage = false
reportAny = false
reportExplicitAny = false
reportUnusedParameter = false
reportAttributeAccessIssue = false
reportUnusedCallResult = false
reportImplicitOverride = false
reportUnannotatedClassAttribute = false
reportMissingTypeArgument = false
reportOptionalMemberAccess = false
reportCallIssue = false
reportArgumentType = false
reportMissingSuperCall = false
reportUninitializedInstanceVariable = false
reportUntypedFunctionDecorator = false
reportUntypedClassDecorator = false
reportUntypedBaseClass = false
[[tool.basedpyright.executionEnvironments]]
root = "src/vision"
reportUnknownParameterType = false
reportMissingParameterType = false
reportUnknownLambdaType = false
reportUnknownArgumentType = false
reportUnknownMemberType = false
reportUnknownVariableType = false
reportPrivateUsage = false
reportPrivateLocalImportUsage = false
reportAny = false
reportExplicitAny = false
reportUnusedParameter = false
reportAttributeAccessIssue = false
reportUnusedCallResult = false
reportImplicitOverride = false
reportUnannotatedClassAttribute = false
reportMissingTypeArgument = false
reportOptionalMemberAccess = false
reportCallIssue = false
reportArgumentType = false
reportMissingSuperCall = false
reportUninitializedInstanceVariable = false
reportUntypedFunctionDecorator = false
reportUntypedClassDecorator = false
reportUntypedBaseClass = false
[[tool.basedpyright.executionEnvironments]]
root = "src/audio"
reportUnknownParameterType = false
reportMissingParameterType = false
reportUnknownLambdaType = false
reportUnknownArgumentType = false
reportUnknownMemberType = false
reportUnknownVariableType = false
reportPrivateUsage = false
reportPrivateLocalImportUsage = false
reportAny = false
reportExplicitAny = false
reportUnusedParameter = false
reportAttributeAccessIssue = false
reportUnusedCallResult = false
reportImplicitOverride = false
reportUnannotatedClassAttribute = false
reportMissingTypeArgument = false
reportOptionalMemberAccess = false
reportCallIssue = false
reportArgumentType = false
reportMissingSuperCall = false
reportUninitializedInstanceVariable = false
reportUntypedFunctionDecorator = false
reportUntypedClassDecorator = false
reportUntypedBaseClass = false
[[tool.basedpyright.executionEnvironments]]
root = "src/utils"
reportUnknownParameterType = false
reportMissingParameterType = false
reportUnknownLambdaType = false
reportUnknownArgumentType = false
reportUnknownMemberType = false
reportUnknownVariableType = false
reportPrivateUsage = false
reportPrivateLocalImportUsage = false
reportAny = false
reportExplicitAny = false
reportUnusedParameter = false
reportAttributeAccessIssue = false
reportUnusedCallResult = false
reportImplicitOverride = false
reportUnannotatedClassAttribute = false
reportMissingTypeArgument = false
reportOptionalMemberAccess = false
reportCallIssue = false
reportArgumentType = false
reportMissingSuperCall = false
reportUninitializedInstanceVariable = false
reportUntypedFunctionDecorator = false
reportUntypedClassDecorator = false
reportUntypedBaseClass = false