Skip to content

Consolidate Python dependencies

Tan Le requested to merge consolidate-ext-deps into main

What does this merge request do and why?

Consolidate Python dependencies

  • Explicitly add undeclared dependencies
  • Remove unused dependencies

How to set up and validate locally

I used https://github.com/tweag/FawltyDeps to detect undeclared and unused dependencies.

root@e41c8483f7ac:/app# poetry run fawltydeps

These imports appear to be undeclared dependencies:
- 'httpx' imported at:
    ai_gateway/models/anthropic.py:4
- 'prometheus_client' imported at:
    ai_gateway/app.py:6
    ai_gateway/code_suggestions/processing/base.py:5
    ai_gateway/instrumentators/base.py:7
    ai_gateway/instrumentators/benchmark.py:5
    ai_gateway/instrumentators/model_requests.py:4
- 'starlette' imported at:
    ai_gateway/api/headers.py:5
    ai_gateway/api/middleware.py:11
    ai_gateway/api/middleware.py:17
    ai_gateway/api/middleware.py:18
    ai_gateway/api/middleware.py:19
    ai_gateway/api/middleware.py:23
    ai_gateway/api/middleware.py:24
    ai_gateway/api/server.py:4
    ai_gateway/api/v1/chat/agent.py:8
    ai_gateway/api/v1/x_ray/libraries.py:4
    ai_gateway/api/v2/code/completions.py:9
    ai_gateway/api/v2/code/typing.py:11
    ai_gateway/api/v3/code/typing.py:6
    ai_gateway/auth/authentication.py:3
    ai_gateway/auth/authentication.py:4
    ai_gateway/auth/authentication.py:5
    ai_gateway/structured_logging.py:7
    conftest.py:8
    tests/code_suggestions/test_authentication.py:7
    tests/code_suggestions/test_authentication.py:8
    tests/code_suggestions/test_authentication.py:9
    tests/code_suggestions/test_logging.py:3
    tests/code_suggestions/test_logging.py:4
    tests/code_suggestions/test_logging.py:5
    tests/code_suggestions/test_logging.py:6
    tests/code_suggestions/test_model_telemetry.py:5
    tests/code_suggestions/test_model_telemetry.py:6
    tests/code_suggestions/test_model_telemetry.py:7
    tests/code_suggestions/test_model_telemetry.py:8

These dependencies appear to be unused (i.e. not imported):
- 'sentencepiece' declared in:
    pyproject.toml

Merge request checklist

  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.
Edited by Tan Le

Merge request reports