exonware-xwlazy 0.1.0.11__tar.gz → 0.1.0.19__tar.gz

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.
Files changed (99) hide show
  1. {exonware_xwlazy-0.1.0.11 → exonware_xwlazy-0.1.0.19}/PKG-INFO +86 -10
  2. {exonware_xwlazy-0.1.0.11 → exonware_xwlazy-0.1.0.19}/README.md +85 -9
  3. {exonware_xwlazy-0.1.0.11 → exonware_xwlazy-0.1.0.19}/pyproject.toml +1 -1
  4. exonware_xwlazy-0.1.0.19/src/exonware/__init__.py +22 -0
  5. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/__init__.py +368 -0
  6. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/__init__.py +47 -0
  7. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/base.py +58 -0
  8. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/cache.py +506 -0
  9. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/logger.py +268 -0
  10. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/services/__init__.py +72 -0
  11. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/services/dependency_mapper.py +234 -0
  12. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/services/install_async_utils.py +169 -0
  13. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/services/install_cache_utils.py +257 -0
  14. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/services/keyword_detection.py +292 -0
  15. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/services/spec_cache.py +173 -0
  16. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/strategies/__init__.py +28 -0
  17. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/strategies/caching_dict.py +45 -0
  18. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/strategies/caching_installation.py +89 -0
  19. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/strategies/caching_lfu.py +67 -0
  20. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/strategies/caching_lru.py +64 -0
  21. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/strategies/caching_multitier.py +60 -0
  22. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/strategies/caching_ttl.py +60 -0
  23. {exonware_xwlazy-0.1.0.11/src/xwlazy/lazy → exonware_xwlazy-0.1.0.19/src/exonware/xwlazy}/config.py +52 -20
  24. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/contracts.py +1410 -0
  25. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/defs.py +397 -0
  26. exonware_xwlazy-0.1.0.11/src/xwlazy/lazy/lazy_errors.py → exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/errors.py +21 -8
  27. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/facade.py +1049 -0
  28. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/module/__init__.py +18 -0
  29. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/module/base.py +569 -0
  30. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/module/data.py +17 -0
  31. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/module/facade.py +247 -0
  32. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/module/importer_engine.py +2161 -0
  33. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/module/strategies/__init__.py +22 -0
  34. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/module/strategies/module_helper_lazy.py +94 -0
  35. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/module/strategies/module_helper_simple.py +66 -0
  36. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/module/strategies/module_manager_advanced.py +112 -0
  37. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/module/strategies/module_manager_simple.py +96 -0
  38. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/__init__.py +18 -0
  39. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/base.py +807 -0
  40. exonware_xwlazy-0.1.0.11/src/xwlazy/lazy/host_conf.py → exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/conf.py +62 -10
  41. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/data.py +17 -0
  42. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/facade.py +481 -0
  43. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/__init__.py +84 -0
  44. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/async_install_handle.py +89 -0
  45. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/config_manager.py +246 -0
  46. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/discovery.py +374 -0
  47. {exonware_xwlazy-0.1.0.11/src/xwlazy/lazy → exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services}/host_packages.py +43 -16
  48. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/install_async.py +278 -0
  49. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/install_cache.py +146 -0
  50. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/install_interactive.py +60 -0
  51. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/install_policy.py +158 -0
  52. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/install_registry.py +56 -0
  53. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/install_result.py +17 -0
  54. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/install_sbom.py +154 -0
  55. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/install_utils.py +83 -0
  56. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/installer_engine.py +408 -0
  57. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/lazy_installer.py +720 -0
  58. {exonware_xwlazy-0.1.0.11/src/xwlazy/lazy → exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services}/manifest.py +42 -25
  59. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/services/strategy_registry.py +188 -0
  60. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/__init__.py +57 -0
  61. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_discovery_file.py +130 -0
  62. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_discovery_hybrid.py +85 -0
  63. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_discovery_manifest.py +102 -0
  64. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_execution_async.py +114 -0
  65. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_execution_cached.py +91 -0
  66. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_execution_pip.py +100 -0
  67. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_execution_wheel.py +107 -0
  68. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_mapping_discovery_first.py +101 -0
  69. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_mapping_hybrid.py +106 -0
  70. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_mapping_manifest_first.py +101 -0
  71. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_policy_allow_list.py +58 -0
  72. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_policy_deny_list.py +58 -0
  73. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_policy_permissive.py +47 -0
  74. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_timing_clean.py +68 -0
  75. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_timing_full.py +67 -0
  76. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_timing_smart.py +69 -0
  77. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/package/strategies/package_timing_temporary.py +67 -0
  78. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/runtime/__init__.py +18 -0
  79. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/runtime/adaptive_learner.py +131 -0
  80. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/runtime/base.py +276 -0
  81. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/runtime/facade.py +95 -0
  82. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/runtime/intelligent_selector.py +173 -0
  83. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/runtime/metrics.py +64 -0
  84. exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/runtime/performance.py +39 -0
  85. {exonware_xwlazy-0.1.0.11/src → exonware_xwlazy-0.1.0.19/src/exonware}/xwlazy/version.py +2 -2
  86. exonware_xwlazy-0.1.0.19/src/xwlazy.py +44 -0
  87. exonware_xwlazy-0.1.0.19/src/xwlazy_wrapper.py +21 -0
  88. exonware_xwlazy-0.1.0.11/src/exonware/xwlazy/__init__.py +0 -0
  89. exonware_xwlazy-0.1.0.11/src/exonware/xwlazy/version.py +0 -77
  90. exonware_xwlazy-0.1.0.11/src/xwlazy/__init__.py +0 -34
  91. exonware_xwlazy-0.1.0.11/src/xwlazy/lazy/__init__.py +0 -301
  92. exonware_xwlazy-0.1.0.11/src/xwlazy/lazy/bootstrap.py +0 -106
  93. exonware_xwlazy-0.1.0.11/src/xwlazy/lazy/lazy_base.py +0 -465
  94. exonware_xwlazy-0.1.0.11/src/xwlazy/lazy/lazy_contracts.py +0 -290
  95. exonware_xwlazy-0.1.0.11/src/xwlazy/lazy/lazy_core.py +0 -3727
  96. exonware_xwlazy-0.1.0.11/src/xwlazy/lazy/logging_utils.py +0 -194
  97. {exonware_xwlazy-0.1.0.11 → exonware_xwlazy-0.1.0.19}/.gitignore +0 -0
  98. {exonware_xwlazy-0.1.0.11 → exonware_xwlazy-0.1.0.19}/LICENSE +0 -0
  99. /exonware_xwlazy-0.1.0.11/src/xwlazy/lazy/lazy_state.py → /exonware_xwlazy-0.1.0.19/src/exonware/xwlazy/common/services/state_manager.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: exonware-xwlazy
