sunstone-py 0.4.0__py3-none-any.whl → 0.4.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sunstone/_release.py CHANGED
@@ -5,6 +5,7 @@ Handles version bumping, CHANGELOG updates, git tagging, and pushing.
5
5
  """
6
6
 
7
7
  import argparse
8
+ import json
8
9
  import os
9
10
  import re
10
11
  import subprocess
@@ -54,6 +55,68 @@ def check_on_main_branch() -> None:
54
55
  sys.exit(1)
55
56
 
56
57
 
58
+ def run_gh(*args: str, capture: bool = True) -> subprocess.CompletedProcess[str]:
59
+ """Run a gh command and return the result."""
60
+ result = subprocess.run(
61
+ ["gh", *args],
62
+ capture_output=capture,
63
+ text=True,
64
+ cwd=get_root_dir(),
65
+ )
66
+ return result
67
+
68
+
69
+ def check_ci_passed() -> None:
70
+ """Fail if CI checks have not passed for the current commit."""
71
+ print("Checking CI status...")
72
+
73
+ # Get the status of checks for HEAD
74
+ result = run_gh("run", "list", "--branch=main", "--limit=1", "--json=status,conclusion,databaseId")
75
+ if result.returncode != 0:
76
+ print("Error: Failed to check CI status", file=sys.stderr)
77
+ print(result.stderr, file=sys.stderr)
78
+ sys.exit(1)
79
+
80
+ try:
81
+ runs = json.loads(result.stdout)
82
+ except json.JSONDecodeError:
83
+ print("Error: Failed to parse CI status response", file=sys.stderr)
84
+ sys.exit(1)
85
+
86
+ if not runs:
87
+ print("Warning: No CI runs found for main branch", file=sys.stderr)
88
+ return
89
+
90
+ run_info = runs[0]
91
+ status = run_info.get("status")
92
+ conclusion = run_info.get("conclusion")
93
+ run_id = run_info.get("databaseId")
94
+
95
+ if status == "in_progress" or status == "queued":
96
+ print(f"CI is still running (status: {status}). Watching for completion...")
97
+ # Watch the run - this will stream output and wait for completion
98
+ watch_result = run_gh("run", "watch", str(run_id), capture=False)
99
+ if watch_result.returncode != 0:
100
+ print("Error: CI run failed or watch was interrupted", file=sys.stderr)
101
+ sys.exit(1)
102
+
103
+ # Re-check the conclusion after watching
104
+ result = run_gh("run", "view", str(run_id), "--json=conclusion")
105
+ if result.returncode != 0:
106
+ print("Error: Failed to get CI run conclusion", file=sys.stderr)
107
+ sys.exit(1)
108
+
109
+ run_info = json.loads(result.stdout)
110
+ conclusion = run_info.get("conclusion")
111
+
112
+ if conclusion != "success":
113
+ print(f"Error: CI checks have not passed (conclusion: {conclusion})", file=sys.stderr)
114
+ print("Fix CI issues before releasing.", file=sys.stderr)
115
+ sys.exit(1)
116
+
117
+ print("CI checks passed.")
118
+
119
+
57
120
  def check_up_to_date_with_origin() -> None:
58
121
  """Fail if main is not up to date with origin/main."""
59
122
  # Fetch latest from origin
@@ -346,7 +409,8 @@ Examples:
346
409
  check_git_clean()
347
410
  check_on_main_branch()
348
411
  check_up_to_date_with_origin()
349
- print("Git checks passed.")
412
+ check_ci_passed()
413
+ print("All checks passed.")
350
414
 
351
415
  current_version = get_current_version()
352
416
  new_version = bump_version(current_version, bump)
@@ -1,9 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sunstone-py
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Summary: Python library for managing datasets with lineage tracking in Sunstone projects
5
5
  Author-email: Sunstone Institute <stig@sunstone.institute>
6
6
  License: MIT
7
+ Project-URL: Homepage, https://github.com/sunstoneinstitute/sunstone-py
8
+ Project-URL: Documentation, https://sunstoneinstitute.github.io/sunstone-py/
9
+ Project-URL: Repository, https://github.com/sunstoneinstitute/sunstone-py
7
10
  Classifier: Development Status :: 3 - Alpha
8
11
  Classifier: Intended Audience :: Science/Research
9
12
  Classifier: License :: OSI Approved :: MIT License
@@ -1,5 +1,5 @@
1
1
  sunstone/__init__.py,sha256=LC0ZtmxP26eXPLKejbg7UStcHOnE_lwttNTL4m3F4yM,2032
2
- sunstone/_release.py,sha256=RV8k-4a-wUPIt3LA9tusVJpX1ke3OKbrki9HGxie1fk,13027
2
+ sunstone/_release.py,sha256=FXqmg9MtMRW9-1DUXrO0PgViUTgUXnMFOx_HUC2n854,15264
3
3
  sunstone/dataframe.py,sha256=3wP91L0J3Ptgg41tCRPm84UxTJsj4fy2aBCmCu15qoE,22312
4
4
  sunstone/datasets.py,sha256=rrakdvgX7EOCWWWrm8wDqOqXIRqaq-KNUqjrwsm66OI,17590
5
5
  sunstone/exceptions.py,sha256=fiixXazur3LtQGy21bGEaSr356DObFcYxQJ3FvOxNec,623
@@ -7,9 +7,9 @@ sunstone/lineage.py,sha256=B9GKMu5-v8Izos5G40K_EvsCPJL3Z2Tg1T_Fc7ezSMI,5240
7
7
  sunstone/pandas.py,sha256=CLEqIIgTbMmpH73TPy_vDUPxQa37Hpmqn4r6No8PJwo,8188
8
8
  sunstone/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  sunstone/validation.py,sha256=1356vcUc72a1zGBUe9Xjrcb5h41Xo53PaK2nnQ_FuSM,8286
10
- sunstone_py-0.4.0.dist-info/licenses/LICENSE,sha256=pB6VuR4QRjwjMjy8RSNGho-N1SUdu07ntIhT5lrhkzU,1078
11
- sunstone_py-0.4.0.dist-info/METADATA,sha256=4aPuNG9jxLZjM0Tnp8Y7jI08nEfC7c7GQrHI64c94RY,9346
12
- sunstone_py-0.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
- sunstone_py-0.4.0.dist-info/entry_points.txt,sha256=0h6E88rH9a_503BAzXvFPR-UfmkrRFjcOf29DXgJNjk,51
14
- sunstone_py-0.4.0.dist-info/top_level.txt,sha256=A2fW-7JO10rlx_L28Bc4FVvWt2R8kgvS8_TGPBhQp3c,9
15
- sunstone_py-0.4.0.dist-info/RECORD,,
10
+ sunstone_py-0.4.2.dist-info/licenses/LICENSE,sha256=pB6VuR4QRjwjMjy8RSNGho-N1SUdu07ntIhT5lrhkzU,1078
11
+ sunstone_py-0.4.2.dist-info/METADATA,sha256=ApYL9p7R7ibk6e3A4T43x9t5Cg2HzwiRBAwfmaIdFa0,9569
12
+ sunstone_py-0.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
+ sunstone_py-0.4.2.dist-info/entry_points.txt,sha256=0h6E88rH9a_503BAzXvFPR-UfmkrRFjcOf29DXgJNjk,51
14
+ sunstone_py-0.4.2.dist-info/top_level.txt,sha256=A2fW-7JO10rlx_L28Bc4FVvWt2R8kgvS8_TGPBhQp3c,9
15
+ sunstone_py-0.4.2.dist-info/RECORD,,