Skip to content

Address mypy linting warnings in AIGW

Notice: This issue has been upgraded to an epic

There has been some really excellent work done on this as part of %17.11 and there is still more to go!

In an effort to optimise our workflow and improve transparency at the same time, @achueshev and I have agreed we need to elevate this to an epic and break the work up at the folder level into separate issues which will be addressed in subsequent milestones. The progress has been excellent and we will keep going until static checking can be run on ELI5!


Problems to solve

We are excluding several folders from mypy scan. This compromises code quality.

MYPY_LINT_TODO_DIR ?= --exclude "ai_gateway/api/*" \
	--exclude "ai_gateway/auth/*" \
	--exclude "ai_gateway/chat/*" \
	--exclude "ai_gateway/code_suggestions/*" \
	--exclude "ai_gateway/experimentation/*" \
	--exclude "ai_gateway/models/*" \
	--exclude "tests/api/*" \
	--exclude "tests/chat/*" \
	--exclude "tests/code_suggestions/*" \

Proposal

Pick a folder/subfolders and raise separate MR to fix mypy linting warnings.

  • ai_gateway/auth/ - !1684 (merged)
  • ai_gateway/api/
    • ai_gateway/api/middleware/model_config.py - !2272 (merged)
    • ai_gateway/api/middleware/base.py - !2272 (merged)
    • ai_gateway/api/snowplow_context.py - !2274 (merged)
    • ai_gateway/api/v3/code/completions.py
    • ai_gateway/api/v2/code/completions.py
    • ai_gateway/api/v2/chat/agent.py
    • ai_gateway/api/v1/x_ray/libraries.py
    • ai_gateway/api/v1/prompts/invoke.py
    • ai_gateway/api/v1/chat/agent.py
    • ai_gateway/api/monitoring.py - !2208 (merged)
    • ai_gateway/api/server.py - !2276 (merged)
  • ai_gateway/chat/ - !2205 (merged)
  • ai_gateway/code_suggestions/
    • ai_gateway/code_suggestions/base.py -
    • ai_gateway/code_suggestions/completions.py
    • ai_gateway/code_suggestions/container.py
    • ai_gateway/code_suggestions/experimental.py - !2265 (merged)
    • ai_gateway/code_suggestions/generations.py
    • ai_gateway/code_suggestions/processing/base.py - !2265 (merged)
    • ai_gateway/code_suggestions/processing/completions.py
    • ai_gateway/code_suggestions/processing/ops.py
    • ai_gateway/code_suggestions/processing/post/completions.py
    • ai_gateway/code_suggestions/processing/pre/base.py - !2265 (merged)
  • ai_gateway/experimentation/ - !1685 (merged)
  • ai_gateway/models/
    • ai_gateway/models/v2/anthropic_claude.py
    • ai_gateway/models/v2/container.py
    • ai_gateway/models/base.py
    • ai_gateway/models/vertex_text.py
    • ai_gateway/models/agent_model.py
    • ai_gateway/models/mock.py
    • ai_gateway/models/litellm.py
    • ai_gateway/models/anthropic.py
  • tests/api/ - !2198 (merged)
  • test/chat/ - !2185 (merged)
  • tests/code_suggestions/
    • tests/code_suggestions/test_engine.py
    • tests/code_suggestions/test_container.py
    • tests/code_suggestions/test_completions.py
    • tests/code_suggestions/prompts/ - !2200 (merged)
    • tests/code_suggestions/models/ - !2202 (merged)

Links

The following discussion from !1545 (merged) should be addressed:

Edited by Stephan Rayner