3
- Version: 0.1.0.11
3
+ Version: 0.1.0.19
4
4
  Summary: Marker package that enables lazy install features across the eXonware suite.
5
5
  Project-URL: Homepage, https://exonware.com
6
6
  Project-URL: Repository, https://github.com/exonware/xwlazy
@@ -76,14 +76,40 @@ Built-in tracking of module load times, access counts, memory usage, and cache h
76
76
 
77
77
  **Why it matters:** Visibility into lazy loading performance helps identify bottlenecks and optimize import strategies.
78
78
 
79
- ### 🎨 **5 Installation Modes**
80
- - **AUTO:** Install automatically without asking
81
- - **INTERACTIVE:** Prompt user before each installation
82
- - **WARN:** Log warnings but don't install (monitoring mode)
83
- - **DISABLED:** Don't install anything
79
+ ### 🎨 **Two-Dimensional Mode System**
80
+
81
+ xwlazy uses a powerful two-dimensional mode system that separates **loading behavior** from **installation behavior**, giving you precise control over how modules are loaded and when packages are installed.
82
+
83
+ #### **Lazy Load Modes** (When modules load)
84
+ - **NONE:** Standard imports (no lazy loading)
85
+ - **AUTO:** Lazy loading enabled (deferred module loading)
86
+ - **PRELOAD:** Preload all modules on start (parallel loading)
87
+ - **BACKGROUND:** Load modules in background threads (non-blocking)
88
+ - **CACHED:** Cache loaded modules but allow unloading
89
+
90
+ #### **Lazy Install Modes** (When packages install)
91
+ - **NONE:** No auto-installation
92
+ - **SMART:** Install on first usage (on-demand)
93
+ - **FULL:** Install all dependencies on start (parallel batch)
94
+ - **CLEAN:** Install on usage + uninstall after completion
95
+ - **TEMPORARY:** Always uninstall after use (aggressive cleanup)
96
+ - **SIZE_AWARE:** Install small packages, skip large ones
97
+ - **INTERACTIVE:** Ask user before installing
98
+ - **WARN:** Log warning but don't install (monitoring mode)
99
+ - **DISABLED:** Don't install anything (explicit)
84
100
  - **DRY_RUN:** Show what would be installed
