-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
189 lines (172 loc) · 5.04 KB
/
pyproject.toml
File metadata and controls
189 lines (172 loc) · 5.04 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
# OpenAudio Python Project Configuration
[project]
name = "openaudio"
version = "0.1.0"
description = "AI-powered audio analysis platform with speaker diarization, sound event detection, and semantic search"
authors = [
{name = "OpenAudio Contributors"}
]
requires-python = ">=3.11"
readme = "README.md"
license = {text = "MIT"}
keywords = ["audio", "ai", "speaker-diarization", "sound-detection", "machine-learning"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Multimedia :: Sound/Audio :: Analysis",
]
[tool.ruff]
line-length = 100
target-version = "py311"
exclude = [
".git",
".mypy_cache",
".ruff_cache",
".venv",
"venv",
"__pycache__",
"node_modules",
"alembic/versions",
"backend/app/ml/models/beats_module.py", # Vendored from Microsoft BEATs
]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"ARG", # flake8-unused-arguments
"SIM", # flake8-simplify
"S", # flake8-bandit (security)
"RUF", # Ruff-specific rules
]
ignore = [
"E501", # Line too long - handled by formatter
"B008", # Do not perform function calls in argument defaults
"W191", # Indentation contains tabs
"B904", # Allow raising exceptions without from e, for HTTPException
"S101", # Use of assert - allowed in tests
"S104", # Possible binding to all interfaces
"S603", # Subprocess call - checked manually for safety
"ARG001", # Unused function argument - common in FastAPI
]
[tool.ruff.lint.isort]
known-first-party = ["app", "workers"]
[tool.ruff.lint.per-file-ignores]
"backend/tests/**/*.py" = [
"S101", # assert in tests
"S105", # hardcoded passwords in test fixtures
"S106", # hardcoded password arguments in tests
"S110", # try-except-pass in test helpers
"ARG001", # unused function arguments (FastAPI deps)
"ARG002", # unused method arguments (pytest fixtures)
"E402", # imports after env setup in conftest
"B007", # unused loop variable
"B017", # pytest.raises(Exception)
"SIM102", # nested if in test logic
"SIM117", # nested with statements
"UP038", # isinstance union syntax
"F841", # unused local variable in test setup
]
"backend/alembic/**/*.py" = ["E501"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
[tool.mypy]
python_version = "3.11"
warn_return_any = false
warn_unused_configs = true
disallow_untyped_defs = false
disallow_incomplete_defs = false
check_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = false
warn_no_return = true
strict_equality = true
ignore_missing_imports = true
namespace_packages = true
explicit_package_bases = true
mypy_path = "backend"
[[tool.mypy.overrides]]
module = [
"alembic.*",
"celery.*",
"pyannote.*",
"minio.*",
"torch.*",
"torchaudio.*",
"essentia.*",
"aiofiles.*",
"df.*",
"funasr.*",
"pgvector.*",
]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "alembic.versions.*"
ignore_errors = true
# ML models - dynamic loading means mypy can't track types well
[[tool.mypy.overrides]]
module = [
"app.ml.models.*",
"app.ml.registry",
]
ignore_errors = true
# Database models - SQLAlchemy declarative has complex typing
[[tool.mypy.overrides]]
module = "app.db.models.*"
ignore_errors = true
# Tests - loose typing, dynamic fixtures, mocks
[[tool.mypy.overrides]]
module = "tests.*"
ignore_errors = true
[tool.bandit]
exclude_dirs = ["tests", "venv", ".venv", "node_modules", "alembic"]
skips = ["B101", "B404", "B601", "B603"] # Skip assert_used, subprocess imports
[tool.bandit.assert_used]
skips = ["*_test.py", "test_*.py"]
[tool.pytest.ini_options]
testpaths = ["backend/tests"]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = "-v --tb=short --strict-markers"
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"unit: marks tests as unit tests",
"gpu: marks tests requiring GPU",
"torch: tests requiring PyTorch (diarization, BEATs, emotion2vec)",
"tf: tests requiring TensorFlow (YAMNet)",
"sam: tests requiring SAM Audio",
"enhance: tests requiring DeepFilterNet",
"cpu: tests for CPU-only operations (features, clustering)",
]
[tool.coverage.run]
source = ["app"]
omit = [
"*/tests/*",
"*/test_*.py",
"*/__pycache__/*",
"*/venv/*",
"*/.venv/*",
"*/alembic/*",
]
[tool.coverage.report]
precision = 2
show_missing = true
skip_covered = false
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"if __name__ == .__main__.:",
]