openai/openai-python

Public

mirrored fromhttps://github.com/openai/openai-pythonAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.21.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

bin/check-env-state.py

40lines · modecode

1"""Script that exits 1 if the current environment is not
2in sync with the `requirements-dev.lock` file.
3"""
4
5from pathlib import Path
6
7import importlib_metadata
8
9
10def should_run_sync() -> bool:
11 dev_lock = Path(__file__).parent.parent.joinpath("requirements-dev.lock")
12
13 for line in dev_lock.read_text().splitlines():
14 if not line or line.startswith("#") or line.startswith("-e"):
15 continue
16
17 dep, lock_version = line.split("==")
18
19 try:
20 version = importlib_metadata.version(dep)
21
22 if lock_version != version:
23 print(f"mismatch for {dep} current={version} lock={lock_version}")
24 return True
25 except Exception:
26 print(f"could not import {dep}")
27 return True
28
29 return False
30
31
32def main() -> None:
33 if should_run_sync():
34 exit(1)
35 else:
36 exit(0)
37
38
39if __name__ == "__main__":
40 main()
41