85
101
 
86
- **Why it matters:** Different environments need different policies. Development might use AUTO, production might use WARN or DISABLED.
102
+ #### **Preset Modes** (Quick combinations)
103
+ - **none:** NONE load + NONE install (standard imports)
104
+ - **lite:** AUTO load + NONE install (lazy loading only)
105
+ - **smart:** AUTO load + SMART install (on-demand installation)
106
+ - **full:** AUTO load + FULL install (install all on start)
107
+ - **clean:** AUTO load + CLEAN install (install + cleanup)
108
+ - **temporary:** AUTO load + TEMPORARY install (aggressive cleanup)
109
+ - **size_aware:** AUTO load + SIZE_AWARE install (smart sizing)
110
+ - **auto:** AUTO load + SMART install + auto-uninstall large packages
111
+
112
+ **Why it matters:** Different environments need different policies. Development might use `smart`, production might use `lite` or `warn`, CI/CD might use `clean` or `temporary`.
87
113
 
88
114
  ## 🏆 Performance Benchmarks
89
115
 
@@ -215,26 +241,76 @@ import suspicious_package # ❌ Blocked by security policy
215
241
 
216
242
  ## 🔧 Advanced Configuration
217
243
 
218
- ### Installation Modes
244
+ ### Two-Dimensional Mode Configuration
245
+
246
+ #### Using Preset Modes (Recommended)
247
+
248
+ ```python
249
+ from xwlazy.lazy import config_package_lazy_install_enabled
250
+
251
+ # Quick preset modes
252
+ config_package_lazy_install_enabled("xwsystem", enabled=True, mode="smart") # On-demand install
253
+ config_package_lazy_install_enabled("xwsystem", enabled=True, mode="full") # Install all on start
254
+ config_package_lazy_install_enabled("xwsystem", enabled=True, mode="clean") # Install + cleanup
255
+ config_package_lazy_install_enabled("xwsystem", enabled=True, mode="lite") # Lazy load only
256
+ ```
257
+
258
+ #### Using Explicit Mode Configuration
219
259
 
220
260
  ```python
221
261
  from xwlazy.lazy import (
222
262
  config_package_lazy_install_enabled,
263
+ LazyLoadMode,
223
264
  LazyInstallMode,
265
+ LazyModeConfig,
224
266
  )
225
267
 
268
+ # Explicit two-dimensional configuration
269
+ config_package_lazy_install_enabled(
270
+ "xwsystem",
271
+ enabled=True,
272
+ load_mode=LazyLoadMode.PRELOAD, # Preload all modules
273
+ install_mode=LazyInstallMode.SMART # Install on-demand
274
+ )
275
+
276
+ # Or use LazyModeConfig for full control
277
+ config = LazyModeConfig(
278
+ load_mode=LazyLoadMode.BACKGROUND,
279
+ install_mode=LazyInstallMode.SIZE_AWARE,
280
+ large_package_threshold_mb=100.0, # Skip packages > 100MB
281
+ background_workers=4 # 4 background workers
282
+ )
283
+ config_package_lazy_install_enabled(
284
+ "xwsystem",
285
+ enabled=True,
286
+ mode_config=config
287
+ )
288
+ ```
289
+
290
+ #### Using exonware.conf (Global Configuration)
291
+
292
+ ```python
293
+ import exonware.conf as conf
294
+
295
+ # Set global lazy mode for all packages
296
+ conf.lazy = "smart" # or "lite", "full", "clean", "auto", etc.
297
+ ```
298
+
299
+ #### Special Purpose Modes
300
+
301
+ ```python
226
302
  # Interactive mode: Ask user before installing
227
303
  config_package_lazy_install_enabled(
228
304
  "xwsystem",
229
305
  enabled=True,
230
- mode=LazyInstallMode.INTERACTIVE
306
+ mode="interactive" # or LazyInstallMode.INTERACTIVE
231
307
  )
232
308
 
233
309
  # Warn mode: Log but don't install (monitoring)
234
310
  config_package_lazy_install_enabled(
235
311
  "xwsystem",
236
312
  enabled=True,
237
- mode=LazyInstallMode.WARN
313
+ mode="warn" # or LazyInstallMode.WARN
238
314
  )
239
315
  ```
