-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathcheck_version_conficts.py
36 lines (29 loc) · 1.27 KB
/
check_version_conficts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import subprocess
import sys
import re
DEFAULT_REQUIREMENTS = [
#"pandas-ml-1ntegration-test-private/requirements.txt",
#"pandas-ml-1ntegration-test/requirements.txt",
#"pandas-ml-airflow/requirements.txt",
"pandas-ml-common/requirements.txt",
"pandas-ml-quant/requirements.txt",
#"pandas-ml-quant-rl/requirements.txt",
"pandas-ml-utils/requirements.txt",
#"pandas-ml-utils-tf/requirements.txt",
"pandas-ml-utils-torch/requirements.txt",
"pandas-quant-data-provider/requirements.txt",
"pandas-ta-quant-plot/requirements.txt",
"pandas-ta-quant/requirements.txt",
#"streamlit_apps/requirements.txt",
]
def get_frozen_filename(filename):
parts = filename.split('.')
parts = parts[:-1] + ['frozen'] + parts[-1:]
return '.'.join(parts)
if __name__ == '__main__':
files = sys.argv[1:] if len(sys.argv) > 1 else DEFAULT_REQUIREMENTS
dependencies = [tuple(dep.replace('\n', '').split('==')) for requirements_file in files for dep in open(get_frozen_filename(requirements_file)).readlines()]
for i, (d, v) in enumerate(dependencies):
versions = [v2 for j, (d2, v2) in enumerate(dependencies) if j != i and d2 == d]
if len(set(versions)) > 1:
print(f"ERROR: version conflict: {d}: {set(versions)}")