superset-showtime 0.3.3__tar.gz → 0.4.2__tar.gz

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.

Files changed (37) hide show
  1. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/.claude/settings.local.json +7 -1
  2. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/.pre-commit-config.yaml +8 -0
  3. superset_showtime-0.4.2/CLAUDE.md +160 -0
  4. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/Makefile +1 -1
  5. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/PKG-INFO +17 -9
  6. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/README.md +15 -8
  7. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/pyproject.toml +2 -1
  8. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/requirements-dev.txt +18 -0
  9. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/showtime/__init__.py +3 -2
  10. superset_showtime-0.4.2/showtime/cli.py +679 -0
  11. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/showtime/core/aws.py +30 -26
  12. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/showtime/core/github.py +10 -6
  13. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/showtime/core/github_messages.py +4 -4
  14. superset_showtime-0.4.2/showtime/core/pull_request.py +536 -0
  15. superset_showtime-0.4.2/showtime/core/show.py +279 -0
  16. superset_showtime-0.4.2/tests/unit/test_pull_request.py +666 -0
  17. superset_showtime-0.4.2/tests/unit/test_show.py +292 -0
  18. superset_showtime-0.3.3/CLAUDE.md +0 -221
  19. superset_showtime-0.3.3/showtime/cli.py +0 -1928
  20. superset_showtime-0.3.3/showtime/commands/__init__.py +0 -1
  21. superset_showtime-0.3.3/showtime/commands/start.py +0 -40
  22. superset_showtime-0.3.3/showtime/core/circus.py +0 -289
  23. superset_showtime-0.3.3/tests/unit/test_circus.py +0 -100
  24. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/.gitignore +0 -0
  25. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/dev-setup.sh +0 -0
  26. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/pypi-push.sh +0 -0
  27. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/requirements.txt +0 -0
  28. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/showtime/__main__.py +0 -0
  29. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/showtime/core/__init__.py +0 -0
  30. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/showtime/core/emojis.py +0 -0
  31. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/showtime/core/label_colors.py +0 -0
  32. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/showtime/data/ecs-task-definition.json +0 -0
  33. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/tests/__init__.py +0 -0
  34. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/tests/unit/__init__.py +0 -0
  35. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/uv.lock +0 -0
  36. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/workflows-reference/showtime-cleanup.yml +0 -0
  37. {superset_showtime-0.3.3 → superset_showtime-0.4.2}/workflows-reference/showtime-trigger.yml +0 -0
@@ -35,7 +35,13 @@
35
35
  "Bash(git pull:*)",
36
36
  "Bash(git rebase:*)",
37
37
  "Bash(git fetch:*)",
38
- "Read(//Users/max/.claudette/worktrees/showtime/**)"
38
+ "Read(//Users/max/.claudette/worktrees/showtime/**)",
39
+ "Bash(rg:*)",
40
+ "Bash(find:*)",
41
+ "Bash(make:*)",
42
+ "Bash(showtime status:*)",
43
+ "Bash(showtime sync:*)",
44
+ "Bash(AWS_PROFILE=\"\" showtime sync 34831 --dry-run-aws --dry-run-github)"
39
45
  ],
40
46
  "deny": [],
41
47
  "ask": []
@@ -17,3 +17,11 @@ repos:
17
17
  - id: ruff
18
18
  args: [--fix]
19
19
  - id: ruff-format