240
316
 
@@ -49,14 +49,40 @@ Built-in tracking of module load times, access counts, memory usage, and cache h
49
49
 
50
50
  **Why it matters:** Visibility into lazy loading performance helps identify bottlenecks and optimize import strategies.
51
51
 
52
- ### 🎨 **5 Installation Modes**
53
- - **AUTO:** Install automatically without asking
54
- - **INTERACTIVE:** Prompt user before each installation
55
- - **WARN:** Log warnings but don't install (monitoring mode)
56
- - **DISABLED:** Don't install anything
52
+ ### 🎨 **Two-Dimensional Mode System**
53
+
54
+ xwlazy uses a powerful two-dimensional mode system that separates **loading behavior** from **installation behavior**, giving you precise control over how modules are loaded and when packages are installed.
55
+
56
+ #### **Lazy Load Modes** (When modules load)
57
+ - **NONE:** Standard imports (no lazy loading)
58
+ - **AUTO:** Lazy loading enabled (deferred module loading)
59
+ - **PRELOAD:** Preload all modules on start (parallel loading)
60
+ - **BACKGROUND:** Load modules in background threads (non-blocking)
61
+ - **CACHED:** Cache loaded modules but allow unloading
62
+
63
+ #### **Lazy Install Modes** (When packages install)
64
+ - **NONE:** No auto-installation
65
+ - **SMART:** Install on first usage (on-demand)
66
+ - **FULL:** Install all dependencies on start (parallel batch)
67
+ - **CLEAN:** Install on usage + uninstall after completion
68
+ - **TEMPORARY:** Always uninstall after use (aggressive cleanup)
69
+ - **SIZE_AWARE:** Install small packages, skip large ones
70
+ - **INTERACTIVE:** Ask user before installing
71
+ - **WARN:** Log warning but don't install (monitoring mode)
72
+ - **DISABLED:** Don't install anything (explicit)
57
73
  - **DRY_RUN:** Show what would be installed
58
74
 
59
- **Why it matters:** Different environments need different policies. Development might use AUTO, production might use WARN or DISABLED.
75
+ #### **Preset Modes** (Quick combinations)
76
+ - **none:** NONE load + NONE install (standard imports)
77
+ - **lite:** AUTO load + NONE install (lazy loading only)
78
+ - **smart:** AUTO load + SMART install (on-demand installation)
79
+ - **full:** AUTO load + FULL install (install all on start)
80
+ - **clean:** AUTO load + CLEAN install (install + cleanup)
81
+ - **temporary:** AUTO load + TEMPORARY install (aggressive cleanup)
82
+ - **size_aware:** AUTO load + SIZE_AWARE install (smart sizing)
83
+ - **auto:** AUTO load + SMART install + auto-uninstall large packages
84
+
85
+ **Why it matters:** Different environments need different policies. Development might use `smart`, production might use `lite` or `warn`, CI/CD might use `clean` or `temporary`.
60
86
 
61
87
  ## 🏆 Performance Benchmarks
62
88
 
@@ -188,26 +214,76 @@ import suspicious_package # ❌ Blocked by security policy
188
214
 
189
215
  ## 🔧 Advanced Configuration
190
216
 
191
- ### Installation Modes
217
+ ### Two-Dimensional Mode Configuration
218
+
219
+ #### Using Preset Modes (Recommended)
220
+
221
+ ```python
222
+ from xwlazy.lazy import config_package_lazy_install_enabled
223
+
224
+ # Quick preset modes
225
+ config_package_lazy_install_enabled("xwsystem", enabled=True, mode="smart") # On-demand install
226
+ config_package_lazy_install_enabled("xwsystem", enabled=True, mode="full") # Install all on start
227
+ config_package_lazy_install_enabled("xwsystem", enabled=True, mode="clean") # Install + cleanup
228
+ config_package_lazy_install_enabled("xwsystem", enabled=True, mode="lite") # Lazy load only
229
+ ```
230
+
231
+ #### Using Explicit Mode Configuration
192
232
 
