-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpyproject.toml
More file actions
200 lines (187 loc) · 5.13 KB
/
Copy pathpyproject.toml
File metadata and controls
200 lines (187 loc) · 5.13 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
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "llm-bot-pipeline"
version = "0.1.0"
description = "Server-side query fan-out session reporting for LLM bot traffic analysis"
readme = "README.md"
requires-python = ">=3.10"
license = {text = "AGPL-3.0"}
authors = [
{name = "Data Team"}
]
dependencies = [
"cloudflare>=3.0.0",
"defusedxml>=0.7.1",
"pandas>=2.0.0",
"numpy>=1.24.0",
"openpyxl>=3.1.0",
"python-dateutil>=2.8.2",
"pyyaml>=6.0.0",
"httpx>=0.24.0",
"requests>=2.28.0",
]
[project.optional-dependencies]
gcp = [
"google-cloud-bigquery>=3.20.0",
"google-api-core>=2.18.0",
"google-cloud-monitoring>=2.0.0",
"google-cloud-secret-manager>=2.16.0",
]
ml = [
"scikit-learn>=1.3.0",
"scipy>=1.11.0",
"sentence-transformers>=2.2.0",
]
monitoring = [
"apscheduler>=3.10.0",
"prometheus-client>=0.19.0",
]
dev = [
"black>=24.0.0",
"isort>=5.13.0",
"bandit>=1.7.0",
"mypy>=1.0.0",
"pre-commit>=3.0.0",
"pytest>=8.0.0",
"pytest-benchmark>=4.0.0",
"pytest-cov>=4.1.0",
"pytest-timeout>=2.0.0",
"freezegun>=1.2.0",
]
viz = [
"matplotlib>=3.7.0",
]
[tool.coverage.run]
source = ["src/llm_bot_pipeline"]
branch = true
omit = [
"*/tests/*",
"*/__pycache__/*",
# Omitted: heavy external-SDK dependencies with no unit-testable seams
"*/monitoring/*",
"*/infrastructure/*",
"*/cloudflare/*",
]
[tool.coverage.report]
fail_under = 65
show_missing = true
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise NotImplementedError",
"if TYPE_CHECKING:",
"if __name__ == .__main__.:",
]
[tool.setuptools.packages.find]
where = ["src"]
[tool.black]
line-length = 88
target-version = ["py310"]
include = '\.pyi?$'
[tool.isort]
profile = "black"
line_length = 88
known_first_party = ["llm_bot_pipeline"]
[tool.bandit]
exclude_dirs = ["tests"]
skips = [
"B104", # 0.0.0.0 bind - intentional for Cloud Run
"B105", # "pass" - status string, not password
"B110", # try/except pass - intentional in some scripts
"B310", # urllib.urlopen - webhook URLs from config
"B311", # random - sample data generation, not crypto
"B404", # subprocess - gcloud, sops required
"B405", # xml.etree - defusedxml used for untrusted input
"B603", # subprocess - list args, no shell
"B607", # partial path - gcloud/sops in PATH
"B608", # SQL f-strings - BigQuery/SQLite table names from config
]
[tool.mypy]
python_version = "3.10"
warn_return_any = true
warn_unused_configs = true
ignore_missing_imports = true
exclude = [
"tests/",
"scripts/",
]
# Relax checks for modules with many third-party or complex type issues
[[tool.mypy.overrides]]
module = [
"llm_bot_pipeline.config.sops_loader",
"llm_bot_pipeline.sitemap.parser",
"llm_bot_pipeline.infrastructure.cloud_run_setup",
"llm_bot_pipeline.infrastructure.bigquery_setup",
"llm_bot_pipeline.infrastructure",
"llm_bot_pipeline.monitoring.metrics_export",
"llm_bot_pipeline.ingestion.providers.gcp_cdn.adapter",
"llm_bot_pipeline.ingestion.providers.fastly.adapter",
"llm_bot_pipeline.ingestion.providers.aws_alb.adapter",
"llm_bot_pipeline.ingestion.providers.akamai.adapter",
"llm_bot_pipeline.cloudflare.logpush_job",
"llm_bot_pipeline.cloudflare.logpull",
]
disable_error_code = [
"import-untyped",
"attr-defined",
"no-any-return",
"arg-type",
"union-attr",
"assignment",
"return-value",
"return",
"index",
"dict-item",
"misc",
"exit-return",
]
# Additional modules with type issues to address incrementally
[[tool.mypy.overrides]]
module = [
"llm_bot_pipeline.utils.bot_classifier",
"llm_bot_pipeline.monitoring.scheduler",
"llm_bot_pipeline.monitoring.data_quality",
"llm_bot_pipeline.monitoring.pipeline_metrics",
"llm_bot_pipeline.ingestion.parsers.w3c_parser",
"llm_bot_pipeline.ingestion.parsers.csv_parser",
"llm_bot_pipeline.storage.sqlite_backend",
"llm_bot_pipeline.storage.bigquery_backend",
"llm_bot_pipeline.research.temporal_analysis",
"llm_bot_pipeline.research.semantic_embeddings",
"llm_bot_pipeline.research.experiment_runner",
"llm_bot_pipeline.config.secret_manager",
"llm_bot_pipeline.health_server",
"llm_bot_pipeline.reporting.session_storage_writer",
"llm_bot_pipeline.reporting.local_dashboard_queries",
"llm_bot_pipeline.reporting.local_aggregations",
"llm_bot_pipeline.pipeline.local_pipeline",
"llm_bot_pipeline.pipeline.router",
]
disable_error_code = [
"return-value",
"attr-defined",
"union-attr",
"assignment",
"arg-type",
"no-any-return",
"var-annotated",
"misc",
"index",
"dict-item",
"return",
"exit-return",
]
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_functions = ["test_*"]
timeout = 60
markers = [
"ingestion: E2E ingestion stage test",
"transform: E2E transform stage test",
"aggregation: E2E aggregation stage test",
"query: E2E query stage test",
"bigquery: requires BigQuery backend (skipped in public CI)",
]