Coverage for src / augint_library / __init__.py: 56%

23 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-03-30 20:22 +0000

1"""A Python library built with enterprise-grade tooling. 

2 

3This library provides a solid foundation with comprehensive testing, 

4security scanning, and automated documentation. 

5""" 

6 

7from .core import fetch_data, print_hi 

8from .exceptions import ( 

9 AugintError, 

10 ConfigurationError, 

11 ErrorCode, 

12 MultiError, 

13 NetworkError, 

14 NetworkTimeoutError, 

15 RateLimitError, 

16 ResourceAlreadyExistsError, 

17 ResourceError, 

18 ResourceNotFoundError, 

19 ValidationError, 

20 collect_errors, 

21 error_context, 

22 handle_exceptions, 

23) 

24from .feature_flags import FeatureFlags, feature_flag, get_flags 

25from .logging import setup_logging 

26from .protocols import ( 

27 AdvancedProcessor, 

28 CacheProvider, 

29 ConfigurableClient, 

30 DataProcessor, 

31 EventHandler, 

32 ProcessingResult, 

33) 

34from .resilience import ( 

35 CircuitBreakerConfig, 

36 CircuitOpenError, 

37 CircuitState, 

38 RetryConfig, 

39 circuit_breaker, 

40 get_circuit_breakers, 

41 reset_circuit_breaker, 

42 retry, 

43) 

44 

45# Telemetry imports (optional - requires telemetry group dependencies) 

46try: 

47 from .telemetry import TelemetryClient, get_telemetry_client, track_command_execution 

48 

49 TELEMETRY_AVAILABLE = True 

50except ImportError: 

51 # Telemetry module requires optional dependencies 

52 TELEMETRY_AVAILABLE = False 

53 

54 # Create dummy implementations when telemetry is not available 

55 from typing import Any, Callable 

56 

57 class TelemetryClient: # type: ignore[no-redef] 

58 """Dummy TelemetryClient when telemetry dependencies are not installed.""" 

59 

60 def __init__(self) -> None: 

61 raise ImportError( 

62 "Telemetry requires optional dependencies. Install with: uv sync --group telemetry" 

63 ) 

64 

65 def get_telemetry_client() -> "TelemetryClient": 

66 """Dummy function when telemetry dependencies are not installed.""" 

67 raise ImportError( 

68 "Telemetry requires optional dependencies. Install with: uv sync --group telemetry" 

69 ) 

70 

71 def track_command_execution(func: Callable[..., Any]) -> Callable[..., Any]: 

72 """Dummy decorator when telemetry dependencies are not installed.""" 

73 return func 

74 

75 

76__version__ = "1.25.0" 

77 

78__all__ = [ 

79 # Protocols 

80 "AdvancedProcessor", 

81 # Exceptions 

82 "AugintError", 

83 "CacheProvider", 

84 "CircuitBreakerConfig", 

85 "CircuitOpenError", 

86 "CircuitState", 

87 "ConfigurableClient", 

88 "ConfigurationError", 

89 "DataProcessor", 

90 "ErrorCode", 

91 "EventHandler", 

92 # Feature Flags 

93 "FeatureFlags", 

94 "MultiError", 

95 "NetworkError", 

96 "NetworkTimeoutError", 

97 "ProcessingResult", 

98 "RateLimitError", 

99 "ResourceAlreadyExistsError", 

100 "ResourceError", 

101 "ResourceNotFoundError", 

102 "RetryConfig", 

103 "ValidationError", 

104 # Utilities and metadata 

105 "__version__", 

106 # Resilience patterns 

107 "circuit_breaker", 

108 "collect_errors", 

109 "error_context", 

110 # Feature flags 

111 "feature_flag", 

112 # Core functions 

113 "fetch_data", 

114 "get_circuit_breakers", 

115 # Feature flags 

116 "get_flags", 

117 "handle_exceptions", 

118 "print_hi", 

119 "reset_circuit_breaker", 

120 "retry", 

121 "setup_logging", 

122] 

123 

124# Add telemetry exports only if available 

125if TELEMETRY_AVAILABLE: 125 ↛ exitline 125 didn't exit the module because the condition on line 125 was always true

126 __all__.extend( 

127 [ 

128 "TelemetryClient", 

129 "get_telemetry_client", 

130 "track_command_execution", 

131 ] 

132 )