[mypy]
# Library RAG - Strict Type Checking Configuration
# This configuration enforces strict type safety across all modules.

# Python version
python_version = 3.10

# Strict mode settings
strict = True

# These are implied by strict=True, but listed explicitly for clarity:
check_untyped_defs = True
disallow_untyped_defs = True
disallow_incomplete_defs = True
disallow_untyped_calls = True
disallow_untyped_decorators = True
disallow_any_generics = True
disallow_subclassing_any = True

# Warning settings
warn_return_any = True
warn_redundant_casts = True
warn_unused_ignores = True
warn_unused_configs = True
warn_unreachable = True

# Strictness settings
strict_equality = True
strict_optional = True
no_implicit_optional = True
no_implicit_reexport = True

# Error reporting
show_error_codes = True
show_column_numbers = True
show_error_context = True
pretty = True

# Cache settings
cache_dir = .mypy_cache
incremental = True

# Exclude legacy directories and utility scripts from type checking
exclude = (?x)(
    ^utils2/
    | ^tests/utils2/
    | ^toutweaviate\.py$
    | ^query_test\.py$
    | ^update_docstrings\.py$
    | ^schema_v2\.py$
  )

# =============================================================================
# Per-module overrides for gradual migration
# =============================================================================
# These overrides allow gradual adoption of strict typing.
# Remove these sections as modules are fully typed.

# Third-party libraries without stubs
[mypy-weaviate.*]
ignore_missing_imports = True

[mypy-mistralai.*]
ignore_missing_imports = True

[mypy-werkzeug.*]
ignore_missing_imports = True

[mypy-requests]
ignore_missing_imports = True

[mypy-ollama.*]
ignore_missing_imports = True

# =============================================================================
# Legacy modules - excluded from strict typing
# =============================================================================
# These modules are legacy code that will be typed in future issues.

# utils2/ - Legacy module directory (to be deprecated)
[mypy-utils2.*]
ignore_errors = True

# tests/utils2/ - Tests for legacy modules
[mypy-tests.utils2.*]
ignore_errors = True

# Standalone utility scripts
[mypy-toutweaviate]
ignore_errors = True

[mypy-query_test]
ignore_errors = True

[mypy-update_docstrings]
ignore_errors = True

# =============================================================================
# Modules with relaxed typing (gradual migration)
# =============================================================================

# llm_structurer.py - Complex legacy module with threading
[mypy-utils.llm_structurer]
disallow_untyped_defs = False
disallow_untyped_calls = False
warn_return_any = False
check_untyped_defs = False
warn_unreachable = False

# llm_classifier.py - Uses lowercase dict syntax
[mypy-utils.llm_classifier]
warn_return_any = False
