exonware-xwlazy 0.1.0.11__py3-none-any.whl → 0.1.0.20__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.
- exonware/__init__.py +26 -0
- exonware/xwlazy/__init__.py +0 -0
- exonware/xwlazy/common/__init__.py +47 -0
- exonware/xwlazy/common/base.py +56 -0
- exonware/xwlazy/common/cache.py +504 -0
- exonware/xwlazy/common/logger.py +257 -0
- exonware/xwlazy/common/services/__init__.py +72 -0
- exonware/xwlazy/common/services/dependency_mapper.py +232 -0
- exonware/xwlazy/common/services/install_async_utils.py +165 -0
- exonware/xwlazy/common/services/install_cache_utils.py +245 -0
- exonware/xwlazy/common/services/keyword_detection.py +283 -0
- exonware/xwlazy/common/services/spec_cache.py +165 -0
- xwlazy/lazy/lazy_state.py → exonware/xwlazy/common/services/state_manager.py +0 -2
- exonware/xwlazy/common/strategies/__init__.py +28 -0
- exonware/xwlazy/common/strategies/caching_dict.py +44 -0
- exonware/xwlazy/common/strategies/caching_installation.py +88 -0
- exonware/xwlazy/common/strategies/caching_lfu.py +66 -0
- exonware/xwlazy/common/strategies/caching_lru.py +63 -0
- exonware/xwlazy/common/strategies/caching_multitier.py +59 -0
- exonware/xwlazy/common/strategies/caching_ttl.py +59 -0
- {xwlazy/lazy → exonware/xwlazy}/config.py +51 -21
- exonware/xwlazy/contracts.py +1396 -0
- exonware/xwlazy/defs.py +378 -0
- xwlazy/lazy/lazy_errors.py → exonware/xwlazy/errors.py +21 -16
- exonware/xwlazy/facade.py +991 -0
- exonware/xwlazy/module/__init__.py +18 -0
- exonware/xwlazy/module/base.py +565 -0
- exonware/xwlazy/module/data.py +17 -0
- exonware/xwlazy/module/facade.py +246 -0
- exonware/xwlazy/module/importer_engine.py +2117 -0
- exonware/xwlazy/module/strategies/__init__.py +22 -0
- exonware/xwlazy/module/strategies/module_helper_lazy.py +93 -0
- exonware/xwlazy/module/strategies/module_helper_simple.py +65 -0
- exonware/xwlazy/module/strategies/module_manager_advanced.py +111 -0
- exonware/xwlazy/module/strategies/module_manager_simple.py +95 -0
- exonware/xwlazy/package/__init__.py +18 -0
- exonware/xwlazy/package/base.py +798 -0
- xwlazy/lazy/host_conf.py → exonware/xwlazy/package/conf.py +61 -16
- exonware/xwlazy/package/data.py +17 -0
- exonware/xwlazy/package/facade.py +480 -0
- exonware/xwlazy/package/services/__init__.py +84 -0
- exonware/xwlazy/package/services/async_install_handle.py +87 -0
- exonware/xwlazy/package/services/config_manager.py +245 -0
- exonware/xwlazy/package/services/discovery.py +370 -0
- {xwlazy/lazy → exonware/xwlazy/package/services}/host_packages.py +43 -20
- exonware/xwlazy/package/services/install_async.py +277 -0
- exonware/xwlazy/package/services/install_cache.py +145 -0
- exonware/xwlazy/package/services/install_interactive.py +59 -0
- exonware/xwlazy/package/services/install_policy.py +156 -0
- exonware/xwlazy/package/services/install_registry.py +54 -0
- exonware/xwlazy/package/services/install_result.py +17 -0
- exonware/xwlazy/package/services/install_sbom.py +153 -0
- exonware/xwlazy/package/services/install_utils.py +79 -0
- exonware/xwlazy/package/services/installer_engine.py +406 -0
- exonware/xwlazy/package/services/lazy_installer.py +718 -0
- {xwlazy/lazy → exonware/xwlazy/package/services}/manifest.py +40 -33
- exonware/xwlazy/package/services/strategy_registry.py +186 -0
- exonware/xwlazy/package/strategies/__init__.py +57 -0
- exonware/xwlazy/package/strategies/package_discovery_file.py +129 -0
- exonware/xwlazy/package/strategies/package_discovery_hybrid.py +84 -0
- exonware/xwlazy/package/strategies/package_discovery_manifest.py +101 -0
- exonware/xwlazy/package/strategies/package_execution_async.py +113 -0
- exonware/xwlazy/package/strategies/package_execution_cached.py +90 -0
- exonware/xwlazy/package/strategies/package_execution_pip.py +99 -0
- exonware/xwlazy/package/strategies/package_execution_wheel.py +106 -0
- exonware/xwlazy/package/strategies/package_mapping_discovery_first.py +100 -0
- exonware/xwlazy/package/strategies/package_mapping_hybrid.py +105 -0
- exonware/xwlazy/package/strategies/package_mapping_manifest_first.py +100 -0
- exonware/xwlazy/package/strategies/package_policy_allow_list.py +57 -0
- exonware/xwlazy/package/strategies/package_policy_deny_list.py +57 -0
- exonware/xwlazy/package/strategies/package_policy_permissive.py +46 -0
- exonware/xwlazy/package/strategies/package_timing_clean.py +67 -0
- exonware/xwlazy/package/strategies/package_timing_full.py +66 -0
- exonware/xwlazy/package/strategies/package_timing_smart.py +68 -0
- exonware/xwlazy/package/strategies/package_timing_temporary.py +66 -0
- exonware/xwlazy/runtime/__init__.py +18 -0
- exonware/xwlazy/runtime/adaptive_learner.py +129 -0
- exonware/xwlazy/runtime/base.py +274 -0
- exonware/xwlazy/runtime/facade.py +94 -0
- exonware/xwlazy/runtime/intelligent_selector.py +170 -0
- exonware/xwlazy/runtime/metrics.py +60 -0
- exonware/xwlazy/runtime/performance.py +37 -0
- exonware/xwlazy/version.py +2 -2
- {exonware_xwlazy-0.1.0.11.dist-info → exonware_xwlazy-0.1.0.20.dist-info}/METADATA +89 -11
- exonware_xwlazy-0.1.0.20.dist-info/RECORD +87 -0
- exonware_xwlazy-0.1.0.11.dist-info/RECORD +0 -20
- xwlazy/__init__.py +0 -34
- xwlazy/lazy/__init__.py +0 -301
- xwlazy/lazy/bootstrap.py +0 -106
- xwlazy/lazy/lazy_base.py +0 -465
- xwlazy/lazy/lazy_contracts.py +0 -290
- xwlazy/lazy/lazy_core.py +0 -3727
- xwlazy/lazy/logging_utils.py +0 -194
- xwlazy/version.py +0 -77
- {exonware_xwlazy-0.1.0.11.dist-info → exonware_xwlazy-0.1.0.20.dist-info}/WHEEL +0 -0
- {exonware_xwlazy-0.1.0.11.dist-info → exonware_xwlazy-0.1.0.20.dist-info}/licenses/LICENSE +0 -0
xwlazy/lazy/logging_utils.py
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
#exonware/xwlazy/src/exonware/xwlazy/lazy/logging_utils.py
|
|
2
|
-
"""
|
|
3
|
-
Lightweight logging helper for the xwlazy lazy subsystem.
|
|
4
|
-
|
|
5
|
-
Adds category-based filtering so noisy traces (hook/install/audit/etc.) can be
|
|
6
|
-
turned on or off individually via configuration or environment variables.
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
from __future__ import annotations
|
|
10
|
-
|
|
11
|
-
import logging
|
|
12
|
-
import os
|
|
13
|
-
import sys
|
|
14
|
-
from datetime import datetime
|
|
15
|
-
from typing import Dict, Optional
|
|
16
|
-
|
|
17
|
-
_configured = False
|
|
18
|
-
|
|
19
|
-
_CATEGORY_DEFAULTS: Dict[str, bool] = {
|
|
20
|
-
"install": True, # always show installs by default
|
|
21
|
-
"hook": False,
|
|
22
|
-
"enhance": False,
|
|
23
|
-
"audit": False,
|
|
24
|
-
"sbom": False,
|
|
25
|
-
"config": False,
|
|
26
|
-
"discovery": False,
|
|
27
|
-
}
|
|
28
|
-
_category_overrides: Dict[str, bool] = {}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def _normalize_category(name: str) -> str:
|
|
32
|
-
return name.strip().lower()
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def _load_env_overrides() -> None:
|
|
36
|
-
for category in _CATEGORY_DEFAULTS:
|
|
37
|
-
env_key = f"XWLAZY_LOG_{category.upper()}"
|
|
38
|
-
env_val = os.getenv(env_key)
|
|
39
|
-
if env_val is None:
|
|
40
|
-
continue
|
|
41
|
-
enabled = env_val.strip().lower() not in {"0", "false", "off", "no"}
|
|
42
|
-
_category_overrides[_normalize_category(category)] = enabled
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
class XWLazyFormatter(logging.Formatter):
|
|
46
|
-
"""Custom formatter for xwlazy that uses exonware.xwlazy [HH:MM:SS]: [FLAG] format."""
|
|
47
|
-
|
|
48
|
-
# Map logging levels to flags
|
|
49
|
-
LEVEL_FLAGS = {
|
|
50
|
-
logging.DEBUG: "DEBUG",
|
|
51
|
-
logging.INFO: "INFO",
|
|
52
|
-
logging.WARNING: "WARN",
|
|
53
|
-
logging.ERROR: "ERROR",
|
|
54
|
-
logging.CRITICAL: "CRITICAL",
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
# Map flags to emojis
|
|
58
|
-
EMOJI_MAP = {
|
|
59
|
-
"WARN": "⚠️",
|
|
60
|
-
"INFO": "ℹ️",
|
|
61
|
-
"ACTION": "⚙️",
|
|
62
|
-
"SUCCESS": "✅",
|
|
63
|
-
"ERROR": "❌",
|
|
64
|
-
"FAIL": "⛔",
|
|
65
|
-
"DEBUG": "🔍",
|
|
66
|
-
"CRITICAL": "🚨",
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
def format(self, record: logging.LogRecord) -> str:
|
|
70
|
-
"""Format log record with custom format."""
|
|
71
|
-
# Get flag from level or use INFO as default
|
|
72
|
-
flag = self.LEVEL_FLAGS.get(record.levelno, "INFO")
|
|
73
|
-
|
|
74
|
-
# Get emoji for flag
|
|
75
|
-
emoji = self.EMOJI_MAP.get(flag, "ℹ️")
|
|
76
|
-
|
|
77
|
-
# Format time as HH:MM:SS
|
|
78
|
-
time_str = datetime.now().strftime("%H:%M:%S")
|
|
79
|
-
|
|
80
|
-
# Format message
|
|
81
|
-
message = record.getMessage()
|
|
82
|
-
|
|
83
|
-
# Return formatted: emoji exonware.xwlazy [HH:MM:SS]: [FLAG] message
|
|
84
|
-
return f"{emoji} exonware.xwlazy [{time_str}]: [{flag}] {message}"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def _ensure_basic_config() -> None:
|
|
88
|
-
global _configured
|
|
89
|
-
if _configured:
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
# Configure root logger with custom formatter
|
|
93
|
-
root_logger = logging.getLogger()
|
|
94
|
-
root_logger.setLevel(logging.INFO)
|
|
95
|
-
|
|
96
|
-
# Remove existing handlers to avoid duplicates
|
|
97
|
-
for handler in root_logger.handlers[:]:
|
|
98
|
-
root_logger.removeHandler(handler)
|
|
99
|
-
|
|
100
|
-
# Create console handler with custom formatter
|
|
101
|
-
console_handler = logging.StreamHandler(sys.stdout)
|
|
102
|
-
console_handler.setLevel(logging.INFO)
|
|
103
|
-
console_handler.setFormatter(XWLazyFormatter())
|
|
104
|
-
root_logger.addHandler(console_handler)
|
|
105
|
-
|
|
106
|
-
_load_env_overrides()
|
|
107
|
-
_configured = True
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
def get_logger(name: Optional[str] = None) -> logging.Logger:
|
|
111
|
-
"""Return a logger configured for the lazy subsystem."""
|
|
112
|
-
_ensure_basic_config()
|
|
113
|
-
return logging.getLogger(name or "xwlazy.lazy")
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def is_log_category_enabled(category: str) -> bool:
|
|
117
|
-
"""Return True if the provided log category is enabled."""
|
|
118
|
-
_ensure_basic_config()
|
|
119
|
-
normalized = _normalize_category(category)
|
|
120
|
-
if normalized in _category_overrides:
|
|
121
|
-
return _category_overrides[normalized]
|
|
122
|
-
return _CATEGORY_DEFAULTS.get(normalized, True)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
def set_log_category(category: str, enabled: bool) -> None:
|
|
126
|
-
"""Enable/disable an individual log category at runtime."""
|
|
127
|
-
_category_overrides[_normalize_category(category)] = bool(enabled)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
def set_log_categories(overrides: Dict[str, bool]) -> None:
|
|
131
|
-
"""Bulk update multiple categories."""
|
|
132
|
-
for category, enabled in overrides.items():
|
|
133
|
-
set_log_category(category, enabled)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
def get_log_categories() -> Dict[str, bool]:
|
|
137
|
-
"""Return the effective state for each built-in log category."""
|
|
138
|
-
_ensure_basic_config()
|
|
139
|
-
result = {}
|
|
140
|
-
for category, default_enabled in _CATEGORY_DEFAULTS.items():
|
|
141
|
-
normalized = _normalize_category(category)
|
|
142
|
-
result[category] = _category_overrides.get(normalized, default_enabled)
|
|
143
|
-
return result
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
def log_event(category: str, level_fn, msg: str, *args, **kwargs) -> None:
|
|
147
|
-
"""Emit a log for the given category if it is enabled."""
|
|
148
|
-
if is_log_category_enabled(category):
|
|
149
|
-
level_fn(msg, *args, **kwargs)
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
def format_message(flag: str, message: str) -> str:
|
|
153
|
-
"""
|
|
154
|
-
Format a message with exonware.xwlazy [HH:MM:SS]: [FLAG] format.
|
|
155
|
-
|
|
156
|
-
Args:
|
|
157
|
-
flag: Message flag (WARN, ACTION, SUCCESS, etc.)
|
|
158
|
-
message: Message content
|
|
159
|
-
|
|
160
|
-
Returns:
|
|
161
|
-
Formatted message string
|
|
162
|
-
"""
|
|
163
|
-
# Map flags to emojis
|
|
164
|
-
emoji_map = {
|
|
165
|
-
"WARN": "⚠️",
|
|
166
|
-
"INFO": "ℹ️",
|
|
167
|
-
"ACTION": "⚙️",
|
|
168
|
-
"SUCCESS": "✅",
|
|
169
|
-
"ERROR": "❌",
|
|
170
|
-
"FAIL": "⛔",
|
|
171
|
-
"DEBUG": "🔍",
|
|
172
|
-
"CRITICAL": "🚨",
|
|
173
|
-
}
|
|
174
|
-
emoji = emoji_map.get(flag, "ℹ️")
|
|
175
|
-
time_str = datetime.now().strftime("%H:%M:%S")
|
|
176
|
-
return f"{emoji} exonware.xwlazy [{time_str}]: [{flag}] {message}"
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
def print_formatted(flag: str, message: str, same_line: bool = False) -> None:
|
|
180
|
-
"""
|
|
181
|
-
Print a formatted message with optional same-line support.
|
|
182
|
-
|
|
183
|
-
Args:
|
|
184
|
-
flag: Message flag (WARN, ACTION, SUCCESS, etc.)
|
|
185
|
-
message: Message content
|
|
186
|
-
same_line: If True, use \r to overwrite previous line
|
|
187
|
-
"""
|
|
188
|
-
formatted = format_message(flag, message)
|
|
189
|
-
if same_line:
|
|
190
|
-
sys.stdout.write(f"\r{formatted}")
|
|
191
|
-
sys.stdout.flush()
|
|
192
|
-
else:
|
|
193
|
-
print(formatted)
|
|
194
|
-
|
xwlazy/version.py
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Centralized version management for eXonware projects.
|
|
3
|
-
|
|
4
|
-
Company: eXonware.com
|
|
5
|
-
Author: Eng. Muhammad AlShehri
|
|
6
|
-
Email: connect@exonware.com
|
|
7
|
-
|
|
8
|
-
This module provides centralized version management for the entire project.
|
|
9
|
-
All version references should import from this module to ensure consistency.
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
# =============================================================================
|
|
13
|
-
# VERSION CONFIGURATION
|
|
14
|
-
# =============================================================================
|
|
15
|
-
|
|
16
|
-
# Main version - update this to change version across entire project
|
|
17
|
-
__version__ = "0.1.0.11"
|
|
18
|
-
|
|
19
|
-
# Version components for programmatic access
|
|
20
|
-
VERSION_MAJOR = 0
|
|
21
|
-
VERSION_MINOR = 1
|
|
22
|
-
VERSION_PATCH = 0
|
|
23
|
-
VERSION_BUILD = 11 # Set to None for releases, or build number for dev builds
|
|
24
|
-
|
|
25
|
-
# Version metadata
|
|
26
|
-
VERSION_SUFFIX = "" # e.g., "dev", "alpha", "beta", "rc1"
|
|
27
|
-
VERSION_STRING = __version__ + VERSION_SUFFIX
|
|
28
|
-
|
|
29
|
-
# =============================================================================
|
|
30
|
-
# VERSION UTILITIES
|
|
31
|
-
# =============================================================================
|
|
32
|
-
|
|
33
|
-
def get_version() -> str:
|
|
34
|
-
"""Get the current version string."""
|
|
35
|
-
return VERSION_STRING
|
|
36
|
-
|
|
37
|
-
def get_version_info() -> tuple:
|
|
38
|
-
"""Get version as a tuple (major, minor, patch, build)."""
|
|
39
|
-
return (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, VERSION_BUILD)
|
|
40
|
-
|
|
41
|
-
def get_version_dict() -> dict:
|
|
42
|
-
"""Get version information as a dictionary."""
|
|
43
|
-
return {
|
|
44
|
-
"version": VERSION_STRING,
|
|
45
|
-
"major": VERSION_MAJOR,
|
|
46
|
-
"minor": VERSION_MINOR,
|
|
47
|
-
"patch": VERSION_PATCH,
|
|
48
|
-
"build": VERSION_BUILD,
|
|
49
|
-
"suffix": VERSION_SUFFIX
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
def is_dev_version() -> bool:
|
|
53
|
-
"""Check if this is a development version."""
|
|
54
|
-
return VERSION_SUFFIX in ("dev", "alpha", "beta") or VERSION_BUILD is not None
|
|
55
|
-
|
|
56
|
-
def is_release_version() -> bool:
|
|
57
|
-
"""Check if this is a release version."""
|
|
58
|
-
return not is_dev_version()
|
|
59
|
-
|
|
60
|
-
# =============================================================================
|
|
61
|
-
# EXPORTS
|
|
62
|
-
# =============================================================================
|
|
63
|
-
|
|
64
|
-
__all__ = [
|
|
65
|
-
"__version__",
|
|
66
|
-
"VERSION_MAJOR",
|
|
67
|
-
"VERSION_MINOR",
|
|
68
|
-
"VERSION_PATCH",
|
|
69
|
-
"VERSION_BUILD",
|
|
70
|
-
"VERSION_SUFFIX",
|
|
71
|
-
"VERSION_STRING",
|
|
72
|
-
"get_version",
|
|
73
|
-
"get_version_info",
|
|
74
|
-
"get_version_dict",
|
|
75
|
-
"is_dev_version",
|
|
76
|
-
"is_release_version"
|
|
77
|
-
]
|
|
File without changes
|
|
File without changes
|