193
233
  ```python
194
234
  from xwlazy.lazy import (
195
235
  config_package_lazy_install_enabled,
236
+ LazyLoadMode,
196
237
  LazyInstallMode,
238
+ LazyModeConfig,
197
239
  )
198
240
 
241
+ # Explicit two-dimensional configuration
242
+ config_package_lazy_install_enabled(
243
+ "xwsystem",
244
+ enabled=True,
245
+ load_mode=LazyLoadMode.PRELOAD, # Preload all modules
246
+ install_mode=LazyInstallMode.SMART # Install on-demand
247
+ )
248
+
249
+ # Or use LazyModeConfig for full control
250
+ config = LazyModeConfig(
251
+ load_mode=LazyLoadMode.BACKGROUND,
252
+ install_mode=LazyInstallMode.SIZE_AWARE,
253
+ large_package_threshold_mb=100.0, # Skip packages > 100MB
254
+ background_workers=4 # 4 background workers
255
+ )
256
+ config_package_lazy_install_enabled(
257
+ "xwsystem",
258
+ enabled=True,
259
+ mode_config=config
260
+ )
261
+ ```
262
+
263
+ #### Using exonware.conf (Global Configuration)
264
+
265
+ ```python
266
+ import exonware.conf as conf
267
+
268
+ # Set global lazy mode for all packages
269
+ conf.lazy = "smart" # or "lite", "full", "clean", "auto", etc.
270
+ ```
271
+
272
+ #### Special Purpose Modes
273
+
274
+ ```python
199
275
  # Interactive mode: Ask user before installing
200
276
  config_package_lazy_install_enabled(
201
277
  "xwsystem",
202
278
  enabled=True,
203
- mode=LazyInstallMode.INTERACTIVE
279
+ mode="interactive" # or LazyInstallMode.INTERACTIVE
204
280
  )
205
281
 
206
282
  # Warn mode: Log but don't install (monitoring)
207
283
  config_package_lazy_install_enabled(
208
284
  "xwsystem",
209
285
  enabled=True,
210
- mode=LazyInstallMode.WARN
286
+ mode="warn" # or LazyInstallMode.WARN
211
287
  )
212
288
  ```
213
289
 
@@ -40,7 +40,7 @@ Documentation = "https://github.com/exonware/xwlazy#readme"
40
40
  Subtree = "https://github.com/Exonware/XWLazy.git"
41
41
 
42
42
  [tool.hatch.version]
43
- path = "src/xwlazy/version.py"
43
+ path = "src/exonware/xwlazy/version.py"
44
44
 
45
45
  [tool.hatch.build.targets.wheel]
46
46
  packages = ["src/exonware", "src/xwlazy"]
