mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-19 22:54:21 +01:00
🖊 fix: requirements parsing error (#85)
This commit is contained in:
@@ -63,13 +63,12 @@ def clean_requirements_txt(previous_microservice_path):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
split = re.split(r'==|>=|<=|>|<|~=', line)
|
split = re.split(r'==|>=|<=|>|<|~=', line)
|
||||||
if len(split) == 1:
|
if len(split) == 1 or len(split) > 2:
|
||||||
version = None
|
version = None
|
||||||
package_name = split[0]
|
package_name = split[0]
|
||||||
elif len(split) == 2:
|
|
||||||
package_name, version = split
|
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'Could not parse line {line} in requirements.txt')
|
package_name, version = split
|
||||||
|
|
||||||
|
|
||||||
# Keep lines with jina, docarray, openai, pytest unchanged
|
# Keep lines with jina, docarray, openai, pytest unchanged
|
||||||
if package_name in {'jina', 'docarray', 'openai', 'pytest'}:
|
if package_name in {'jina', 'docarray', 'openai', 'pytest'}:
|
||||||
@@ -79,7 +78,7 @@ def clean_requirements_txt(previous_microservice_path):
|
|||||||
if version is None or not is_package_on_pypi(package_name, version):
|
if version is None or not is_package_on_pypi(package_name, version):
|
||||||
latest_version = get_latest_package_version(package_name)
|
latest_version = get_latest_package_version(package_name)
|
||||||
if latest_version is None:
|
if latest_version is None:
|
||||||
raise ValueError(f'Package {package_name} not found on PyPI')
|
continue
|
||||||
updated_requirements.append(f'{package_name}~={latest_version}')
|
updated_requirements.append(f'{package_name}~={latest_version}')
|
||||||
else:
|
else:
|
||||||
updated_requirements.append(line)
|
updated_requirements.append(line)
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ gtts~=2.2.3
|
|||||||
pydub~=123.123.123
|
pydub~=123.123.123
|
||||||
# non-existing package with correct version
|
# non-existing package with correct version
|
||||||
base64~=3.3.0
|
base64~=3.3.0
|
||||||
|
# not parsable version
|
||||||
|
pdfminer.six>=20201018,<20211018
|
||||||
# existing package without version
|
# existing package without version
|
||||||
requests
|
requests
|
||||||
# another existing package without version
|
# another existing package without version
|
||||||
@@ -57,6 +59,7 @@ jina==111.222.333
|
|||||||
docarray==111.222.333
|
docarray==111.222.333
|
||||||
gtts~=2.2.3
|
gtts~=2.2.3
|
||||||
pydub~=0.25.1
|
pydub~=0.25.1
|
||||||
|
pdfminer.six~=20201018
|
||||||
requests~=2.26.0
|
requests~=2.26.0
|
||||||
streamlit~=0.89.0"""
|
streamlit~=0.89.0"""
|
||||||
requirements_txt_path = os.path.join(tmpdir, "requirements.txt")
|
requirements_txt_path = os.path.join(tmpdir, "requirements.txt")
|
||||||
|
|||||||
Reference in New Issue
Block a user