Skip to content

Commit 99ffbda

Browse files
chore(internal): add bin script (#1001)
1 parent 3ad4e8b commit 99ffbda

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

bin/check-env-state.py

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""Script that exits 1 if the current environment is not
2+
in sync with the `requirements-dev.lock` file.
3+
"""
4+
5+
from pathlib import Path
6+
7+
import importlib_metadata
8+
9+
10+
def 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+
32+
def main() -> None:
33+
if should_run_sync():
34+
exit(1)
35+
else:
36+
exit(0)
37+
38+
39+
if __name__ == "__main__":
40+
main()

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ dev-dependencies = [
6060
"time-machine",
6161
"nox",
6262
"dirty-equals>=0.6.0",
63+
"importlib-metadata>=6.7.0",
6364
"azure-identity >=1.14.1",
6465
"types-tqdm > 4"
6566
]

requirements-dev.lock

+6-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ annotated-types==0.6.0
1111
anyio==4.1.0
1212
argcomplete==3.1.2
1313
attrs==23.1.0
14-
azure-core==1.29.5
14+
azure-core==1.29.6
1515
azure-identity==1.15.0
1616
black==23.3.0
1717
certifi==2023.7.22
@@ -29,18 +29,19 @@ h11==0.14.0
2929
httpcore==1.0.2
3030
httpx==0.25.2
3131
idna==3.4
32+
importlib-metadata==7.0.0
3233
iniconfig==2.0.0
3334
isort==5.10.1
3435
msal==1.26.0
35-
msal-extensions==1.0.0
36+
msal-extensions==1.1.0
3637
mypy==1.7.1
3738
mypy-extensions==1.0.0
3839
nodeenv==1.8.0
3940
nox==2023.4.22
4041
numpy==1.26.2
4142
packaging==23.2
42-
pandas==2.1.3
43-
pandas-stubs==2.1.1.230928
43+
pandas==2.1.4
44+
pandas-stubs==2.1.4.231218
4445
pathspec==0.11.2
4546
platformdirs==3.11.0
4647
pluggy==1.3.0
@@ -69,5 +70,6 @@ typing-extensions==4.8.0
6970
tzdata==2023.3
7071
urllib3==2.1.0
7172
virtualenv==20.24.5
73+
zipp==3.17.0
7274
# The following packages are considered to be unsafe in a requirements file:
7375
setuptools==68.2.2

0 commit comments

Comments
 (0)