Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 528a5ba

Browse files
authored
Do not require typing_extensions with Python 3.8+ (openai#154)
typing_extensions are only used for Literal which is available in the standard library since Python 3.8
1 parent bbea3dc commit 528a5ba

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

openai/api_requestor.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
from urllib.parse import urlencode, urlsplit, urlunsplit
88

99
import requests
10-
from typing_extensions import Literal
10+
11+
# Literal is available from Python 3.8
12+
try:
13+
from typing import Literal
14+
except ImportError:
15+
from typing_extensions import Literal
1116

1217
import openai
1318
from openai import error, util, version

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"pandas-stubs>=1.1.0.11", # Needed for type hints for mypy
2626
"openpyxl>=3.0.7", # Needed for CLI fine-tuning data preparation tool xlsx format
2727
"numpy",
28-
"typing_extensions", # Needed for type hints for mypy
28+
'typing_extensions;python_version<"3.8"', # Needed for type hints for mypy
2929
],
3030
extras_require={
3131
"dev": ["black~=21.6b0", "pytest==6.*"],

0 commit comments

Comments
 (0)