Skip to content

Commit a790d43

Browse files
authored
[Bug Fix]: ImportError: cannot import name 'T' from 're' (#7314)
* fix unused imports * add test for python 3.12 * re introduce error - as a test * update config for ci/cd * fix python 13 install * bump pyyaml * bump numpy * fix embedding requests * bump pillow dep * bump version * bump pydantic * bump tiktoken * fix import * fix python 3.13 import * fix unused imports in tests/*
1 parent c7f14e9 commit a790d43

File tree

9 files changed

+41
-19
lines changed

9 files changed

+41
-19
lines changed

.circleci/config.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,33 @@ jobs:
785785
command: |
786786
pwd
787787
ls
788-
python -m pytest -vv tests/local_testing/test_python_38.py
788+
python -m pytest -vv tests/local_testing/test_basic_python_version.py
789+
790+
installing_litellm_on_python_3_13:
791+
docker:
792+
- image: cimg/python:3.13.1
793+
auth:
794+
username: ${DOCKERHUB_USERNAME}
795+
password: ${DOCKERHUB_PASSWORD}
796+
working_directory: ~/project
797+
798+
steps:
799+
- checkout
800+
- run:
801+
name: Install Dependencies
802+
command: |
803+
python -m pip install --upgrade pip
804+
python -m pip install -r requirements.txt
805+
pip install "pytest==7.3.1"
806+
pip install "pytest-retry==1.6.3"
807+
pip install "pytest-asyncio==0.21.1"
808+
pip install "pytest-cov==5.0.0"
809+
- run:
810+
name: Run tests
811+
command: |
812+
pwd
813+
ls
814+
python -m pytest -vv tests/local_testing/test_basic_python_version.py
789815
790816
check_code_and_doc_quality:
791817
docker:
@@ -1607,6 +1633,12 @@ workflows:
16071633
only:
16081634
- main
16091635
- /litellm_.*/
1636+
- installing_litellm_on_python_3_13:
1637+
filters:
1638+
branches:
1639+
only:
1640+
- main
1641+
- /litellm_.*/
16101642
- load_testing:
16111643
filters:
16121644
branches:
@@ -1638,6 +1670,7 @@ workflows:
16381670
- e2e_ui_testing
16391671
- litellm_proxy_unit_testing
16401672
- installing_litellm_on_python
1673+
- installing_litellm_on_python_3_13
16411674
- proxy_logging_guardrails_model_info_tests
16421675
- proxy_pass_through_endpoint_tests
16431676
- check_code_and_doc_quality

requirements.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ httpx==0.27.0 # Pin Httpx dependency
44
openai==1.55.3 # openai req.
55
fastapi==0.111.0 # server dep
66
backoff==2.2.1 # server dep
7-
pyyaml==6.0.0 # server dep
7+
pyyaml==6.0.2 # server dep
88
uvicorn==0.29.0 # server dep
99
gunicorn==22.0.0 # server dep
1010
boto3==1.34.34 # aws bedrock/sagemaker calls
1111
redis==5.0.0 # caching
12-
numpy==1.24.3 # semantic caching
12+
numpy==2.1.1 # semantic caching
1313
prisma==0.11.0 # for db
1414
mangum==0.17.0 # for aws lambda functions
1515
pynacl==1.5.0 # for encrypting keys
@@ -19,12 +19,12 @@ google-generativeai==0.5.0 # for vertex ai calls
1919
async_generator==1.10.0 # for async ollama calls
2020
langfuse==2.45.0 # for langfuse self-hosted logging
2121
prometheus_client==0.20.0 # for /metrics endpoint on proxy
22-
orjson==3.9.15 # fast /embedding responses
22+
orjson==3.10.12 # fast /embedding responses
2323
apscheduler==3.10.4 # for resetting budget in background
2424
fastapi-sso==0.10.0 # admin UI, SSO
2525
pyjwt[crypto]==2.9.0
2626
python-multipart==0.0.9 # admin UI
27-
Pillow==10.3.0
27+
Pillow==11.0.0
2828
azure-ai-contentsafety==1.0.0 # for azure content safety
2929
azure-identity==1.16.1 # for azure content safety
3030
azure-storage-file-datalake==12.15.0 # for azure buck storage logging
@@ -37,16 +37,16 @@ cryptography==42.0.7
3737

3838
### LITELLM PACKAGE DEPENDENCIES
3939
python-dotenv==1.0.0 # for env
40-
tiktoken==0.7.0 # for calculating usage
40+
tiktoken==0.8.0 # for calculating usage
4141
importlib-metadata==6.8.0 # for random utils
42-
tokenizers==0.14.0 # for calculating usage
42+
tokenizers==0.20.2 # for calculating usage
4343
click==8.1.7 # for proxy cli
4444
jinja2==3.1.4 # for prompt templates
4545
certifi==2024.7.4 # [TODO] clean up
4646
aiohttp==3.10.2 # for network calls
4747
aioboto3==12.3.0 # for async sagemaker calls
4848
tenacity==8.2.3 # for retrying requests, when litellm.num_retries set
49-
pydantic==2.7.1 # proxy + openai req.
49+
pydantic==2.10.0 # proxy + openai req.
5050
jsonschema==4.22.0 # validating json schema
5151
websockets==10.4 # for realtime API
5252
####

tests/llm_translation/test_anthropic_text_completion.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import asyncio
22
import os
3-
from re import T
43
import sys
54
import traceback
65

tests/logging_callback_tests/test_assemble_streaming_responses.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
from datetime import datetime
1515
from unittest.mock import AsyncMock
1616

17-
from pydantic.main import Model
18-
1917
sys.path.insert(
2018
0, os.path.abspath("../..")
2119
) # Adds the parent directory to the system path

tests/logging_callback_tests/test_otel_logging.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
from datetime import datetime
55
from unittest.mock import AsyncMock
66

7-
from pydantic.main import Model
8-
97
sys.path.insert(
108
0, os.path.abspath("../..")
119
) # Adds the parent directory to the system-path

tests/logging_callback_tests/test_standard_logging_payload.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
from datetime import datetime
99
from unittest.mock import AsyncMock
1010

11-
from pydantic.main import Model
12-
1311
sys.path.insert(
1412
0, os.path.abspath("../..")
1513
) # Adds the parent directory to the system-path

tests/logging_callback_tests/test_unit_tests_init_callbacks.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
from datetime import datetime
55
from unittest.mock import AsyncMock
66

7-
from pydantic.main import Model
8-
97
sys.path.insert(
108
0, os.path.abspath("../..")
119
) # Adds the parent directory to the system-path

tests/proxy_unit_tests/test_unit_test_max_model_budget_limiter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
from datetime import datetime
55
from unittest.mock import AsyncMock
66

7-
from pydantic.main import Model
8-
97
sys.path.insert(
108
0, os.path.abspath("../..")
119
) # Adds the parent directory to the system-path

0 commit comments

Comments
 (0)