superset-showtime 0.2.7__py3-none-any.whl → 0.2.8__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.

Potentially problematic release.


This version of superset-showtime might be problematic. Click here for more details.

showtime/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
  Circus tent emoji state tracking for Apache Superset ephemeral environments.
5
5
  """
6
6
 
7
- __version__ = "0.2.7"
7
+ __version__ = "0.2.8"
8
8
  __author__ = "Maxime Beauchemin"
9
9
  __email__ = "maximebeauchemin@gmail.com"
10
10
 
@@ -6,7 +6,9 @@ Centralized PR comment functions with type hints and clean formatting.
6
6
 
7
7
  import os
8
8
  import textwrap
9
- from typing import Dict, Optional
9
+ from typing import Dict, List, Optional
10
+
11
+ from .circus import Show
10
12
 
11
13
  # AWS Console URL constants
12
14
  BASE_AWS_URL = "https://us-west-2.console.aws.amazon.com/ecs/v2/clusters/superset-ci/services"
@@ -31,6 +33,57 @@ def get_showtime_footer() -> str:
31
33
  return "*Powered by [Superset Showtime](https://github.com/mistercrunch/superset-showtime)*"
32
34
 
33
35
 
36
+ def _create_header_links(sha: str) -> Dict[str, str]:
37
+ """Create standard header links for comments
38
+
39
+ Args:
40
+ sha: Commit SHA for the environment
41
+
42
+ Returns:
43
+ Dict with showtime_link, gha_link, commit_link
44
+ """
45
+ from .circus import short_sha
46
+
47
+ repo_path = get_repo_path()
48
+ return {
49
+ "showtime_link": "[Showtime](https://github.com/mistercrunch/superset-showtime)",
50
+ "gha_link": f"[GHA]({get_github_workflow_url()})",
51
+ "commit_link": f"[{short_sha(sha)}]({get_commit_url(repo_path, sha)})",
52
+ }
53
+
54
+
55
+ def _format_comment(header: str, bullets: List[str]) -> str:
56
+ """Format comment with header and bullet points
57
+
58
+ Args:
59
+ header: Comment header text
60
+ bullets: List of bullet point strings (without •)
61
+ """
62
+ bullet_text = "\n".join(f"• {bullet}" for bullet in bullets)
63
+ return textwrap.dedent(
64
+ f"""
65
+ {header}
66
+
67
+ {bullet_text}
68
+ """
69
+ ).strip()
70
+
71
+
72
+ def get_commit_url(repo_path: str, sha: str) -> str:
73
+ """Get GitHub commit URL
74
+
75
+ Args:
76
+ repo_path: Repository path like 'apache/superset'
77
+ sha: Full or short commit SHA
78
+ """
79
+ return f"https://github.com/{repo_path}/commit/{sha}"
80
+
81
+
82
+ def get_repo_path() -> str:
83
+ """Get current repository path from environment"""
84
+ return os.getenv("GITHUB_REPOSITORY", "apache/superset")
85
+
86
+
34
87
  def get_aws_console_urls(service_name: str) -> Dict[str, str]:
35
88
  """Get AWS Console URLs for a service"""
36
89
  return {
@@ -43,92 +96,76 @@ def get_aws_console_urls(service_name: str) -> Dict[str, str]:
43
96
  # Typed comment functions with clear parameter requirements
44
97
 
45
98
 
46
- def start_comment(show) -> str:
99
+ def start_comment(show: Show) -> str:
47
100
  """Create environment start comment
48
101
 
49
102
  Args:
50
103
  show: Show object with SHA and other metadata
51
104
  """
52
- return textwrap.dedent(
53
- f"""
54
- 🎪 @{get_github_actor()} Creating ephemeral environment for commit `{show.short_sha}`
105
+ links = _create_header_links(show.sha)
106
+ return f"🎪 {links['showtime_link']} is building environment on {links['gha_link']} for {links['commit_link']}"
55
107
 