20
+
21
+ # TODO: Re-enable after fixing boto3-stubs type conflicts
22
+ # - repo: https://github.com/pre-commit/mirrors-mypy
23
+ # rev: v1.8.0
24
+ # hooks:
25
+ # - id: mypy
26
+ # files: ^showtime/
27
+ # additional_dependencies: [types-requests, "boto3-stubs[ecs,ecr,ec2]"]
@@ -0,0 +1,160 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ Superset Showtime is a CLI tool for managing Apache Superset ephemeral environments using "circus tent emoji labels" as a visual state management system on GitHub PRs. The tool integrates with GitHub Actions to provide automated environment provisioning on AWS ECS/ECR.
8
+
9
+ ## Development Commands
10
+
11
+ **Package Management:**
12
+ ```bash
13
+ # Install for development (preferred)
14
+ uv pip install -e ".[dev]"
15
+
16
+ # Traditional pip installation
17
+ pip install -e ".[dev]"
18
+ ```
19
+
20
+ **Code Quality:**
21
+ ```bash
22
+ make lint # Run ruff and mypy checks
23
+ make format # Auto-format with ruff
24
+ make pre-commit # Install pre-commit hooks
25
+ make pre-commit-run # Run all pre-commit hooks
26
+ ```
27
+
28
+ **Testing:**
29
+ ```bash
30
+ make test # Run pytest
31
+ make test-cov # Run tests with coverage report
32
+ pytest tests/unit/test_circus.py # Run specific test file
33
+ ```
34
+
35
+ **Build and Distribution:**
36
+ ```bash
37
+ make build # Build package with uv
38
+ make publish # Publish to PyPI (use with caution)
39
+ make clean # Clean build artifacts
40
+ ```
41
+
42
+ **Quick Testing:**
43
+ ```bash
44
+ make circus # Test circus emoji parsing logic
45
+ ```
46
+
47
+ ## Core Architecture
48
+
49
+ ### Main Components
50
+
51
+ **CLI Layer (`showtime/cli.py`):**
52
+ - Typer-based CLI with rich output formatting
53
+ - Commands: `sync`, `start`, `stop`, `status`, `list`, `labels`, `cleanup`
54
+ - Primary entry point for GitHub Actions and manual usage
55
+
56
+ **Core Business Logic (`showtime/core/`):**
57
+
58
+ 1. **PullRequest (`pull_request.py`)** - Main orchestrator
59
+ - Manages PR-level state and atomic transactions
60
+ - Handles trigger processing and environment lifecycle
61
+ - Coordinates between GitHub labels and AWS resources
62
+ - Implements sync logic for automatic deployments
63
+
64
+ 2. **Show (`show.py`)** - Individual environment representation
65
+ - Represents a single ephemeral environment
66
+ - Manages Docker builds and AWS deployments
67
+ - Handles state transitions (building → running → failed)
68
+
69
+ 3. **GitHubInterface (`github.py`)** - GitHub API client
70
+ - Label management and PR data fetching
71
+ - Circus tent emoji label parsing and creation
72
+ - Token detection from environment or gh CLI
73
+
74
+ 4. **AWSInterface (`aws.py`)** - AWS operations
75
+ - ECS service deployment and management
76
+ - ECR image management
77
+ - Network configuration and service discovery
78
+
79
+ ### State Management Pattern
80
+
81
+ The system uses GitHub labels as a distributed state machine:
82
+
83
+ **Trigger Labels (User Actions):**
84
+ - `🎪 ⚡ showtime-trigger-start` - Create environment
85
+ - `🎪 🛑 showtime-trigger-stop` - Destroy environment
86
+ - `🎪 🧊 showtime-freeze` - Prevent auto-sync
87
+
88
+ **State Labels (System Managed):**
89
+ - `🎪 {sha} 🚦 {status}` - Environment status
90
+ - `🎪 🎯 {sha}` - Active environment pointer
91
+ - `🎪 🏗️ {sha}` - Building environment pointer
92
+ - `🎪 {sha} 🌐 {ip}` - Environment URL
93
+ - `🎪 {sha} 📅 {timestamp}` - Creation timestamp
94
+
95
+ ### Atomic Transaction Model
96
+
97
+ The `PullRequest.sync()` method implements an atomic claim pattern:
98
+ 1. **Claim**: Atomically remove trigger labels and set building state
99
+ 2. **Build**: Docker build with deterministic tags (`pr-{number}-{sha}-ci`)
100
+ 3. **Deploy**: AWS ECS service deployment with blue-green updates
101
+ 4. **Validate**: Health checks and state synchronization
102
+
103
+ ## Testing Approach
104
+
105
+ **Unit Tests:** Focus on circus label parsing and business logic
106
+ **Integration Tests:** Test with `--dry-run-aws --dry-run-docker` flags
107
+ **Manual Testing:** Use CLI commands with dry-run modes
108
+
109
+ ## Key Design Principles
110
+
111
+ 1. **Deterministic Naming:** All AWS resources use `pr-{number}-{sha}` pattern
112
+ 2. **Idempotent Operations:** Safe to retry any operation
113
+ 3. **Visual State Management:** GitHub labels provide immediate status visibility
114
+ 4. **Zero-Downtime Updates:** Blue-green deployments with automatic traffic switching
115
+ 5. **Fail-Safe Defaults:** Conservative cleanup and error handling
116
+
117
+ ## Environment Variables
118
+
119
+ **Required:**
120
+ - `GITHUB_TOKEN` - GitHub API access
121
+ - `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` - AWS credentials
122
+
123
+ **Optional:**
124
+ - `AWS_REGION` - Default: us-west-2
125
+ - `ECS_CLUSTER` - Default: superset-ci
126
+ - `ECR_REPOSITORY` - Default: superset-ci
127
+ - `GITHUB_ORG` - Default: apache
128
+ - `GITHUB_REPO` - Default: superset
129
+
130
+ ## GitHub Actions Integration
131
+
132
+ The tool is designed to be called from GitHub Actions workflows:
133
+ ```yaml
134
+ - name: Install Superset Showtime
135
+ run: pip install superset-showtime
136
+
137
+ - name: Sync PR state
138
+ run: showtime sync ${{ github.event.number }}
139
+ ```
140
+
141
+ Primary workflow file: `workflows-reference/showtime-trigger.yml`
142
+
143
+ ## Common Development Patterns
144
+
145
+ **Testing without AWS costs:**
146
+ ```bash
147
+ showtime sync 1234 --dry-run-aws --dry-run-docker
148
+ ```
149
+
150
+ **Debugging specific PR:**
151
+ ```bash
152
+ showtime status 1234 --verbose
153
+ showtime list --status running
154
+ ```
155
+
156
+ **Manual environment management:**
157
+ ```bash
158
+ showtime start 1234 --sha abc123f
159
+ showtime stop 1234 --force
160
+ ```
@@ -51,4 +51,4 @@ publish: ## Publish to PyPI (use with caution)
51
51
  uvx twine upload dist/*
52
52
 
53
53
  circus: ## Quick test of circus emoji parsing
54
- python -c "from showtime.core.circus import parse_circus_labels; print(parse_circus_labels(['🎪 🚦 running', '🎪 🎯 abc123f']))"
54
+ python -c "from showtime.core.show import Show; labels=['🎪 abc123f 🚦 running', '🎪 🎯 abc123f']; show=Show.from_circus_labels(1234, labels, 'abc123f'); print(f'Status: {show.status}, SHA: {show.sha}')"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: superset-showtime
3
- Version: 0.3.3
3
+ Version: 0.4.2
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/
@@ -49,6 +49,7 @@ Provides-Extra: azure
49
49
  Requires-Dist: azure-mgmt-containerinstance>=10.0.0; extra == 'azure'
50
50
  Requires-Dist: azure-storage-blob>=12.0.0; extra == 'azure'
51
51
  Provides-Extra: dev
52
+ Requires-Dist: boto3-stubs[ec2,ecr,ecs]>=1.40.0; extra == 'dev'
52
53
  Requires-Dist: build>=1.0.0; extra == 'dev'
53
54
  Requires-Dist: mypy>=1.0.0; extra == 'dev'
54
55
  Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
@@ -157,11 +158,11 @@ showtime labels # Complete label reference
157
158
 
158
159
  **Testing/development:**
159
160
  ```bash
160
- showtime start 1234 --dry-run-aws # Test without AWS costs
161
- showtime test-lifecycle 1234 # Full workflow simulation
161
+ showtime sync 1234 --dry-run-aws --dry-run-docker # Test without costs
162
+ showtime cleanup --dry-run --older-than 1h # Test cleanup logic
162
163
  ```
163
164
 
164
- > **Dependency**: This CLI coordinates with Superset's existing GitHub Actions build infrastructure. It orchestrates environments but relies on Superset's build workflows for container creation.
165
+ > **Architecture**: This CLI implements ACID-style atomic transactions with direct Docker integration. It handles complete environment lifecycle from Docker build to AWS deployment with race condition prevention.
165
166
 
166
167
  ## 🎪 Complete Label Reference
167
168
 
@@ -275,7 +276,14 @@ The CLI is primarily used by GitHub Actions, but available for debugging and adv
275
276
  ```bash
276
277
  pip install superset-showtime
277
278
  export GITHUB_TOKEN=your_token
278
- showtime --help # See all available commands
279
+
280
+ # Core commands:
281
+ showtime sync PR_NUMBER # Sync to desired state (main command)
282
+ showtime start PR_NUMBER # Create new environment
283
+ showtime stop PR_NUMBER # Delete environment
284
+ showtime status PR_NUMBER # Show current state
285
+ showtime list # List all environments
286
+ showtime cleanup --older-than 48h # Clean up expired environments
279
287
  ```
280
288
 
281
289
 
@@ -286,11 +294,11 @@ showtime --help # See all available commands
286
294
 
287
295
  **Test with real PRs safely:**
288
296
  ```bash
289
- # Test label management without AWS costs:
290
- showtime start YOUR_PR_NUMBER --dry-run-aws --aws-sleep 10
297
+ # Test full workflow without costs:
298
+ showtime sync YOUR_PR_NUMBER --dry-run-aws --dry-run-docker
291
299
 
292
- # Test full lifecycle:
293
- showtime test-lifecycle YOUR_PR_NUMBER --real-github
300
+ # Test cleanup logic:
301
+ showtime cleanup --dry-run --older-than 24h
294
302
  ```
295
303
 
296
304
  ### Development Setup
@@ -92,11 +92,11 @@ showtime labels # Complete label reference
92
92
 
93
93
  **Testing/development:**
94
94
  ```bash
95
- showtime start 1234 --dry-run-aws # Test without AWS costs
96
- showtime test-lifecycle 1234 # Full workflow simulation
95
+ showtime sync 1234 --dry-run-aws --dry-run-docker # Test without costs
96
+ showtime cleanup --dry-run --older-than 1h # Test cleanup logic
97
97
  ```
98
98
 
99
- > **Dependency**: This CLI coordinates with Superset's existing GitHub Actions build infrastructure. It orchestrates environments but relies on Superset's build workflows for container creation.
99
+ > **Architecture**: This CLI implements ACID-style atomic transactions with direct Docker integration. It handles complete environment lifecycle from Docker build to AWS deployment with race condition prevention.
100
100
 
101
101
  ## 🎪 Complete Label Reference
102
102
 
@@ -210,7 +210,14 @@ The CLI is primarily used by GitHub Actions, but available for debugging and adv
210
210
  ```bash
211
211
  pip install superset-showtime
212
212
  export GITHUB_TOKEN=your_token
213
- showtime --help # See all available commands
213
+
214
+ # Core commands:
215
+ showtime sync PR_NUMBER # Sync to desired state (main command)
216
+ showtime start PR_NUMBER # Create new environment
217
+ showtime stop PR_NUMBER # Delete environment
218
+ showtime status PR_NUMBER # Show current state
219
+ showtime list # List all environments
220
+ showtime cleanup --older-than 48h # Clean up expired environments
214
221
  ```
215
222
 
216
223
 
@@ -221,11 +228,11 @@ showtime --help # See all available commands
221
228
 
222
229
  **Test with real PRs safely:**
223
230
  ```bash
224
- # Test label management without AWS costs:
225
- showtime start YOUR_PR_NUMBER --dry-run-aws --aws-sleep 10
231
+ # Test full workflow without costs:
232
+ showtime sync YOUR_PR_NUMBER --dry-run-aws --dry-run-docker
226
233
 
227
- # Test full lifecycle:
228
- showtime test-lifecycle YOUR_PR_NUMBER --real-github
234
+ # Test cleanup logic:
235
+ showtime cleanup --dry-run --older-than 24h
229
236
  ```
230
237
 
231
238
  ### Development Setup
@@ -77,6 +77,7 @@ dev = [
77
77
  "pre-commit>=3.0.0",
78
78
  "build>=1.0.0",
79
79
  "twine>=4.0.0",
80
+ "boto3-stubs[ecs,ecr,ec2]>=1.40.0",
80
81
  ]
81
82
 
82
83
  [project.urls]
@@ -120,7 +121,7 @@ ignore = [
120
121
  "__init__.py" = ["F401"]
121
122
 
122
123
  [tool.mypy]
123
- python_version = "3.8"
124
+ python_version = "3.10"
124
125
  warn_return_any = true
125
126
  warn_unused_configs = true
126
127
  disallow_untyped_defs = true
@@ -8,11 +8,15 @@ backports-tarfile==1.2.0
8
8
  # via jaraco-context
9
9
  boto3==1.40.16
10
10
  # via superset-showtime (pyproject.toml)
11
+ boto3-stubs==1.40.16
12
+ # via superset-showtime (pyproject.toml)
11
13
  botocore==1.40.16
12
14
  # via
13
15
  # superset-showtime (pyproject.toml)
14
16
  # boto3
15
17
  # s3transfer
18
+ botocore-stubs==1.38.46
19
+ # via boto3-stubs
16
20
  build==1.3.0
17
21
  # via superset-showtime (pyproject.toml)
18
22
  certifi==2025.8.3
@@ -79,6 +83,12 @@ more-itertools==10.7.0
79
83
  # jaraco-functools
80
84
  mypy==1.17.1
81
85
  # via superset-showtime (pyproject.toml)
86
+ mypy-boto3-ec2==1.40.13
87
+ # via boto3-stubs
88
+ mypy-boto3-ecr==1.40.0
89
+ # via boto3-stubs
90
+ mypy-boto3-ecs==1.40.15
91
+ # via boto3-stubs
82
92
  mypy-extensions==1.1.0
83
93
  # via mypy
84
94
  nh3==0.3.0
@@ -157,10 +167,18 @@ twine==6.1.0
157
167
  # via superset-showtime (pyproject.toml)
158
168
  typer==0.16.1
159
169
  # via superset-showtime (pyproject.toml)
170
+ types-awscrt==0.27.6
171
+ # via botocore-stubs
172
+ types-s3transfer==0.13.0
173
+ # via boto3-stubs
160
174
  typing-extensions==4.14.1
161
175
  # via
162
176
  # anyio
177
+ # boto3-stubs
163
178
  # mypy
179
+ # mypy-boto3-ec2
180
+ # mypy-boto3-ecr
181
+ # mypy-boto3-ecs
164
182
  # pydantic
165
183
  # pydantic-core
166
184
  # typer
@@ -4,12 +4,13 @@
4
4
  Circus tent emoji state tracking for Apache Superset ephemeral environments.
5
5
  """
6
6
 
7
- __version__ = "0.3.3"
7
+ __version__ = "0.4.2"
8
8
  __author__ = "Maxime Beauchemin"
9
9
  __email__ = "maximebeauchemin@gmail.com"
10
10
 
11
- from .core.circus import PullRequest, Show
12
11
  from .core.github import GitHubInterface
12
+ from .core.pull_request import PullRequest
13
+ from .core.show import Show
13
14
 
14
15
  __all__ = [
15
16
  "__version__",