Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
530 lines (504 loc) · 22.9 KB
/
Copy pathpyproject.toml
File metadata and controls
530 lines (504 loc) · 22.9 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
[project]
name = "eyenet"
version = "1.3.12.1"
description = "Observation framework for forensic analysis of threat actors. Sibling of DECNET, consumer of BEHAVE-TEXT."
readme = "README.md"
requires-python = ">=3.12"
authors = [{ name = "ANTI" }]
license = { text = "Proprietary" }
dependencies = [
# core
"pydantic>=2.7",
"sqlmodel>=0.0.22",
"sqlalchemy>=2.0",
# YAML: runtime dep since the stealer rule catalog, families catalog, and
# MITRE TTPs catalog are all YAML-driven and imported at module scope
# (eyenet/stealer/families, /rules/catalog, /ttps, /rules/matchers).
# Lived in optional-dependencies before v1.3.5; the API container only
# booted because a transitive dep (uvicorn, httpx, ...) pulled pyyaml in
# as a sidecar. A dep-tree shuffle in the latest build broke that.
"pyyaml>=6",
# storage — async SQLite is the mandated engine (sqlite+aiosqlite, CLAUDE.md
# §2.5). aiosqlite is the DBAPI driver; greenlet is SQLAlchemy's async bridge
# (only auto-installed on some platforms, so pin it explicitly).
"aiosqlite>=0.20",
"greenlet>=3",
"sqlite-vec>=0.1.6",
# Postgres backend (EYENET_STORAGE_TYPE=postgres) — the high-ingest prod
# target (concurrent writers; SQLite's single-writer wall is the reason).
# asyncpg drives the request path (postgresql+asyncpg://); psycopg drives the
# sync DDL/Alembic engine (postgresql+psycopg://). SQLite stays the default.
"asyncpg>=0.30",
"psycopg[binary]>=3.2",
# Schema migrations. Baseline lands at v0.1.0; `eyenet init` runs
# `upgrade_to_head` (migration history is the source of truth, create_all is
# retired). Runtime dep — the boot path imports it, not just dev tooling.
"alembic>=1.13",
# bus
"nats-py>=2.7",
# collectors (telegram first)
"telethon>=1.36",
"tgcrypto>=1.2", # MTProto AES-IGE acceleration for telethon
"PySocks>=1.7", # socks proxy support; transitive from telethon, imported directly
# tdata import: convert a bought Telegram Desktop tdata folder to a Telethon
# .session OFFLINE (reuse the auth key, no login). Lazy-imported only on the
# tdata provisioning path. Pulls pyrogram transitively (opentele's other target).
"opentele>=1.15",
# Matrix collector. [e2e] pulls python-olm (libolm bindings) for Megolm
# decryption + persistent device store. Operator must have libolm
# installed system-wide (apt: libolm-dev, dnf: libolm-devel, brew: libolm).
"matrix-nio[e2e]>=0.24",
# Forum collectors (MyBB/phpBB). html5lib is the WHATWG-spec HTML5 parser
# (browser-faithful tree construction on the malformed markup threat-actor
# forums emit); beautifulsoup4 rides on top for the selector API. Evidence-
# grade parsing of adversarial HTML, so a core dep, not jail-only.
"beautifulsoup4>=4.15.0",
"html5lib>=1.1",
# Discovery noise filter: leak forums are full of SQL dumps, and a regex can't
# tell a chat @handle from a mysqldump @variable (SET @old_unique_checks=...).
# sqlglot is a real multi-dialect SQL parser (pure-python, zero transitive
# deps, offline); the channel-reference extractor skips any line that PARSES as
# SQL, killing the dump-variable noise deterministically. See
# eyenet/sensor/discovery/channel_reference_extraction.py.
"sqlglot>=25,<31",
# http api (graph query + operator surface)
"fastapi>=0.115",
# Starlette is imported directly for StarletteHTTPException translation in
# eyenet/api/app.py exception handlers. Declared explicitly so deptry does
# not flag it as a transitive-via-fastapi dependency (brittle on bumps).
"starlette>=0.40",
# ASGI server: Hypercorn, not uvicorn (API_PLAN §12.1). uvicorn is h11-only
# and we forbid HTTP/1.1; Hypercorn speaks h2 natively and h3 via aioquic
# (the [h3] extra). See eyenet/api/_serve.py.
"hypercorn[h3]>=0.17",
"httpx[socks]>=0.27", # used by fastapi TestClient and any outbound http; [socks] (socksio) routes forum collectors over Tor to .onion mirrors (Cloudflare bypass)
"brotli>=1.1", # lets httpx DECODE br responses -> the Tor-Browser Accept-Encoding (gzip,deflate,br,zstd) is honest, not advertising a codec we can't inflate
"zstandard>=0.22", # ditto for zstd (Tor Browser advertises it); httpx auto-uses it when present
"curl-cffi>=0.16,<0.17", # forum collector TLS impersonation on CLEARNET WAF boards (DDoS-Guard/Cloudflare): speaks a real Firefox JA3/JA4 instead of httpx's OpenSSL tell. Lazy-imported, only the forum_tls_impersonate path uses it. Target set + FF-version coupling: eyenet/collectors/forum/_timing_presets.py + CLAUDE.md
"python-multipart>=0.0.9", # fastapi multipart/form-data (identity session upload)
# telemetry
"opentelemetry-api>=1.27",
"opentelemetry-sdk>=1.27",
"opentelemetry-exporter-otlp-proto-grpc>=1.27",
"opentelemetry-exporter-prometheus>=0.48b0", # M9.6 /v1/metrics scrape
"prometheus-client>=0.20", # M9.6 /v1/metrics text exposition (generate_latest)
"structlog>=24.1",
# crypto / opsec
"cryptography>=43",
"argon2-cffi>=23.1", # M9.A2 password hashing
"pyjwt[crypto]>=2.8", # M9.A2 RS256 JWT sign/verify (crypto extra → cryptography backend)
"cachetools>=5.3", # M9.A2 auth resolver TTL cache
"types-cachetools>=5.5", # type stubs for the above
"pyotp>=2.9", # M9.A3 TOTP RFC 6238
# domain normalization — IDNA2008 + UTS46 (stdlib codec is IDNA2003 only,
# silently NFKC-folds adversarial input and defeats homograph defense).
"idna>=3.7",
# bare-domain extraction — Public Suffix List validation so a dotted token is
# accepted as a domain only if its suffix is a real TLD (kills file.pdf, v1.2,
# node.js false positives a plain dotted-label regex can't). Used OFFLINE with
# the bundled PSL snapshot (suffix_list_urls=()) — no network, honors the
# curl/wget block. See eyenet/sensor/discovery/url_extraction.py.
"tldextract>=5.1",
# cli
"typer>=0.12",
"rich>=13.7",
# ids
"uuid7>=0.1",
# host self-report — CPU/RAM/disk for /v1/system + eyenet_sys_* gauges
# (already transitive; declared direct because eyenet imports it).
"psutil>=5.9",
"types-psutil>=5.9", # type stubs for the above (mirrors types-cachetools)
# behave (sibling specs — now published on PyPI; resolved like any other dep)
"behave-core>=0.1.1",
"behave-text>=0.1.4",
# nlp (locale-aware primitives — M6.5 spaCy trio).
# Core dep, not optional: EYENET ships small-operator CTI; operators
# accept the storage cost in exchange for working software out of the box.
# The es_core_news_sm model (~13MB) is auto-fetched on first run by
# eyenet/sensor/primitives/_locale_morph_kernel.py.
"spacy>=3.7,<4.0",
# classifier — regex ruleset spine (M10 slice 3). RE2 is a linear-time,
# ReDoS-immune engine: the classifier matches operator-editable rules over
# threat-actor-authored text, where a backtracking engine is a DoS vector.
# Runs in the main app (consumes already-extracted text), so it is a core dep,
# not a jail-only extract dep. Imports as `re2`.
"google-re2>=1.1",
"phonenumbers>=9.0.31",
"pycountry>=26.2.16",
# linker — crypto-address checksum gate (eyenet/linker/_address_checksum.py).
# keccak-256 for Ethereum EIP-55 + Monero checksums (NOT hashlib's NIST SHA-3).
# Already transitive; declared direct because eyenet imports it (mirrors psutil).
"pycryptodome>=3.23",
# stealer ULP — ClickHouse HTTP client. Core (not just the stealer profile image)
# because the API serves the read:stealer search/stats endpoints off the creds
# corpus. Lightweight pure-python HTTP client; the heavy extraction toolchain
# (unar/ulpextract) stays in the opt-in Dockerfile.stealer.
"clickhouse-connect>=0.8",
]
[project.optional-dependencies]
dev = [
# runtime test
"pytest>=8",
"pytest-asyncio>=0.23",
"pytest-cov>=5",
"pytest-xdist>=3.6",
"pytest-timeout>=2.3",
"pytest-randomly>=3.15",
"pytest-benchmark>=4",
"hypothesis>=6.108",
"hypothesis-jsonschema>=0.23",
"syrupy>=4.6",
"polyfactory>=2.16",
"dirty-equals>=0.8",
"freezegun>=1.5",
"respx>=0.21",
"testcontainers[nats]>=4.7",
# load
"locust>=2.31",
# static / sec
"mypy>=1.11",
"ruff>=0.6",
"bandit[toml]>=1.7",
"deptry>=0.20",
"pip-audit>=2.7",
"detect-secrets>=1.5",
]
deferred = [
# earned when Graph API has OpenAPI
"schemathesis>=3.34",
# earned when primitive suite is stable
"mutmut>=2.5",
]
# M10 Document Classifier — extraction parser libraries. DELIBERATELY NOT in the
# main `dependencies`: these parse hostile, attacker-controlled documents and run
# ONLY inside the nsjail sandbox (eyenet/classifier/sandbox/). They install into a
# dedicated, minimal `eyenet-extract` venv that is bound READ-ONLY into the jail —
# least functionality on the hostile-parse boundary, so a parser exploit never
# reaches the main app's deps. Build the jail venv with:
# python -m venv /opt/eyenet/extract-venv
# /opt/eyenet/extract-venv/bin/pip install 'eyenet[extract]'
# System binaries (nsjail, tesseract-ocr) and the spaCy model are provisioned
# separately — see the install docs. spaCy itself is already a core dep above.
# Versions are forward-declared for slice 2; pins get locked when the adapters
# are wired and straced against the seccomp allowlist.
extract = [
"pymupdf>=1.24,<2.0", # PDF text + embedded-image extraction (AGPL — OK)
"python-docx>=1.1,<2.0", # DOCX text extraction
"pytesseract>=0.3.10,<0.4", # OCR (wraps the system `tesseract` binary)
"presidio-analyzer>=2.2,<3.0", # PII detection (locale-aware via spaCy)
"Pillow>=10.0,<12.0", # M10 slice 7 — image EXIF (local header parse only)
]
# Incident detection — the fine-tuned mmBERT classifier (eyenet/incidents/). Heavy ML
# runtime, DELIBERATELY optional: only the `incident-classifier` worker imports torch;
# the API and every other service stay torch-free (classifier._load is lazy). Install:
# pip install 'eyenet[incidents]'
# GPU (recommended — the model wants a CUDA device): install a torch CUDA wheel matching
# your card FIRST, then this extra, e.g.
# pip install torch --index-url https://download.pytorch.org/whl/cu128
# pip install 'eyenet[incidents]'
# CPU works but is materially slower per message. The trained model dir is provided at
# runtime (EYENET_INCIDENT_MODEL_DIR), never baked into the image.
incidents = [
"torch>=2.4",
"transformers>=4.44",
]
[project.scripts]
eyenet = "eyenet.cli.main:app"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["eyenet"]
# -----------------------------------------------------------------------------
# Pytest
# -----------------------------------------------------------------------------
[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"
markers = [
# speed (exactly one per test)
"unit: fast, no I/O, no network, no DB. Default selection.",
"integration: in-memory bus, in-memory or temp-file SQLite. No external processes.",
"e2e: spawns real NATS / real services via testcontainers. Slow.",
# category (zero or more)
"contract: CDD contract test. Property-based or schema round-trip.",
"calibration: stylometric AUC / discrimination tests. Needs labeled corpus.",
"benchmark: pytest-benchmark perf assertion.",
"schema: schemathesis HTTP API fuzzing. Needs running service.",
"load: locust load test (run via locust CLI, not pytest).",
"slow: tests over 5s wall-clock. Catch-all for opt-in.",
"primitive: belongs to the BEHAVE-TEXT primitive suite.",
"telegram: requires Telegram fixture / TDLib bind. Skipped without env flag.",
"needs_pool: requires identity-pool fixture. Skipped without env flag.",
]
addopts = [
"-ra",
"--strict-markers",
"--strict-config",
"-m", "unit or contract",
"--cov=eyenet",
"--cov-report=term-missing",
# TODO(EYENET v0.2): raise back to 89+ once eyenet/calibration has
# unit-test backfill. M5 dropped total coverage ~89% -> ~85% — the
# calibration CLI / TOML validators / sweep helpers are
# integration-tested via `eyenet calibrate run` against the real corpus,
# not unit-tested. Operator decision 2026-05-23: gate at 85 until v0.2.
"--cov-fail-under=84",
"--timeout=30",
]
# -----------------------------------------------------------------------------
# Coverage
# -----------------------------------------------------------------------------
[tool.coverage.run]
branch = true
source = ["eyenet"]
omit = [
"eyenet/cli/__main__.py",
"tests/*",
# Requires live external services — covered by e2e tests only
"eyenet/bus/nats.py",
"eyenet/collectors/telegram/real.py",
"eyenet/collectors/telegram/auth.py",
"eyenet/collectors/matrix/real.py",
"eyenet/collectors/discord/real.py",
# Postgres backend: needs a live PostgreSQL (testcontainers), so the unit+
# contract suite cannot reach it. Proven by the e2e backend/parity/data-move/
# pgbouncer tests. Same treatment as the other live-service modules above.
"eyenet/storage/postgres_repo/repository.py",
"eyenet/storage/postgres_repo/database.py",
"eyenet/storage/postgres_repo/_data_migrate.py",
# In-jail workers (extraction + Presidio NER): executed only inside nsjail by
# the venv python, so coverage.py cannot trace them. Proven by real-nsjail
# integration tests.
"eyenet/classifier/extract/_workers/*",
"eyenet/classifier/presidio/_workers/*",
# Live LLM transport: needs a running Ollama daemon, so coverage.py cannot
# trace it. The provider-agnostic advise() logic is fully unit-tested against a
# fake BaseProvider; this thin httpx shell is proven by test_llm_real.py.
"eyenet/classifier/llm/impl/ollama.py",
# Alembic migration scripts: the baseline runs at init (upgrade path is
# covered by the schema/routing/drift tests), but downgrade halves and the
# CLI-autogenerate engine builders don't run in the normal suite. Tracking
# per-line coverage of revision files is noise.
"eyenet/storage/sqlite_repo/migrations/*",
"eyenet/storage/postgres_repo/migrations/*",
# Manual cutover-runbook ops tool; its drift logic mirrors the tested path.
"eyenet/storage/sqlite_repo/_drift_check.py",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"raise NotImplementedError",
"if TYPE_CHECKING:",
"@(abc\\.)?abstractmethod",
"if __name__ == .__main__.:",
]
show_missing = true
skip_covered = false
fail_under = 84 # TODO(EYENET v0.2): raise back to 89+ after calibration backfill
# -----------------------------------------------------------------------------
# Ruff (strict)
# -----------------------------------------------------------------------------
[tool.ruff]
line-length = 100
target-version = "py312"
# The in-jail extraction workers are standalone scripts run by a DIFFERENT
# interpreter (the eyenet-extract venv's python, inside nsjail). They import
# libraries absent from the dev/app environment and follow script idioms — they
# are not part of the checkable application surface.
extend-exclude = [
"tests/fixtures/snapshots",
"eyenet/classifier/extract/_workers",
"eyenet/classifier/presidio/_workers",
]
[tool.ruff.lint]
select = [
"E", "W", # pycodestyle
"F", # pyflakes
"I", # isort
"B", # bugbear
"UP", # pyupgrade
"N", # pep8-naming
"C4", # comprehensions
"SIM", # simplify
"RET", # return
"ARG", # unused args
"PL", # pylint
"PT", # pytest style
"PTH", # use pathlib
"ERA", # commented-out code
"TID", # tidy imports
"TCH", # type-checking imports
"RUF", # ruff-specific
"S", # bandit-lite (security)
"A", # builtins shadow
"ANN", # annotations
"ASYNC", # async issues
"DTZ", # datetime tz awareness — ALL timestamps must be tz-aware
]
ignore = [
"ANN401", # Any in **kwargs ok
"PLR0913", # too many args — design constraint, not a smell
]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # asserts in tests
"S105", "S106", # dummy passwords/tokens in test fixtures
"ANN", # don't require annotations in tests
"PLR2004", # magic numbers in tests
"ARG", # unused args (fixtures)
"PLC0415", # local imports in test bodies are fine
"PT018", # compound assertions are fine in tests
"PTH123", # open() in tests is fine (no Path-aware logic needed)
"ASYNC240", # sync file IO in async tests is fine (fixtures read blobs)
"TC001", "TC002", "TC003", # tests construct values, not just annotate
]
# Multilingual classifier tests deliberately embed Cyrillic / CJK / Arabic
# banner strings — the "ambiguous unicode" lints are the whole point of the test.
"tests/unit/classifier/ruleset/test_engine.py" = ["RUF001", "RUF002", "RUF003"]
# The stealer password parser's homoglyph defang map (and its test) embed the
# Cyrillic/Greek confusables on purpose — folding them IS the feature.
"eyenet/stealer/password.py" = ["RUF001", "RUF002", "RUF003"]
"tests/unit/stealer/test_password.py" = ["RUF001", "RUF002", "RUF003"]
# Pydantic / SQLModel evaluate annotations at runtime, so TC0xx (move to
# TYPE_CHECKING) is wrong for these layers — the imports ARE runtime imports.
"eyenet/contracts/**/*.py" = ["TC001", "TC002", "TC003"]
"eyenet/models/**/*.py" = ["TC001", "TC002", "TC003"]
# Alembic env/revisions: the include_name/include_object callbacks have a fixed
# signature dictated by Alembic (unused args are part of the contract), and the
# revision files are close kin to generated code.
"eyenet/storage/sqlite_repo/migrations/**/*.py" = ["ARG001", "E501"]
"eyenet/storage/postgres_repo/migrations/**/*.py" = ["ARG001", "E501"]
# ClickHouse DDL + AggregatingMergeTree SQL strings; splitting hurts readability.
"eyenet/stealer/clickhouse.py" = ["E501"]
# Manual ops CLI: alembic callback signatures (ARG001) + operator-facing prints (T201).
"eyenet/storage/sqlite_repo/_drift_check.py" = ["ARG001", "T201", "PLR2004"]
"eyenet/storage/**/*.py" = ["TC001", "TC002", "TC003"]
"eyenet/bus/**/*.py" = ["TC001", "TC002", "TC003"]
"eyenet/telemetry/**/*.py" = ["TC001", "TC002", "TC003"]
"eyenet/service/**/*.py" = ["TC001", "TC002", "TC003"]
"eyenet/identity_pool/**/*.py" = ["TC001", "TC002", "TC003"]
"eyenet/collectors/**/*.py" = ["TC001", "TC002", "TC003"]
"eyenet/sensor/**/*.py" = ["TC001", "TC002", "TC003"]
"eyenet/engine/**/*.py" = ["TC001", "TC002", "TC003"]
"eyenet/linker/**/*.py" = ["TC001", "TC002", "TC003"]
"eyenet/graph/**/*.py" = ["TC001", "TC002", "TC003"]
"eyenet/cli/**/*.py" = [
"T20", # print is fine in CLI
"B008", # typer.Option(...) defaults — idiomatic typer usage
"TC001", "TC002", "TC003",
]
"eyenet/calibration/**/*.py" = [
"T20", # print is fine in CLI surface
"B008", # typer.Option(...) defaults — idiomatic typer usage
"TC001", "TC002", "TC003",
]
"eyenet/verifier/**/*.py" = ["TC001", "TC002", "TC003"]
"eyenet/api/**/*.py" = [
"B008", # FastAPI Query/Path/Body in defaults — idiomatic FastAPI usage
"S105", # token_type="bearer" default in OAuth2 TokenPair — not a secret
"TC001", "TC002", "TC003", # Pydantic + FastAPI evaluate annotations at runtime
]
[tool.ruff.lint.isort]
known-first-party = ["eyenet"]
combine-as-imports = true
[tool.ruff.lint.flake8-type-checking]
# Pydantic resolves field annotations at runtime (model build), so a type used
# only in a BaseModel annotation must stay a runtime import — never moved into a
# TYPE_CHECKING block. Without this, TC001/TC003 would push enum imports out of
# scope and silently break validation.
runtime-evaluated-base-classes = ["pydantic.BaseModel"]
# -----------------------------------------------------------------------------
# MyPy (strict)
# -----------------------------------------------------------------------------
[tool.mypy]
python_version = "3.12"
strict = true
# The in-jail workers import libraries (fitz, docx, presidio_analyzer) that live
# only in the eyenet-extract venv, never in the type-check environment. They are
# never imported by the app (only bind-mounted and run as scripts in nsjail).
exclude = ['eyenet/classifier/(extract|presidio)/_workers/', 'eyenet/storage/sqlite_repo/migrations/', 'eyenet/storage/postgres_repo/migrations/']
warn_unused_ignores = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
no_implicit_reexport = true
strict_equality = true
extra_checks = true
plugins = ["pydantic.mypy"]
[[tool.mypy.overrides]]
module = [
"telethon.*",
"opentele.*",
"sqlite_vec.*",
"uuid7.*",
"uuid_extensions.*",
"behave_text.*",
"behave_core.*",
"spacy.*",
"thinc.*",
"nio.*",
"re2.*",
"phonenumbers.*",
"pycountry.*",
"clickhouse_connect.*",
]
ignore_missing_imports = true
# The Group I middleware unit test drives the middlewares over a hand-built
# pure-ASGI harness (fake scope/receive/send + a callable inner app). Matching
# starlette's exact structural ASGIApp/Scope/Receive/Send signatures in the test
# stand-ins buys nothing but annotation noise, so arg-type is disabled for this
# one module. The middlewares themselves are fully typed against starlette.
[[tool.mypy.overrides]]
module = ["tests.unit.api.test_group_i_middleware"]
disable_error_code = ["arg-type"]
# Optional ML runtime deps: torch + transformers are declared as runtime
# requirements (see dependencies above) but are intentionally NOT
# installed in the API / dev venv (the incident-classifier worker ships
# with its own image). mypy can't find the stubs; silence the import
# noise for just those modules.
[[tool.mypy.overrides]]
module = ["torch", "transformers", "transformers.*"]
ignore_missing_imports = true
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
# -----------------------------------------------------------------------------
# Bandit
# -----------------------------------------------------------------------------
[tool.bandit]
exclude_dirs = ["tests", ".venv", ".githooks"]
skips = ["B101"] # assert is fine; we use it in tests + Pydantic invariants
# -----------------------------------------------------------------------------
# Deptry
# -----------------------------------------------------------------------------
[tool.deptry]
known_first_party = ["eyenet"]
# The in-jail workers import the extract-venv libs (fitz/docx/presidio); they run
# in a separate environment, so deptry must not read them as app-level dependencies.
extend_exclude = [
"tests",
"scripts",
"eyenet/classifier/extract/_workers",
"eyenet/classifier/presidio/_workers",
]
# DEP002 is suppressed globally: EYENET declares its full runtime dep set
# upfront (all milestone deps in one place). Deptry can't distinguish
# "not used yet" from "genuinely unnecessary." Audit manually at each release.
ignore = ["DEP002"]
[tool.deptry.package_module_name_map]
PySocks = "socks"
google-re2 = "re2"
[dependency-groups]
dev = [
"types-pysocks>=1.7.1.20261115",
"types-pyyaml>=6.0.12.20261113",
]