exonware-xwlazy 0.1.0.19__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 +6 -2
- exonware/xwlazy/__init__.py +0 -1
- exonware/xwlazy/common/__init__.py +1 -1
- exonware/xwlazy/common/base.py +1 -3
- exonware/xwlazy/common/cache.py +1 -3
- exonware/xwlazy/common/logger.py +1 -12
- exonware/xwlazy/common/services/dependency_mapper.py +0 -2
- exonware/xwlazy/common/services/install_async_utils.py +1 -5
- exonware/xwlazy/common/services/install_cache_utils.py +1 -13
- exonware/xwlazy/common/services/keyword_detection.py +0 -9
- exonware/xwlazy/common/services/spec_cache.py +1 -9
- exonware/xwlazy/common/services/state_manager.py +0 -2
- exonware/xwlazy/common/strategies/__init__.py +1 -1
- exonware/xwlazy/common/strategies/caching_dict.py +1 -2
- exonware/xwlazy/common/strategies/caching_installation.py +1 -2
- exonware/xwlazy/common/strategies/caching_lfu.py +1 -2
- exonware/xwlazy/common/strategies/caching_lru.py +1 -2
- exonware/xwlazy/common/strategies/caching_multitier.py +1 -2
- exonware/xwlazy/common/strategies/caching_ttl.py +1 -2
- exonware/xwlazy/config.py +1 -3
- exonware/xwlazy/contracts.py +1 -15
- exonware/xwlazy/defs.py +0 -19
- exonware/xwlazy/errors.py +1 -9
- exonware/xwlazy/facade.py +1 -59
- exonware/xwlazy/module/base.py +1 -5
- exonware/xwlazy/module/data.py +1 -1
- exonware/xwlazy/module/facade.py +0 -1
- exonware/xwlazy/module/importer_engine.py +1 -45
- exonware/xwlazy/module/strategies/__init__.py +1 -1
- exonware/xwlazy/module/strategies/module_helper_lazy.py +1 -2
- exonware/xwlazy/module/strategies/module_helper_simple.py +1 -2
- exonware/xwlazy/module/strategies/module_manager_advanced.py +1 -2
- exonware/xwlazy/module/strategies/module_manager_simple.py +1 -2
- exonware/xwlazy/package/base.py +1 -10
- exonware/xwlazy/package/conf.py +1 -8
- exonware/xwlazy/package/data.py +1 -1
- exonware/xwlazy/package/facade.py +0 -1
- exonware/xwlazy/package/services/async_install_handle.py +1 -3
- exonware/xwlazy/package/services/config_manager.py +0 -1
- exonware/xwlazy/package/services/discovery.py +1 -5
- exonware/xwlazy/package/services/host_packages.py +0 -4
- exonware/xwlazy/package/services/install_async.py +1 -2
- exonware/xwlazy/package/services/install_cache.py +1 -2
- exonware/xwlazy/package/services/install_interactive.py +1 -2
- exonware/xwlazy/package/services/install_policy.py +1 -3
- exonware/xwlazy/package/services/install_registry.py +1 -3
- exonware/xwlazy/package/services/install_result.py +1 -1
- exonware/xwlazy/package/services/install_sbom.py +1 -2
- exonware/xwlazy/package/services/install_utils.py +1 -5
- exonware/xwlazy/package/services/installer_engine.py +1 -3
- exonware/xwlazy/package/services/lazy_installer.py +1 -3
- exonware/xwlazy/package/services/manifest.py +0 -10
- exonware/xwlazy/package/services/strategy_registry.py +1 -3
- exonware/xwlazy/package/strategies/package_discovery_file.py +1 -2
- exonware/xwlazy/package/strategies/package_discovery_hybrid.py +1 -2
- exonware/xwlazy/package/strategies/package_discovery_manifest.py +1 -2
- exonware/xwlazy/package/strategies/package_execution_async.py +1 -2
- exonware/xwlazy/package/strategies/package_execution_cached.py +1 -2
- exonware/xwlazy/package/strategies/package_execution_pip.py +1 -2
- exonware/xwlazy/package/strategies/package_execution_wheel.py +1 -2
- exonware/xwlazy/package/strategies/package_mapping_discovery_first.py +1 -2
- exonware/xwlazy/package/strategies/package_mapping_hybrid.py +1 -2
- exonware/xwlazy/package/strategies/package_mapping_manifest_first.py +1 -2
- exonware/xwlazy/package/strategies/package_policy_allow_list.py +1 -2
- exonware/xwlazy/package/strategies/package_policy_deny_list.py +1 -2
- exonware/xwlazy/package/strategies/package_policy_permissive.py +1 -2
- exonware/xwlazy/package/strategies/package_timing_clean.py +1 -2
- exonware/xwlazy/package/strategies/package_timing_full.py +1 -2
- exonware/xwlazy/package/strategies/package_timing_smart.py +1 -2
- exonware/xwlazy/package/strategies/package_timing_temporary.py +1 -2
- exonware/xwlazy/runtime/adaptive_learner.py +1 -3
- exonware/xwlazy/runtime/base.py +1 -3
- exonware/xwlazy/runtime/facade.py +0 -1
- exonware/xwlazy/runtime/intelligent_selector.py +1 -4
- exonware/xwlazy/runtime/metrics.py +0 -4
- exonware/xwlazy/runtime/performance.py +0 -2
- exonware/xwlazy/version.py +2 -2
- {exonware_xwlazy-0.1.0.19.dist-info → exonware_xwlazy-0.1.0.20.dist-info}/METADATA +4 -2
- exonware_xwlazy-0.1.0.20.dist-info/RECORD +87 -0
- exonware_xwlazy-0.1.0.19.dist-info/RECORD +0 -87
- {exonware_xwlazy-0.1.0.19.dist-info → exonware_xwlazy-0.1.0.20.dist-info}/WHEEL +0 -0
- {exonware_xwlazy-0.1.0.19.dist-info → exonware_xwlazy-0.1.0.20.dist-info}/licenses/LICENSE +0 -0
exonware/xwlazy/facade.py
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Company: eXonware.com
|
|
5
5
|
Author: Eng. Muhammad AlShehri
|
|
6
6
|
Email: connect@exonware.com
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
Generation Date: 10-Oct-2025
|
|
9
9
|
|
|
10
10
|
Facade for Lazy Loading System
|
|
@@ -120,7 +120,6 @@ class LazyModeFacade:
|
|
|
120
120
|
"configs": self._configs.copy(),
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
|
|
124
123
|
# Global facade instance
|
|
125
124
|
_lazy_facade = LazyModeFacade()
|
|
126
125
|
|
|
@@ -132,41 +131,34 @@ def enable_lazy_mode(strategy: str = "on_demand", **kwargs) -> None:
|
|
|
132
131
|
"""Enable lazy mode with specified strategy."""
|
|
133
132
|
_lazy_facade.enable(strategy, **kwargs)
|
|
134
133
|
|
|
135
|
-
|
|
136
134
|
def disable_lazy_mode() -> None:
|
|
137
135
|
"""Disable lazy mode and cleanup resources."""
|
|
138
136
|
_lazy_facade.disable()
|
|
139
137
|
|
|
140
|
-
|
|
141
138
|
def is_lazy_mode_enabled() -> bool:
|
|
142
139
|
"""Check if lazy mode is currently enabled."""
|
|
143
140
|
return _lazy_facade.is_enabled()
|
|
144
141
|
|
|
145
|
-
|
|
146
142
|
def get_lazy_mode_stats() -> Dict[str, Any]:
|
|
147
143
|
"""Get lazy mode performance statistics."""
|
|
148
144
|
return _lazy_facade.get_stats()
|
|
149
145
|
|
|
150
|
-
|
|
151
146
|
def configure_lazy_mode(package_name: str, config: LazyModeConfig) -> None:
|
|
152
147
|
"""Configure lazy mode for a specific package."""
|
|
153
148
|
LazyInstallConfig.set_mode_config(package_name, config)
|
|
154
149
|
logger.info(f"Configured lazy mode for {package_name}")
|
|
155
150
|
|
|
156
|
-
|
|
157
151
|
def preload_modules(package_name: str, modules: List[str]) -> None:
|
|
158
152
|
"""Preload specified modules for a package."""
|
|
159
153
|
for module_name in modules:
|
|
160
154
|
_lazy_importer.preload_module(module_name)
|
|
161
155
|
logger.info(f"Preloaded {len(modules)} modules for {package_name}")
|
|
162
156
|
|
|
163
|
-
|
|
164
157
|
def optimize_lazy_mode(package_name: str) -> None:
|
|
165
158
|
"""Optimize lazy mode configuration for a package."""
|
|
166
159
|
_lazy_module_registry.preload_frequently_used()
|
|
167
160
|
logger.info(f"Optimization completed for {package_name}")
|
|
168
161
|
|
|
169
|
-
|
|
170
162
|
# =============================================================================
|
|
171
163
|
# PUBLIC API FUNCTIONS - Installation
|
|
172
164
|
# =============================================================================
|
|
@@ -175,27 +167,22 @@ def enable_lazy_install(package_name: str) -> None:
|
|
|
175
167
|
"""Enable lazy installation for a package."""
|
|
176
168
|
LazyInstallConfig.set(package_name, True)
|
|
177
169
|
|
|
178
|
-
|
|
179
170
|
def disable_lazy_install(package_name: str) -> None:
|
|
180
171
|
"""Disable lazy installation for a package."""
|
|
181
172
|
LazyInstallConfig.set(package_name, False)
|
|
182
173
|
|
|
183
|
-
|
|
184
174
|
def is_lazy_install_enabled(package_name: str) -> bool:
|
|
185
175
|
"""Check if lazy installation is enabled for a package."""
|
|
186
176
|
return LazyInstallConfig.is_enabled(package_name)
|
|
187
177
|
|
|
188
|
-
|
|
189
178
|
def set_lazy_install_mode(package_name: str, mode: LazyInstallMode) -> None:
|
|
190
179
|
"""Set lazy installation mode for a package."""
|
|
191
180
|
LazyInstallConfig.set_install_mode(package_name, mode)
|
|
192
181
|
|
|
193
|
-
|
|
194
182
|
def get_lazy_install_mode(package_name: str) -> LazyInstallMode:
|
|
195
183
|
"""Get lazy installation mode for a package."""
|
|
196
184
|
return LazyInstallConfig.get_install_mode(package_name)
|
|
197
185
|
|
|
198
|
-
|
|
199
186
|
def install_missing_package(package_name: str, module_name: str, installer_package: str = 'default') -> bool:
|
|
200
187
|
"""Install a missing package for a module."""
|
|
201
188
|
try:
|
|
@@ -208,7 +195,6 @@ def install_missing_package(package_name: str, module_name: str, installer_packa
|
|
|
208
195
|
logger.error(f"Failed to install package {package_name} for {installer_package}: {e}")
|
|
209
196
|
return False
|
|
210
197
|
|
|
211
|
-
|
|
212
198
|
def install_and_import(module_name: str, package_name: str = None, installer_package: str = 'default') -> Tuple[Optional[ModuleType], bool]:
|
|
213
199
|
"""Install package and import module."""
|
|
214
200
|
try:
|
|
@@ -221,7 +207,6 @@ def install_and_import(module_name: str, package_name: str = None, installer_pac
|
|
|
221
207
|
logger.error(f"Failed to install and import {module_name} for {installer_package}: {e}")
|
|
222
208
|
return None, False
|
|
223
209
|
|
|
224
|
-
|
|
225
210
|
def get_lazy_install_stats(package_name: str) -> Dict[str, Any]:
|
|
226
211
|
"""Get installation statistics for a package."""
|
|
227
212
|
try:
|
|
@@ -239,7 +224,6 @@ def get_lazy_install_stats(package_name: str) -> Dict[str, Any]:
|
|
|
239
224
|
'total_failed': 0,
|
|
240
225
|
}
|
|
241
226
|
|
|
242
|
-
|
|
243
227
|
def get_all_lazy_install_stats() -> Dict[str, Dict[str, Any]]:
|
|
244
228
|
"""Get installation statistics for all packages."""
|
|
245
229
|
try:
|
|
@@ -249,7 +233,6 @@ def get_all_lazy_install_stats() -> Dict[str, Dict[str, Any]]:
|
|
|
249
233
|
logger.error(f"Failed to get all stats: {e}")
|
|
250
234
|
return {}
|
|
251
235
|
|
|
252
|
-
|
|
253
236
|
def lazy_import_with_install(module_name: str, package_name: str = None, installer_package: str = 'default') -> Tuple[Optional[ModuleType], bool]:
|
|
254
237
|
"""Lazy import with automatic installation."""
|
|
255
238
|
try:
|
|
@@ -262,7 +245,6 @@ def lazy_import_with_install(module_name: str, package_name: str = None, install
|
|
|
262
245
|
logger.error(f"Failed to lazy import with install {module_name} for {installer_package}: {e}")
|
|
263
246
|
return None, False
|
|
264
247
|
|
|
265
|
-
|
|
266
248
|
def xwimport(module_name: str, package_name: str = None, installer_package: str = 'default') -> Any:
|
|
267
249
|
"""Simple lazy import with automatic installation."""
|
|
268
250
|
module, available = lazy_import_with_install(module_name, package_name, installer_package)
|
|
@@ -270,7 +252,6 @@ def xwimport(module_name: str, package_name: str = None, installer_package: str
|
|
|
270
252
|
raise ImportError(f"Module {module_name} is not available and could not be installed")
|
|
271
253
|
return module
|
|
272
254
|
|
|
273
|
-
|
|
274
255
|
# =============================================================================
|
|
275
256
|
# HOOK FUNCTIONS
|
|
276
257
|
# =============================================================================
|
|
@@ -284,7 +265,6 @@ def install_import_hook(package_name: str = 'default') -> None:
|
|
|
284
265
|
logger.error(f"Failed to install import hook for {package_name}: {e}")
|
|
285
266
|
raise
|
|
286
267
|
|
|
287
|
-
|
|
288
268
|
def uninstall_import_hook(package_name: str = 'default') -> None:
|
|
289
269
|
"""Uninstall import hook for a package."""
|
|
290
270
|
try:
|
|
@@ -294,7 +274,6 @@ def uninstall_import_hook(package_name: str = 'default') -> None:
|
|
|
294
274
|
logger.error(f"Failed to uninstall import hook for {package_name}: {e}")
|
|
295
275
|
raise
|
|
296
276
|
|
|
297
|
-
|
|
298
277
|
def is_import_hook_installed(package_name: str = 'default') -> bool:
|
|
299
278
|
"""Check if import hook is installed for a package."""
|
|
300
279
|
try:
|
|
@@ -302,7 +281,6 @@ def is_import_hook_installed(package_name: str = 'default') -> bool:
|
|
|
302
281
|
except Exception:
|
|
303
282
|
return False
|
|
304
283
|
|
|
305
|
-
|
|
306
284
|
# =============================================================================
|
|
307
285
|
# LAZY LOADING FUNCTIONS
|
|
308
286
|
# =============================================================================
|
|
@@ -334,7 +312,6 @@ def enable_lazy_imports(mode: LazyLoadMode = LazyLoadMode.AUTO, package_name: Op
|
|
|
334
312
|
logger.error(f"Failed to enable lazy imports: {e}")
|
|
335
313
|
raise
|
|
336
314
|
|
|
337
|
-
|
|
338
315
|
def disable_lazy_imports(package_name: Optional[str] = None) -> None:
|
|
339
316
|
"""
|
|
340
317
|
Disable lazy imports.
|
|
@@ -361,7 +338,6 @@ def disable_lazy_imports(package_name: Optional[str] = None) -> None:
|
|
|
361
338
|
logger.error(f"Failed to disable lazy imports: {e}")
|
|
362
339
|
raise
|
|
363
340
|
|
|
364
|
-
|
|
365
341
|
def is_lazy_import_enabled(package_name: Optional[str] = None) -> bool:
|
|
366
342
|
"""
|
|
367
343
|
Check if lazy imports are enabled.
|
|
@@ -385,7 +361,6 @@ def is_lazy_import_enabled(package_name: Optional[str] = None) -> bool:
|
|
|
385
361
|
logger.warning(f"Unexpected error checking lazy import status: {e}")
|
|
386
362
|
return False
|
|
387
363
|
|
|
388
|
-
|
|
389
364
|
def lazy_import(module_name: str, package_name: str = None) -> Optional[ModuleType]:
|
|
390
365
|
"""Lazy import a module."""
|
|
391
366
|
try:
|
|
@@ -394,7 +369,6 @@ def lazy_import(module_name: str, package_name: str = None) -> Optional[ModuleTy
|
|
|
394
369
|
logger.error(f"Failed to lazy import {module_name}: {e}")
|
|
395
370
|
return None
|
|
396
371
|
|
|
397
|
-
|
|
398
372
|
def register_lazy_module(module_name: str, package_name: str = None, module_path: str = None) -> None:
|
|
399
373
|
"""Register a lazy module loader."""
|
|
400
374
|
try:
|
|
@@ -408,7 +382,6 @@ def register_lazy_module(module_name: str, package_name: str = None, module_path
|
|
|
408
382
|
logger.error(f"Failed to register lazy module {module_name}: {e}")
|
|
409
383
|
raise
|
|
410
384
|
|
|
411
|
-
|
|
412
385
|
def preload_module(module_name: str, package_name: str = None) -> None:
|
|
413
386
|
"""Preload a lazy module."""
|
|
414
387
|
try:
|
|
@@ -421,7 +394,6 @@ def preload_module(module_name: str, package_name: str = None) -> None:
|
|
|
421
394
|
logger.error(f"Failed to preload module {module_name}: {e}")
|
|
422
395
|
raise
|
|
423
396
|
|
|
424
|
-
|
|
425
397
|
def get_lazy_module(module_name: str, package_name: str = None) -> Optional[ModuleType]:
|
|
426
398
|
"""Get a lazy module if loaded."""
|
|
427
399
|
# Check if module is already loaded in importer
|
|
@@ -446,7 +418,6 @@ def get_lazy_module(module_name: str, package_name: str = None) -> Optional[Modu
|
|
|
446
418
|
import sys
|
|
447
419
|
return sys.modules.get(module_name)
|
|
448
420
|
|
|
449
|
-
|
|
450
421
|
def get_loading_stats(package_name: str) -> Dict[str, Any]:
|
|
451
422
|
"""Get loading statistics for a package."""
|
|
452
423
|
try:
|
|
@@ -461,7 +432,6 @@ def get_loading_stats(package_name: str) -> Dict[str, Any]:
|
|
|
461
432
|
'load_times': {},
|
|
462
433
|
}
|
|
463
434
|
|
|
464
|
-
|
|
465
435
|
def preload_frequently_used(package_name: str) -> None:
|
|
466
436
|
"""Preload frequently used modules for a package."""
|
|
467
437
|
try:
|
|
@@ -470,7 +440,6 @@ def preload_frequently_used(package_name: str) -> None:
|
|
|
470
440
|
except Exception as e:
|
|
471
441
|
logger.error(f"Failed to preload frequently used for {package_name}: {e}")
|
|
472
442
|
|
|
473
|
-
|
|
474
443
|
def get_lazy_import_stats(package_name: str) -> Dict[str, Any]:
|
|
475
444
|
"""Get lazy import statistics for a package."""
|
|
476
445
|
try:
|
|
@@ -486,7 +455,6 @@ def get_lazy_import_stats(package_name: str) -> Dict[str, Any]:
|
|
|
486
455
|
'total_loaded': 0,
|
|
487
456
|
}
|
|
488
457
|
|
|
489
|
-
|
|
490
458
|
# =============================================================================
|
|
491
459
|
# CONFIGURATION FUNCTIONS
|
|
492
460
|
# =============================================================================
|
|
@@ -581,7 +549,6 @@ def config_package_lazy_install_enabled(
|
|
|
581
549
|
logger.error(f"Failed to configure lazy installation for {package_name}: {e}")
|
|
582
550
|
raise
|
|
583
551
|
|
|
584
|
-
|
|
585
552
|
def config_module_lazy_load_enabled(
|
|
586
553
|
package_name: str,
|
|
587
554
|
enabled: bool = True,
|
|
@@ -629,7 +596,6 @@ def config_module_lazy_load_enabled(
|
|
|
629
596
|
logger.error(f"Failed to configure lazy loading for {package_name}: {e}")
|
|
630
597
|
raise
|
|
631
598
|
|
|
632
|
-
|
|
633
599
|
def sync_manifest_configuration(package_name: str) -> None:
|
|
634
600
|
"""
|
|
635
601
|
Sync configuration from manifest for a specific package.
|
|
@@ -665,7 +631,6 @@ def sync_manifest_configuration(package_name: str) -> None:
|
|
|
665
631
|
logger.error(f"Failed to sync manifest configuration for {package_name}: {e}")
|
|
666
632
|
raise
|
|
667
633
|
|
|
668
|
-
|
|
669
634
|
def refresh_lazy_manifests() -> None:
|
|
670
635
|
"""Refresh all lazy manifest caches."""
|
|
671
636
|
try:
|
|
@@ -675,7 +640,6 @@ def refresh_lazy_manifests() -> None:
|
|
|
675
640
|
logger.error(f"Failed to refresh lazy manifest caches: {e}")
|
|
676
641
|
raise
|
|
677
642
|
|
|
678
|
-
|
|
679
643
|
# =============================================================================
|
|
680
644
|
# SECURITY & POLICY FUNCTIONS
|
|
681
645
|
# =============================================================================
|
|
@@ -689,7 +653,6 @@ def set_package_allow_list(package_name: str, allowed_packages: List[str]) -> No
|
|
|
689
653
|
logger.error(f"Failed to set allow list for {package_name}: {e}")
|
|
690
654
|
raise
|
|
691
655
|
|
|
692
|
-
|
|
693
656
|
def set_package_deny_list(package_name: str, denied_packages: List[str]) -> None:
|
|
694
657
|
"""Set deny list for a package."""
|
|
695
658
|
try:
|
|
@@ -699,7 +662,6 @@ def set_package_deny_list(package_name: str, denied_packages: List[str]) -> None
|
|
|
699
662
|
logger.error(f"Failed to set deny list for {package_name}: {e}")
|
|
700
663
|
raise
|
|
701
664
|
|
|
702
|
-
|
|
703
665
|
def add_to_package_allow_list(package_name: str, allowed_package: str) -> None:
|
|
704
666
|
"""Add single package to allow list."""
|
|
705
667
|
try:
|
|
@@ -709,7 +671,6 @@ def add_to_package_allow_list(package_name: str, allowed_package: str) -> None:
|
|
|
709
671
|
logger.error(f"Failed to add {allowed_package} to allow list for {package_name}: {e}")
|
|
710
672
|
raise
|
|
711
673
|
|
|
712
|
-
|
|
713
674
|
def add_to_package_deny_list(package_name: str, denied_package: str) -> None:
|
|
714
675
|
"""Add single package to deny list."""
|
|
715
676
|
try:
|
|
@@ -719,7 +680,6 @@ def add_to_package_deny_list(package_name: str, denied_package: str) -> None:
|
|
|
719
680
|
logger.error(f"Failed to add {denied_package} to deny list for {package_name}: {e}")
|
|
720
681
|
raise
|
|
721
682
|
|
|
722
|
-
|
|
723
683
|
def set_package_index_url(package_name: str, index_url: str) -> None:
|
|
724
684
|
"""Set package index URL for a package."""
|
|
725
685
|
try:
|
|
@@ -729,7 +689,6 @@ def set_package_index_url(package_name: str, index_url: str) -> None:
|
|
|
729
689
|
logger.error(f"Failed to set index URL for {package_name}: {e}")
|
|
730
690
|
raise
|
|
731
691
|
|
|
732
|
-
|
|
733
692
|
def set_package_extra_index_urls(package_name: str, extra_index_urls: List[str]) -> None:
|
|
734
693
|
"""Set extra index URLs for a package."""
|
|
735
694
|
try:
|
|
@@ -739,7 +698,6 @@ def set_package_extra_index_urls(package_name: str, extra_index_urls: List[str])
|
|
|
739
698
|
logger.error(f"Failed to set extra index URLs for {package_name}: {e}")
|
|
740
699
|
raise
|
|
741
700
|
|
|
742
|
-
|
|
743
701
|
def add_package_trusted_host(package_name: str, host: str) -> None:
|
|
744
702
|
"""Add trusted host for a package."""
|
|
745
703
|
try:
|
|
@@ -749,7 +707,6 @@ def add_package_trusted_host(package_name: str, host: str) -> None:
|
|
|
749
707
|
logger.error(f"Failed to add trusted host {host} for {package_name}: {e}")
|
|
750
708
|
raise
|
|
751
709
|
|
|
752
|
-
|
|
753
710
|
def set_package_lockfile(package_name: str, lockfile_path: str) -> None:
|
|
754
711
|
"""Set lockfile path for a package."""
|
|
755
712
|
try:
|
|
@@ -759,7 +716,6 @@ def set_package_lockfile(package_name: str, lockfile_path: str) -> None:
|
|
|
759
716
|
logger.error(f"Failed to set lockfile path for {package_name}: {e}")
|
|
760
717
|
raise
|
|
761
718
|
|
|
762
|
-
|
|
763
719
|
def generate_package_sbom(package_name: str, output_path: Optional[str] = None) -> Dict[str, Any]:
|
|
764
720
|
"""Generate SBOM for a package."""
|
|
765
721
|
try:
|
|
@@ -779,7 +735,6 @@ def generate_package_sbom(package_name: str, output_path: Optional[str] = None)
|
|
|
779
735
|
"packages": []
|
|
780
736
|
}
|
|
781
737
|
|
|
782
|
-
|
|
783
738
|
def check_externally_managed_environment(package_name: str = 'default') -> bool:
|
|
784
739
|
"""Check if environment is externally managed."""
|
|
785
740
|
try:
|
|
@@ -788,7 +743,6 @@ def check_externally_managed_environment(package_name: str = 'default') -> bool:
|
|
|
788
743
|
logger.error(f"Failed to check externally managed environment: {e}")
|
|
789
744
|
return False
|
|
790
745
|
|
|
791
|
-
|
|
792
746
|
def register_lazy_module_prefix(prefix: str) -> None:
|
|
793
747
|
"""Register a module prefix mapping."""
|
|
794
748
|
try:
|
|
@@ -798,7 +752,6 @@ def register_lazy_module_prefix(prefix: str) -> None:
|
|
|
798
752
|
logger.error(f"Failed to register lazy module prefix {prefix}: {e}")
|
|
799
753
|
raise
|
|
800
754
|
|
|
801
|
-
|
|
802
755
|
def register_lazy_module_methods(prefix: str, methods: Tuple[str, ...]) -> None:
|
|
803
756
|
"""Register methods for a lazy module."""
|
|
804
757
|
try:
|
|
@@ -808,7 +761,6 @@ def register_lazy_module_methods(prefix: str, methods: Tuple[str, ...]) -> None:
|
|
|
808
761
|
logger.error(f"Failed to register lazy module methods for {prefix}: {e}")
|
|
809
762
|
raise
|
|
810
763
|
|
|
811
|
-
|
|
812
764
|
# =============================================================================
|
|
813
765
|
# MODULE REGISTRATION DOMAIN - Internal Utilities
|
|
814
766
|
# =============================================================================
|
|
@@ -816,7 +768,6 @@ def register_lazy_module_methods(prefix: str, methods: Tuple[str, ...]) -> None:
|
|
|
816
768
|
# Note: Internal utility functions are available from hooks.finder module
|
|
817
769
|
# They are used internally by the lazy loading system and don't need facade wrappers
|
|
818
770
|
|
|
819
|
-
|
|
820
771
|
# =============================================================================
|
|
821
772
|
# KEYWORD-BASED DETECTION FUNCTIONS
|
|
822
773
|
# =============================================================================
|
|
@@ -846,7 +797,6 @@ def enable_keyword_detection(enabled: bool = True, keyword: Optional[str] = None
|
|
|
846
797
|
logger.error(f"Failed to enable keyword detection: {e}")
|
|
847
798
|
raise
|
|
848
799
|
|
|
849
|
-
|
|
850
800
|
def is_keyword_detection_enabled(package_name: Optional[str] = None) -> bool:
|
|
851
801
|
"""
|
|
852
802
|
Check if keyword detection is enabled.
|
|
@@ -870,7 +820,6 @@ def is_keyword_detection_enabled(package_name: Optional[str] = None) -> bool:
|
|
|
870
820
|
logger.warning(f"Unexpected error checking keyword detection status: {e}")
|
|
871
821
|
return False
|
|
872
822
|
|
|
873
|
-
|
|
874
823
|
def get_keyword_detection_keyword(package_name: Optional[str] = None) -> Optional[str]:
|
|
875
824
|
"""
|
|
876
825
|
Get keyword used for detection.
|
|
@@ -890,7 +839,6 @@ def get_keyword_detection_keyword(package_name: Optional[str] = None) -> Optiona
|
|
|
890
839
|
logger.error(f"Failed to get keyword detection keyword: {e}")
|
|
891
840
|
return None
|
|
892
841
|
|
|
893
|
-
|
|
894
842
|
def check_package_keywords(package_name: Optional[str] = None, keywords: Optional[List[str]] = None) -> bool:
|
|
895
843
|
"""
|
|
896
844
|
Check if a package (or any package) has the specified keyword in its metadata.
|
|
@@ -912,7 +860,6 @@ def check_package_keywords(package_name: Optional[str] = None, keywords: Optiona
|
|
|
912
860
|
logger.error(f"Failed to check package keywords: {e}")
|
|
913
861
|
return False
|
|
914
862
|
|
|
915
|
-
|
|
916
863
|
# =============================================================================
|
|
917
864
|
# DISCOVERY FUNCTIONS
|
|
918
865
|
# =============================================================================
|
|
@@ -925,7 +872,6 @@ def get_lazy_discovery(package_name: str = 'default') -> Optional[APackageHelper
|
|
|
925
872
|
logger.error(f"Failed to get discovery instance for {package_name}: {e}")
|
|
926
873
|
return None
|
|
927
874
|
|
|
928
|
-
|
|
929
875
|
def discover_dependencies(package_name: str = 'default') -> Dict[str, str]:
|
|
930
876
|
"""Discover dependencies for a package."""
|
|
931
877
|
try:
|
|
@@ -936,7 +882,6 @@ def discover_dependencies(package_name: str = 'default') -> Dict[str, str]:
|
|
|
936
882
|
logger.error(f"Failed to discover dependencies for {package_name}: {e}")
|
|
937
883
|
return {}
|
|
938
884
|
|
|
939
|
-
|
|
940
885
|
def export_dependency_mappings(package_name: str = 'default', output_path: Optional[str] = None) -> None:
|
|
941
886
|
"""Export dependency mappings to file."""
|
|
942
887
|
try:
|
|
@@ -956,7 +901,6 @@ def export_dependency_mappings(package_name: str = 'default', output_path: Optio
|
|
|
956
901
|
logger.error(f"Failed to export dependency mappings for {package_name}: {e}")
|
|
957
902
|
raise
|
|
958
903
|
|
|
959
|
-
|
|
960
904
|
# =============================================================================
|
|
961
905
|
# PUBLIC API EXPORTS
|
|
962
906
|
# =============================================================================
|
|
@@ -1031,7 +975,6 @@ __all__ = [
|
|
|
1031
975
|
'XWModuleHelper',
|
|
1032
976
|
]
|
|
1033
977
|
|
|
1034
|
-
|
|
1035
978
|
# =============================================================================
|
|
1036
979
|
# CONCRETE HELPER IMPLEMENTATIONS (Simple API Pattern)
|
|
1037
980
|
# =============================================================================
|
|
@@ -1043,7 +986,6 @@ __all__ = [
|
|
|
1043
986
|
# This is now just an alias (defined above)
|
|
1044
987
|
# Removed duplicate class definition - use the one from module/facade.py
|
|
1045
988
|
|
|
1046
|
-
|
|
1047
989
|
# Global helper instances
|
|
1048
990
|
_package_helper = XWPackageHelper()
|
|
1049
991
|
_module_helper = XWModuleHelper()
|
exonware/xwlazy/module/base.py
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Company: eXonware.com
|
|
5
5
|
Author: Eng. Muhammad AlShehri
|
|
6
6
|
Email: connect@exonware.com
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
Generation Date: 10-Oct-2025
|
|
9
9
|
|
|
10
10
|
Abstract Base Class for Module Operations
|
|
@@ -25,7 +25,6 @@ from ..contracts import (
|
|
|
25
25
|
)
|
|
26
26
|
from ..package.base import APackageHelper
|
|
27
27
|
|
|
28
|
-
|
|
29
28
|
# =============================================================================
|
|
30
29
|
# ABSTRACT MODULE (Unified - Merges AImportHook + ALazyLoader + AModuleHelper)
|
|
31
30
|
# =============================================================================
|
|
@@ -490,7 +489,6 @@ class AModuleHelper(IModuleHelper, ABC):
|
|
|
490
489
|
"""Clear bytecode cache (from IBytecodeCache)."""
|
|
491
490
|
raise NotImplementedError("Subclasses must implement clear_bytecode_cache")
|
|
492
491
|
|
|
493
|
-
|
|
494
492
|
# =============================================================================
|
|
495
493
|
# ABSTRACT MODULE HELPER STRATEGY
|
|
496
494
|
# =============================================================================
|
|
@@ -518,7 +516,6 @@ class AModuleHelperStrategy(IModuleHelperStrategy, ABC):
|
|
|
518
516
|
"""Check if module is importable."""
|
|
519
517
|
...
|
|
520
518
|
|
|
521
|
-
|
|
522
519
|
# =============================================================================
|
|
523
520
|
# ABSTRACT MODULE MANAGER STRATEGY
|
|
524
521
|
# =============================================================================
|
|
@@ -556,7 +553,6 @@ class AModuleManagerStrategy(IModuleManagerStrategy, ABC):
|
|
|
556
553
|
"""Handle import error."""
|
|
557
554
|
...
|
|
558
555
|
|
|
559
|
-
|
|
560
556
|
# =============================================================================
|
|
561
557
|
# EXPORT ALL
|
|
562
558
|
# =============================================================================
|
exonware/xwlazy/module/data.py
CHANGED
exonware/xwlazy/module/facade.py
CHANGED
|
@@ -29,7 +29,6 @@ from ..common.strategies import LRUCache
|
|
|
29
29
|
from .strategies import LazyHelper, AdvancedManager
|
|
30
30
|
from ..package.services.strategy_registry import StrategyRegistry
|
|
31
31
|
|
|
32
|
-
|
|
33
32
|
class XWModuleHelper(AModuleHelper):
|
|
34
33
|
"""
|
|
35
34
|
Concrete implementation of AModuleHelper.
|