grctl-sdk-python 0.2.0__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.
grctl/__init__.py ADDED
@@ -0,0 +1 @@
1
+ """Ground Control Python SDK package."""
@@ -0,0 +1,50 @@
1
+ """Custom logging configuration for Ground Control."""
2
+
3
+ import logging
4
+ import sys
5
+
6
+
7
+ class CustomFormatter(logging.Formatter):
8
+ def format(self, record: logging.LogRecord) -> str:
9
+ # Format: LEVEL TIME METHOD:LINE_NUM MESSAGE
10
+ timestamp = self.formatTime(record, "%H:%M:%S")
11
+
12
+ level = record.levelname
13
+
14
+ # Get class/function context
15
+ context = f"{record.module}"
16
+ if record.funcName != "<module>":
17
+ context = f"{context}.{record.funcName}:{record.lineno}"
18
+
19
+ # Format the message
20
+ msg = f"{level} {timestamp} [{context}] {record.getMessage()}"
21
+
22
+ # Add exception info if present
23
+ if record.exc_info:
24
+ msg += "\n" + self.formatException(record.exc_info)
25
+
26
+ return msg
27
+
28
+
29
+ def setup_logging(level: int = logging.INFO) -> None:
30
+ """Configure root logger with custom formatter."""
31
+ handler = logging.StreamHandler(sys.stdout)
32
+ handler.setLevel(level)
33
+
34
+ formatter = CustomFormatter()
35
+ handler.setFormatter(formatter)
36
+
37
+ root_logger = logging.getLogger()
38
+ root_logger.setLevel(level)
39
+ root_logger.addHandler(handler)
40
+
41
+
42
+ def get_logger(name: str) -> logging.Logger:
43
+ """Get a logger instance with the custom formatter already configured."""
44
+ logger = logging.getLogger(name)
45
+
46
+ # Set logger level to DEBUG to allow all messages through
47
+ # Actual filtering happens at handler level
48
+ logger.setLevel(logging.DEBUG)
49
+
50
+ return logger
grctl/settings.py ADDED
@@ -0,0 +1,22 @@
1
+ from functools import lru_cache
2
+
3
+ from pydantic_settings import BaseSettings, SettingsConfigDict
4
+
5
+
6
+ class EngineSettings(BaseSettings):
7
+ nats_servers: list[str] = ["nats://localhost:4225"]
8
+ nats_connect_timeout: float = 2.0
9
+ nats_request_timeout: float = 5.0
10
+ nats_max_reconnect_attempts: int = 10
11
+ nats_reconnect_time_wait: float = 2.0
12
+ nats_worker_ack_wait: float = 5.0
13
+
14
+ model_config = SettingsConfigDict(
15
+ env_prefix="ENGINE_",
16
+ )
17
+
18
+
19
+ @lru_cache
20
+ def get_settings() -> EngineSettings:
21
+ """Get engine settings from environment variables."""
22
+ return EngineSettings()
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: grctl-sdk-python
3
+ Version: 0.2.0
4
+ Summary: The Python SDK for the grctl platform
5
+ Requires-Python: >=3.13
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: nats-py>=2.7.0
8
+ Requires-Dist: msgspec>=0.18.0
9
+ Requires-Dist: python-ulid>=2.0.0
10
+ Requires-Dist: pydantic-settings>=2.11.0
11
+ Requires-Dist: pyyaml>=6.0.3
12
+ Requires-Dist: pydantic>=2.12.5
@@ -0,0 +1,7 @@
1
+ grctl/__init__.py,sha256=ovSyTyP0DJxBW_jC8CJrwYUs_BfXtMTnJqJ9qScZZyY,41
2
+ grctl/logging_config.py,sha256=OMoz3FRnxAwkE9BNDuFxFu8aRzURnXeU9-75xVXiomg,1457
3
+ grctl/settings.py,sha256=8O88vPcVzLHHv8JVxgNbwE3ErDqxjZf2_N4Tj35t7HM,601
4
+ grctl_sdk_python-0.2.0.dist-info/METADATA,sha256=yDdMGhXRwK4F1ZI1GumSLbYzEjJRhZPxJq9EFrprceI,368
5
+ grctl_sdk_python-0.2.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
6
+ grctl_sdk_python-0.2.0.dist-info/top_level.txt,sha256=6eubWDgt7_p4S4Ed4hL_AF4_Oe2RAt0twN_pf8mwlaQ,6
7
+ grctl_sdk_python-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ grctl