Skip to content

Commit 71b21e6

Browse files
jkebingerclaude
andcommitted
Bump version to 1.2.0 and add dev runner script
- Bump version to 1.2.0 for SSE watchdog and error handling improvements - Add dev_runner.py for observing SDK behavior during development Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c981e56 commit 71b21e6

3 files changed

Lines changed: 100 additions & 2 deletions

File tree

dev_runner.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Development runner to observe SDK behavior including SSE streaming and watchdog.
4+
5+
Usage:
6+
REFORGE_SDK_KEY=your-key python dev_runner.py
7+
8+
Or set a specific config key to watch:
9+
REFORGE_SDK_KEY=your-key python dev_runner.py my.config.key
10+
"""
11+
12+
import logging
13+
import sys
14+
import time
15+
import os
16+
17+
from sdk_reforge import ReforgeSDK, Options
18+
19+
20+
def setup_logging() -> None:
21+
"""Configure logging to show SDK internals."""
22+
root_logger = logging.getLogger()
23+
handler = logging.StreamHandler(sys.stdout)
24+
handler.setFormatter(
25+
logging.Formatter(
26+
"%(asctime)s [%(levelname)s] %(name)s: %(message)s",
27+
datefmt="%H:%M:%S",
28+
)
29+
)
30+
root_logger.addHandler(handler)
31+
32+
# Set root to DEBUG to see everything
33+
root_logger.setLevel(logging.DEBUG)
34+
35+
# Quiet down noisy libraries
36+
logging.getLogger("urllib3").setLevel(logging.WARNING)
37+
logging.getLogger("requests").setLevel(logging.WARNING)
38+
39+
40+
def main() -> None:
41+
setup_logging()
42+
43+
sdk_key = os.environ.get("REFORGE_SDK_KEY")
44+
if not sdk_key:
45+
print("Error: REFORGE_SDK_KEY environment variable not set")
46+
print("Usage: REFORGE_SDK_KEY=your-key python dev_runner.py [config.key]")
47+
sys.exit(1)
48+
49+
# Optional: config key to watch
50+
watch_key = sys.argv[1] if len(sys.argv) > 1 else None
51+
52+
print(f"Starting SDK with key: {sdk_key[:10]}...")
53+
print(f"Watching config key: {watch_key or '(none)'}")
54+
print("Press Ctrl+C to stop\n")
55+
print("=" * 60)
56+
57+
options = Options(
58+
sdk_key=sdk_key,
59+
connection_timeout_seconds=10,
60+
)
61+
62+
sdk = ReforgeSDK(options)
63+
config_sdk = sdk.config_sdk()
64+
65+
print("=" * 60)
66+
print("SDK initialized, entering main loop...")
67+
print("=" * 60 + "\n")
68+
69+
try:
70+
iteration = 0
71+
while True:
72+
iteration += 1
73+
74+
status_parts = [
75+
f"[{iteration}]",
76+
f"initialized={config_sdk.is_ready()}",
77+
f"hwm={config_sdk.highwater_mark()}",
78+
]
79+
80+
if watch_key:
81+
try:
82+
value = config_sdk.get(watch_key, default="<not found>")
83+
status_parts.append(f"{watch_key}={value!r}")
84+
except Exception as e:
85+
status_parts.append(f"{watch_key}=<error: {e}>")
86+
87+
print(" | ".join(status_parts))
88+
time.sleep(5)
89+
90+
except KeyboardInterrupt:
91+
print("\n\nShutting down...")
92+
93+
sdk.close()
94+
print("Done.")
95+
96+
97+
if __name__ == "__main__":
98+
main()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "sdk-reforge"
3-
version = "1.1.1"
3+
version = "1.2.0"
44
description = "Python sdk for Reforge Feature Flags and Config as a Service: https://www.reforge.com"
55
license = "MIT"
66
authors = ["Michael Berkowitz <michael.berkowitz@gmail.com>", "James Kebinger <james.kebinger@reforge.com>"]

sdk_reforge/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.1
1+
1.2.0

0 commit comments

Comments
 (0)