Skip to content

Commit cc2504b

Browse files
fix(openai): fix typing import error for python 3.7 [backport #6219 to 1.13] (#6235)
Backports #6219 and #6239 to 1.13. `openai` integration doesn't work for me because of the issue with the missing `TypedDict` type in Python 3.7. I'm receiving the following error `ImportError: cannot import name 'TypedDict' from 'typing'` I was able to reproduce it by adding Python 3.7 to the test suite: ``` ==================================== ERRORS ==================================== _____________ ERROR collecting tests/contrib/openai/test_logger.py _____________ ImportError while importing test module '/root/project/tests/contrib/openai/test_logger.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: ../.pyenv/versions/3.7.16/lib/python3.7/importlib/__init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) ddtrace/internal/module.py:220: in _exec_module self.loader.exec_module(module) tests/contrib/openai/test_logger.py:8: in <module> from ddtrace.internal.log_writer import V2LogWriter ddtrace/internal/module.py:220: in _exec_module self.loader.exec_module(module) ddtrace/internal/log_writer.py:4: in <module> from typing import TypedDict E ImportError: cannot import name 'TypedDict' from 'typing' (/root/.pyenv/versions/3.7.16/lib/python3.7/typing.py) ``` `TypedDict` was added to typing in Python 3.8, so we can use it from `typing_extensions` module for <3.8 Updated the test suite to be able to test with Python 3.7 as a minimum supported version. - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed. If no release note is required, add label `changelog/no-changelog`. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] Backport labels are set (if [applicable](../docs/contributing.rst#release-branch-maintenance)) - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment. - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](../docs/contributing.rst#release-branch-maintenance) --------- Co-authored-by: Andrii Sherepa <[email protected]>
1 parent 821e777 commit cc2504b

File tree

320 files changed

+647
-1137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

320 files changed

+647
-1137
lines changed

.riot/requirements/1c841d4.txt renamed to .riot/requirements/1020e74.txt

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,60 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.9
2+
# This file is autogenerated by pip-compile with Python 3.7
33
# by the following command:
44
#
5-
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/1c841d4.in
5+
# pip-compile --no-annotate --resolver=backtracking .riot/requirements/1020e74.in
66
#
77
aiohttp==3.8.4
88
aiosignal==1.3.1
99
async-timeout==4.0.2
10+
asynctest==0.13.0
1011
attrs==23.1.0
11-
certifi==2022.12.7
12+
certifi==2023.5.7
1213
charset-normalizer==3.1.0
13-
contourpy==1.0.7
14-
coverage[toml]==7.2.5
14+
coverage[toml]==7.2.7
1515
cycler==0.11.0
1616
et-xmlfile==1.1.0
1717
exceptiongroup==1.1.1
18-
fonttools==4.39.3
18+
fonttools==4.38.0
1919
frozenlist==1.3.3
2020
hypothesis==6.45.0
2121
idna==3.4
22-
importlib-resources==5.12.0
22+
importlib-metadata==6.7.0
2323
iniconfig==2.0.0
24-
joblib==1.2.0
24+
joblib==1.3.0
2525
kiwisolver==1.4.4
26-
matplotlib==3.7.1
26+
matplotlib==3.5.3
2727
mock==5.0.2
2828
multidict==6.0.4
29-
numpy==1.24.3
30-
openai[embeddings]==0.27.4
29+
numpy==1.21.6
30+
openai[embeddings]==0.27.8
3131
openpyxl==3.1.2
3232
opentracing==2.4.0
3333
packaging==23.1
34-
pandas==2.0.1
35-
pandas-stubs==2.0.1.230501
34+
pandas==1.3.5
35+
pandas-stubs==1.2.0.62
3636
pillow==9.5.0
37-
plotly==5.14.1
38-
pluggy==1.0.0
39-
pyparsing==3.0.9
40-
pytest==7.3.1
37+
plotly==5.15.0
38+
pluggy==1.2.0
39+
pyparsing==3.1.0
40+
pytest==7.4.0
4141
pytest-asyncio==0.21.0
42-
pytest-cov==4.0.0
43-
pytest-mock==3.10.0
42+
pytest-cov==4.1.0
43+
pytest-mock==3.11.1
4444
python-dateutil==2.8.2
4545
pytz==2023.3
4646
pyyaml==6.0
47-
requests==2.30.0
48-
scikit-learn==1.2.2
49-
scipy==1.10.1
47+
requests==2.31.0
48+
scikit-learn==1.0.2
49+
scipy==1.7.3
5050
six==1.16.0
5151
sortedcontainers==2.4.0
5252
tenacity==8.2.2
5353
threadpoolctl==3.1.0
5454
tomli==2.0.1
5555
tqdm==4.65.0
56-
types-pytz==2023.3.0.0
57-
tzdata==2023.3
58-
urllib3==1.26.15
56+
typing-extensions==4.7.0
57+
urllib3==1.26.16
5958
vcrpy==4.2.1
6059
wrapt==1.15.0
6160
yarl==1.9.2

.riot/requirements/10212ca.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ pytest-cov==4.0.0
2323
pytest-mock==3.10.0
2424
sortedcontainers==2.4.0
2525
tomli==2.0.1
26-
typing-extensions==4.6.3
26+
typing-extensions==4.7.0
2727
zipp==3.15.0

.riot/requirements/102421e.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ sortedcontainers==2.4.0
5858
sshpubkeys==3.3.1
5959
tomli==2.0.1
6060
types-pyyaml==6.0.12.8
61-
typing-extensions==4.6.3
61+
typing-extensions==4.7.0
6262
urllib3==1.26.15
6363
websocket-client==1.5.1
6464
werkzeug==2.1.2

.riot/requirements/102cf0a.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pytest-cov==4.0.0
2525
pytest-mock==3.10.0
2626
sortedcontainers==2.4.0
2727
tomli==2.0.1
28-
typing-extensions==4.6.3
28+
typing-extensions==4.7.0
2929
uwsgi==2.0.21
3030
zipp==3.15.0
3131

.riot/requirements/1032b18.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ redis==3.5.3
3333
six==1.16.0
3434
sortedcontainers==2.4.0
3535
tomli==2.0.1
36-
typing-extensions==4.6.3
36+
typing-extensions==4.7.0
3737
vine==5.0.0
3838
wcwidth==0.2.6
3939
zipp==3.15.0

.riot/requirements/103e4a0.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ six==1.16.0
4343
sortedcontainers==2.4.0
4444
tenacity==8.2.2
4545
tomli==2.0.1
46-
typing-extensions==4.6.3
46+
typing-extensions==4.7.0
4747
urllib3==1.26.16
4848
wrapt==1.15.0
4949
xmltodict==0.13.0

.riot/requirements/1050ad9.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ pytest-mock==3.10.0
2121
six==1.16.0
2222
sortedcontainers==2.4.0
2323
tomli==2.0.1
24-
typing-extensions==4.6.3
24+
typing-extensions==4.7.0
2525
zipp==3.15.0

.riot/requirements/1067092.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ sortedcontainers==2.4.0
3535
sqlalchemy==1.4.46
3636
starlette==0.26.1
3737
tomli==2.0.1
38-
typing-extensions==4.6.3
38+
typing-extensions==4.7.0
3939
urllib3==1.26.15

.riot/requirements/10990fb.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ pytest-mock==3.10.0
2424
six==1.16.0
2525
sortedcontainers==2.4.0
2626
tomli==2.0.1
27-
typing-extensions==4.6.3
27+
typing-extensions==4.7.0
2828
zipp==3.15.0

.riot/requirements/10a9168.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ sortedcontainers==2.4.0
5858
sshpubkeys==3.3.1
5959
tomli==2.0.1
6060
types-pyyaml==6.0.12.8
61-
typing-extensions==4.6.3
61+
typing-extensions==4.7.0
6262
urllib3==1.26.15
6363
websocket-client==1.5.1
6464
werkzeug==2.1.2

0 commit comments

Comments
 (0)