56
- **Action:** [View workflow]({get_github_workflow_url()})
57
- **Environment:** `{show.short_sha}`
58
- **Powered by:** [Superset Showtime](https://github.com/mistercrunch/superset-showtime)
59
108
 
60
- *Building and deploying... Watch the labels for progress updates.*
61
- """
62
- ).strip()
63
-
64
-
65
- def success_comment(show, feature_count: Optional[int] = None) -> str:
109
+ def success_comment(show: Show, feature_count: Optional[int] = None) -> str:
66
110
  """Environment success comment
67
111
 
68
112
  Args:
69
113
  show: Show object with SHA, IP, TTL, etc.
70
114
  feature_count: Number of enabled feature flags (optional)
71
115
  """
72
- feature_line = f"**Feature flags:** {feature_count} enabled\n" if feature_count else ""
116
+ links = _create_header_links(show.sha)
117
+ header = f"🎪 {links['showtime_link']} deployed environment on {links['gha_link']} for {links['commit_link']}"
73
118
 
74
- return textwrap.dedent(
75
- f"""
76
- 🎪 @{get_github_actor()} Environment ready at **http://{show.ip}:8080**
119
+ bullets = [
120
+ f"**Environment:** http://{show.ip}:8080 (admin/admin)",
121
+ f"**Lifetime:** {show.ttl} auto-cleanup",
122
+ ]
77
123
 
78
- **Environment:** `{show.short_sha}`
79
- **Credentials:** admin / admin
80
- **TTL:** {show.ttl} (auto-cleanup)
81
- {feature_line}
82
- **Configuration:** Modify feature flags in your PR code for new SHA
83
- **Updates:** Environment updates automatically on new commits
124
+ if feature_count:
125
+ bullets.insert(-1, f"**Features:** {feature_count} enabled")
84
126
 
85
- {get_showtime_footer()}
86
- """
87
- ).strip()
127
+ bullets.append("**Updates:** New commits create fresh environments automatically")
88
128
 
129
+ return _format_comment(header, bullets)
89
130
 
90
- def failure_comment(show, error: str) -> str:
131
+
132
+ def failure_comment(show: Show, error: str) -> str:
91
133
  """Environment failure comment
92
134
 
93
135
  Args:
94
136
  show: Show object with SHA and metadata
95
137
  error: Error message describing what went wrong
96
138
  """
97
- return textwrap.dedent(
98
- f"""
99
- 🎪 @{get_github_actor()} Environment creation failed.
100
-
101
- **Error:** {error}
102
- **Environment:** `{show.short_sha}`
139
+ links = _create_header_links(show.sha)
140
+ header = f"🎪 {links['showtime_link']} failed building environment on {links['gha_link']} for {links['commit_link']}"
103
141
 
104
- Please check the logs and try again.
142
+ bullets = [
143
+ f"**Error:** {error}",
144
+ "**Action:** Check logs and try again with `🎪 ⚡ showtime-trigger-start`",
145
+ ]
105
146
 
106
- {get_showtime_footer()}
107
- """
108
- ).strip()
147
+ return _format_comment(header, bullets)
109
148
 
110
149
 
111
- def cleanup_comment(show) -> str:
150
+ def cleanup_comment(show: Show) -> str:
112
151
  """Environment cleanup comment
113
152
 
114
153
  Args:
115
154
  show: Show object with SHA and metadata
116
155
  """
117
- return textwrap.dedent(
118
- f"""
119
- 🎪 @{get_github_actor()} Environment `{show.short_sha}` cleaned up
156
+ links = _create_header_links(show.sha)
157
+ header = f"🎪 {links['showtime_link']} cleaned up environment on {links['gha_link']} for {links['commit_link']}"
120
158
 
121
- **AWS Resources:** ECS service and ECR image deleted
122
- **Cost Impact:** No further charges
159
+ bullets = [
160
+ "**Resources:** ECS service and ECR image deleted",
161
+ "**Cost:** No further charges",
162
+ "**Action:** Add `🎪 ⚡ showtime-trigger-start` to create new environment",
163
+ ]
123
164
 
124
- Add `🎪 ⚡ showtime-trigger-start` to create a new environment.
165
+ return _format_comment(header, bullets)
125
166
 
126
- {get_showtime_footer()}
127
- """
128
- ).strip()
129
167
 
130
-
131
- def rolling_start_comment(current_show, new_sha: str) -> str:
168
+ def rolling_start_comment(current_show: Show, new_sha: str) -> str:
132
169
  """Rolling update start comment
133
170
 
134
171
  Args:
@@ -137,44 +174,38 @@ def rolling_start_comment(current_show, new_sha: str) -> str:
137
174
  """
138
175
  from .circus import short_sha
139
176
 
140
- return textwrap.dedent(
141
- f"""
142
- 🎪 @{get_github_actor()} Detected new commit - starting rolling update `{current_show.short_sha}` → `{short_sha(new_sha)}`
177
+ links = _create_header_links(new_sha)
178
+ header = f"🎪 {links['showtime_link']} is updating {current_show.short_sha}→{short_sha(new_sha)} on {links['gha_link']} for {links['commit_link']}"
143
179
 
144
- **Action:** Zero-downtime blue-green deployment
145
- **Progress:** [View workflow]({get_github_workflow_url()})
146
- **Current:** `{current_show.short_sha}` at http://{current_show.ip}:8080
147
- **New:** `{short_sha(new_sha)}` (building...)
180
+ bullets = [
181
+ f"**Current:** http://{current_show.ip}:8080 (still active)",
182
+ "**Update:** Zero-downtime blue-green deployment",
183
+ ]
148
184
 
149
- *New environment will replace current one automatically.*
150
- """
151
- ).strip()
185
+ return _format_comment(header, bullets)
152
186
 
153
187
 
154
- def rolling_success_comment(old_show, new_show) -> str:
188
+ def rolling_success_comment(old_show: Show, new_show: Show) -> str:
155
189
  """Rolling update success comment
156
190
 
157
191
  Args:
158
192
  old_show: Previous Show object
159
193
  new_show: New Show object with updated IP, SHA, TTL
160
194
  """
161
- return textwrap.dedent(
162
- f"""
163
- 🎪 @{get_github_actor()} Rolling update complete! `{old_show.short_sha}` → `{new_show.short_sha}`
195
+ links = _create_header_links(new_show.sha)
196
+ header = f"🎪 {links['showtime_link']} updated environment {old_show.short_sha}→{new_show.short_sha} on {links['gha_link']} for {links['commit_link']}"
164
197
 
165
- **New Environment:** **http://{new_show.ip}:8080**
166
- **Deployment:** Zero-downtime blue-green deployment
167
- **Credentials:** admin / admin
168
- **TTL:** {new_show.ttl} (auto-cleanup)
198
+ bullets = [
199
+ f"**Environment:** http://{new_show.ip}:8080 (admin/admin)",
200
+ f"**Lifetime:** {new_show.ttl} auto-cleanup",
201
+ "**Deployment:** Zero-downtime blue-green",
202
+ "**Updates:** New commits create fresh environments automatically",
203
+ ]
169
204
 
170
- Your latest changes are now live.
171
-
172
- {get_showtime_footer()}
173
- """
174
- ).strip()
205
+ return _format_comment(header, bullets)
175
206
 
176
207
 
177
- def rolling_failure_comment(current_show, new_sha: str, error: str) -> str:
208
+ def rolling_failure_comment(current_show: Show, new_sha: str, error: str) -> str:
178
209
  """Rolling update failure comment
179
210
 
180
211
  Args:
@@ -184,15 +215,13 @@ def rolling_failure_comment(current_show, new_sha: str, error: str) -> str:
184
215
  """
185
216
  from .circus import short_sha
186
217
 
187
- return textwrap.dedent(
188
- f"""
189
- 🎪 @{get_github_actor()} Rolling update failed `{current_show.short_sha}` → `{short_sha(new_sha)}`
218
+ links = _create_header_links(new_sha)
219
+ header = f"🎪 {links['showtime_link']} failed updating to {short_sha(new_sha)} on {links['gha_link']} for {links['commit_link']}"
190
220
 
191
- **Error:** {error}
192
- **Current:** Environment `{current_show.short_sha}` remains active at http://{current_show.ip}:8080
221
+ bullets = [
222
+ f"**Error:** {error}",
223
+ f"**Current:** http://{current_show.ip}:8080 (still active)",
224
+ "**Action:** Check logs and try again with `🎪 ⚡ showtime-trigger-start`",
225
+ ]
193
226
 
194
- Please check the logs and try again with `🎪 ⚡ showtime-trigger-start`.
195
-
196
- {get_showtime_footer()}
197
- """
198
- ).strip()
227
+ return _format_comment(header, bullets)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: superset-showtime
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: 🎪 Apache Superset ephemeral environment management with circus tent emoji state tracking
5
5
  Project-URL: Homepage, https://github.com/apache/superset-showtime
6
6
  Project-URL: Documentation, https://superset-showtime.readthedocs.io/
@@ -1,4 +1,4 @@
1
- showtime/__init__.py,sha256=pBsaci8fhtn2mWIys_2AKT2zpvBfW6-3cMwPhpKRwvM,420
1
+ showtime/__init__.py,sha256=1wse0Q42I1-_VwF1AYaIDYvkqx4eC32omodFrMeStlE,420
2
2
  showtime/__main__.py,sha256=EVaDaTX69yIhCzChg99vqvFSCN4ELstEt7Mpb9FMZX8,109
3
3
  showtime/cli.py,sha256=gd8OIjdQov7ei8A9A2X8bdreOeWJVhc5FFhAN9u_spQ,62913
4
4
  showtime/commands/__init__.py,sha256=M2wn5hYgwNCryMjLT79ncobvK884r-xk3znkCmINN_0,28
@@ -8,10 +8,10 @@ showtime/core/aws.py,sha256=xWrje3MS3LpFeilH6jloWy_VgE9Wky_G5VkRCOB0ZNw,32535
8
8
  showtime/core/circus.py,sha256=dtYEU1YnmaE9oWhPwrPiMof1GF5tzckvcDrc9iJ9VpQ,9037
9
9
  showtime/core/emojis.py,sha256=MHEDuPIdfNiop4zbNLuviz3eY05QiftYSHHCVbkfKhw,2129
10
10
  showtime/core/github.py,sha256=HWhM8_Yq4P-AHq0FV3UfrfQHUHXxkhn74vvc_9RguKA,9822
11
- showtime/core/github_messages.py,sha256=4LZXsXp-tQ9NvIucCklNH4cfGU7giNdOcrpDPDW2VtE,5990
11
+ showtime/core/github_messages.py,sha256=iKd3AS0uvTnCtR-2jPtEq_efuThC8HUzEAMmQt5c3y4,7187
12
12
  showtime/core/label_colors.py,sha256=efhbFnz_3nqEnEqmgyF6_hZbxtCu_fmb68BIIUpSsnk,3895
13
13
  showtime/data/ecs-task-definition.json,sha256=0ZaE0FZ8IWduXd2RyscMhXeVgxyym6qtjH02CK9mXBI,2235
14
- superset_showtime-0.2.7.dist-info/METADATA,sha256=8CIOONb3KbcoOP-B3iySqerxHHYng7pPGpATBWtccco,14635
15
- superset_showtime-0.2.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- superset_showtime-0.2.7.dist-info/entry_points.txt,sha256=rDW7oZ57mqyBUS4N_3_R7bZNGVHB-104jwmY-hHC_ck,85
17
- superset_showtime-0.2.7.dist-info/RECORD,,
14
+ superset_showtime-0.2.8.dist-info/METADATA,sha256=fMZkdKW3pgcxx-AXRP5rmTpmOBLEXtVcSaLr2L5A7xg,14635
15
+ superset_showtime-0.2.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
+ superset_showtime-0.2.8.dist-info/entry_points.txt,sha256=rDW7oZ57mqyBUS4N_3_R7bZNGVHB-104jwmY-hHC_ck,85
17
+ superset_showtime-0.2.8.dist-info/RECORD,,