@@ -0,0 +1,22 @@
1
+ """
2
+ exonware package - Enterprise-grade Python framework ecosystem
3
+
4
+ Company: eXonware.com
5
+ Author: Eng. Muhammad AlShehri
6
+ Email: connect@exonware.com
7
+ Version: 0.1.0.19
8
+ Generation Date: 2025-01-03
9
+
10
+ This is a namespace package allowing multiple exonware subpackages
11
+ to coexist (xwsystem, xwnode, xwdata, xwlazy, etc.)
12
+ """
13
+
14
+ # Make this a namespace package - DO NOT set __path__
15
+ # This allows both exonware.xwsystem and exonware.xwlazy to coexist
16
+ __path__ = __import__('pkgutil').extend_path(__path__, __name__)
17
+
18
+ __version__ = '0.0.1'
19
+ __author__ = 'Eng. Muhammad AlShehri'
20
+ __email__ = 'connect@exonware.com'
21
+ __company__ = 'eXonware.com'
22
+
@@ -0,0 +1,368 @@
1
+ """
2
+ #exonware/xwlazy/src/exonware/xwlazy/__init__.py
3
+
4
+ xwlazy: Lazy loading and on-demand package installation for Python.
5
+
6
+ The xwlazy library provides automatic dependency installation and lazy loading
7
+ capabilities, allowing packages to declare optional dependencies that are
8
+ installed only when needed.
9
+
10
+ Company: eXonware.com
11
+ Author: Eng. Muhammad AlShehri
12
+ Email: connect@exonware.com
13
+ Version: 0.1.0.19
14
+ Generation Date: 10-Oct-2025
15
+
16
+ Main Features:
17
+ - Automatic dependency discovery from pyproject.toml and requirements.txt
18
+ - On-demand package installation via import hooks
19
+ - Two-stage lazy loading for optimal performance
20
+ - Per-package lazy mode configuration
21
+ - Security policies and allow/deny lists
22
+ - SBOM generation and lockfile management
23
+
24
+ Example:
25
+ >>> from exonware.xwlazy import enable_lazy_mode, xwimport
26
+ >>>
27
+ >>> # Enable lazy mode for your package
28
+ >>> enable_lazy_mode(package_name="my_package", lazy_install_mode="smart")
29
+ >>>
30
+ >>> # Import with automatic installation
31
+ >>> pandas = xwimport("pandas") # Installs pandas if not available
32
+ """
33
+
34
+ # =============================================================================
35
+ # VERSION
36
+ # =============================================================================
37
+
38
+ from .version import (
39
+ __version__,
40
+ VERSION_MAJOR,
41
+ VERSION_MINOR,
42
+ VERSION_PATCH,
43
+ VERSION_BUILD,
44
+ VERSION_SUFFIX,
45
+ VERSION_STRING,
46
+ get_version,
47
+ get_version_info,
48
+ get_version_dict,
49
+ is_dev_version,
50
+ is_release_version,
51
+ )
52
+
53
+ # =============================================================================
54
+ # IMPORTS - Standard Python Imports (No Defensive Code!)
55
+ # =============================================================================
56
+
57
+ # Import from facade - provides unified public API
58
+ from .facade import (
59
+ # Facade functions
60
+ enable_lazy_mode,
61
+ disable_lazy_mode,
62
+ is_lazy_mode_enabled,
63
+ get_lazy_mode_stats,
64
+ configure_lazy_mode,
65
+ preload_modules,
66
+ optimize_lazy_mode,
67
+ # Public API functions
68
+ enable_lazy_install,
69
+ disable_lazy_install,
70
+ is_lazy_install_enabled,
71
+ set_lazy_install_mode,
72
+ get_lazy_install_mode,
73
+ install_missing_package,
74
+ install_and_import,
75
+ get_lazy_install_stats,
76
+ get_all_lazy_install_stats,
77
+ lazy_import_with_install,
78
+ xwimport,
79
+ # Hook functions
80
+ install_import_hook,
81
+ uninstall_import_hook,
82
+ is_import_hook_installed,
83
+ # Lazy loading functions
84
+ enable_lazy_imports,
85
+ disable_lazy_imports,
86
+ is_lazy_import_enabled,
87
+ lazy_import,
88
+ register_lazy_module,
89
+ preload_module,
90
+ get_lazy_module,
91
+ get_loading_stats,
92
+ preload_frequently_used,
93
+ get_lazy_import_stats,
94
+ # Configuration
95
+ config_package_lazy_install_enabled,
96
+ config_module_lazy_load_enabled,
97
+ sync_manifest_configuration,
98
+ refresh_lazy_manifests,
99
+ # Security & Policy
100
+ set_package_allow_list,
101
+ set_package_deny_list,
102
+ add_to_package_allow_list,
103
+ add_to_package_deny_list,
104
+ set_package_index_url,
105
+ set_package_extra_index_urls,
106
+ add_package_trusted_host,
107
+ set_package_lockfile,
108
+ generate_package_sbom,
109
+ check_externally_managed_environment,
110
+ register_lazy_module_prefix,
111
+ register_lazy_module_methods,
112
+ # Keyword-based detection
113
+ enable_keyword_detection,
114
+ is_keyword_detection_enabled,
115
+ get_keyword_detection_keyword,
116
+ check_package_keywords,
117
+ # Discovery functions
118
+ get_lazy_discovery,
119
+ discover_dependencies,
120
+ export_dependency_mappings,
121
+ )
122
+
123
+ # Import contracts and base for advanced usage
124
+ from .defs import PRESET_MODES, get_preset_mode
125
+ from .defs import (
126
+ LazyLoadMode,
127
+ LazyInstallMode,
128
+ PathType,
129
+ DependencyInfo,
130
+ LazyModeConfig,
131
+ )
132
+ from .contracts import (
133
+ IPackageHelper,
134
+ IModuleHelper,
135
+ IRuntime,
136
+ )
137
+
138
+ # Import errors
139
+ from .errors import (
140
+ LazySystemError,
141
+ LazyInstallError,
142
+ LazyDiscoveryError,
143
+ LazyHookError,
144
+ LazySecurityError,
145
+ ExternallyManagedError,
146
+ DeferredImportError,
147
+ )
148
+
149
+ # Import config
150
+ from .config import LazyConfig, DEFAULT_LAZY_CONFIG
151
+
152
+ # Import abstract base classes directly from submodules
153
+ from .package.base import APackageHelper
154
+ from .module.base import AModuleHelper
155
+ from .runtime.base import ARuntimeHelper
156
+
157
+ # Import concrete implementations (lazy to prevent circular imports)
158
+ from typing import Any
159
+
160
+ def __getattr__(name: str) -> Any:
161
+ """Lazy import for concrete facades to prevent circular dependencies."""
162
+ if name == "XWPackageHelper":
163
+ from .package import XWPackageHelper
164
+ return XWPackageHelper
165
+ elif name == "XWModuleHelper":
166
+ from .module import XWModuleHelper
167
+ return XWModuleHelper
168
+ elif name == "XWRuntimeHelper":
169
+ from .runtime import XWRuntimeHelper
170
+ return XWRuntimeHelper
171
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
172
+
173
+ # Import core classes for advanced usage
174
+ from .package.services.config_manager import LazyInstallConfig
175
+ from .package.services import LazyInstallerRegistry, AsyncInstallHandle, LazyInstaller
176
+ from .common.services.dependency_mapper import DependencyMapper
177
+ from .module.importer_engine import (
178
+ LazyMetaPathFinder,
179
+ WatchedPrefixRegistry,
180
+ LazyLoader,
181
+ )
182
+ from .package.services.manifest import LazyManifestLoader, PackageManifest
183
+ from .facade import _lazy_importer
184
+
185
+ # Import internal utilities (for advanced usage)
186
+ from .common.services import (
187
+ check_package_keywords,
188
+ _detect_lazy_installation,
189
+ _detect_meta_info_mode,
190
+ )
191
+ from .module.importer_engine import (
192
+ _set_package_class_hints,
193
+ _get_package_class_hints,
194
+ _clear_all_package_class_hints,
195
+ _spec_for_existing_module,
196
+ )
197
+ from .common.services.spec_cache import (
198
+ _cached_stdlib_check,
199
+ _spec_cache_get,
200
+ _spec_cache_put,
201
+ _spec_cache_clear,
202
+ _cache_spec_if_missing,
203
+ _spec_cache_prune_locked,
204
+ )
205
+ from .package.services import (
206
+ is_externally_managed as _is_externally_managed,
207
+ check_pip_audit_available as _check_pip_audit_available,
208
+ )
209
+ from .module.importer_engine import (
210
+ _is_import_in_progress,
211
+ _mark_import_started,
212
+ _mark_import_finished,
213
+ _lazy_aware_import_module,
214
+ _patch_import_module,
215
+ _unpatch_import_module,
216
+ )
217
+
218
+ # Version info
219
+ __author__ = 'Eng. Muhammad AlShehri'
220
+ __email__ = 'connect@exonware.com'
221
+ __company__ = 'eXonware.com'
222
+
223
+ # =============================================================================
224
+ # PUBLIC API
225
+ # =============================================================================
226
+
227
+ __all__ = [
228
+ # Version
229
+ "__version__",
230
+ "VERSION_MAJOR",
231
+ "VERSION_MINOR",
232
+ "VERSION_PATCH",
233
+ "VERSION_BUILD",
234
+ "VERSION_SUFFIX",
235
+ "VERSION_STRING",
236
+ "get_version",
237
+ "get_version_info",
238
+ "get_version_dict",
239
+ "is_dev_version",
240
+ "is_release_version",
241
+ # Facade functions
242
+ "enable_lazy_mode",
243
+ "disable_lazy_mode",
244
+ "is_lazy_mode_enabled",
245
+ "get_lazy_mode_stats",
246
+ "configure_lazy_mode",
247
+ "preload_modules",
248
+ "optimize_lazy_mode",
249
+ # Public API functions
250
+ "enable_lazy_install",
251
+ "disable_lazy_install",
252
+ "is_lazy_install_enabled",
253
+ "set_lazy_install_mode",
254
+ "get_lazy_install_mode",
255
+ "install_missing_package",
256
+ "install_and_import",
257
+ "get_lazy_install_stats",
258
+ "get_all_lazy_install_stats",
259
+ "lazy_import_with_install",
260
+ "xwimport",
261
+ # Hook functions
262
+ "install_import_hook",
263
+ "uninstall_import_hook",
264
+ "is_import_hook_installed",
265
+ # Lazy loading functions
266
+ "enable_lazy_imports",
267
+ "disable_lazy_imports",
268
+ "is_lazy_import_enabled",
269
+ "lazy_import",
270
+ "register_lazy_module",
271
+ "preload_module",
272
+ "get_lazy_module",
273
+ "get_loading_stats",
274
+ "preload_frequently_used",
275
+ "get_lazy_import_stats",
276
+ # Configuration
277
+ "config_package_lazy_install_enabled",
278
+ "sync_manifest_configuration",
279
+ "refresh_lazy_manifests",
280
+ # Security & Policy
281
+ "set_package_allow_list",
282
+ "set_package_deny_list",
283
+ "add_to_package_allow_list",
284
+ "add_to_package_deny_list",
285
+ "set_package_index_url",
286
+ "set_package_extra_index_urls",
287
+ "add_package_trusted_host",
288
+ "set_package_lockfile",
289
+ "generate_package_sbom",
290
+ "check_externally_managed_environment",
291
+ "register_lazy_module_prefix",
292
+ "register_lazy_module_methods",
293
+ # Keyword-based detection
294
+ "enable_keyword_detection",
295
+ "is_keyword_detection_enabled",
296
+ "get_keyword_detection_keyword",
297
+ "check_package_keywords",
298
+ # Discovery functions
299
+ "get_lazy_discovery",
300
+ "discover_dependencies",
301
+ "export_dependency_mappings",
302
+ # Contracts
303
+ "LazyLoadMode",
304
+ "LazyInstallMode",
305
+ "PathType",
306
+ "DependencyInfo",
307
+ "LazyModeConfig",
308
+ "PRESET_MODES",
309
+ "get_preset_mode",
310
+ "IPackageHelper",
311
+ "IModuleHelper",
312
+ "IRuntime",
313
+ # Abstract base classes
314
+ "APackageHelper",
315
+ "AModuleHelper",
316
+ "ARuntimeHelper",
317
+ # Concrete implementations
318
+ "XWPackageHelper",
319
+ "XWModuleHelper",
320
+ "XWRuntimeHelper",
321
+ # Errors
322
+ "LazySystemError",
323
+ "LazyInstallError",
324
+ "LazyDiscoveryError",
325
+ "LazyHookError",
326
+ "LazySecurityError",
327
+ "ExternallyManagedError",
328
+ "DeferredImportError",
329
+ # Config
330
+ "LazyConfig",
331
+ "DEFAULT_LAZY_CONFIG",
332
+ # Core classes (for advanced usage)
333
+ "LazyInstallConfig",
334
+ "LazyInstallerRegistry",
335
+ "AsyncInstallHandle",
336
+ "LazyInstaller",
337
+ "DependencyMapper",
338
+ "LazyMetaPathFinder",
339
+ "WatchedPrefixRegistry",
340
+ "LazyLoader",
341
+ "LazyManifestLoader",
342
+ "PackageManifest",
343
+ "manifest",
344
+ "_lazy_importer",
345
+ # Internal utilities (for advanced usage)
346
+ "check_package_keywords",
347
+ "_detect_lazy_installation",
348
+ "_detect_meta_info_mode",
349
+ "_set_package_class_hints",
350
+ "_get_package_class_hints",
351
+ "_clear_all_package_class_hints",
352
+ "_spec_for_existing_module",
353
+ "_cached_stdlib_check",
354
+ "_spec_cache_get",
355
+ "_spec_cache_put",
356
+ "_spec_cache_clear",
357
+ "_cache_spec_if_missing",
358
+ "_spec_cache_prune_locked",
359
+ "_is_externally_managed",
360
+ "_check_pip_audit_available",
361
+ "_is_import_in_progress",
362
+ "_mark_import_started",
363
+ "_mark_import_finished",
364
+ "_lazy_aware_import_module",
365
+ "_patch_import_module",
366
+ "_unpatch_import_module",
367
+ ]
368
+