exonware-xwlazy 0.1.0.9__py3-none-any.whl → 0.1.0.11__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.
Binary file
@@ -14,13 +14,13 @@ All version references should import from this module to ensure consistency.
14
14
  # =============================================================================
15
15
 
16
16
  # Main version - update this to change version across entire project
17
- __version__ = "0.1.0.9"
17
+ __version__ = "0.1.0.16"
18
18
 
19
19
  # Version components for programmatic access
20
20
  VERSION_MAJOR = 0
21
21
  VERSION_MINOR = 1
22
22
  VERSION_PATCH = 0
23
- VERSION_BUILD = 9 # Set to None for releases, or build number for dev builds
23
+ VERSION_BUILD = 16 # Set to None for releases, or build number for dev builds
24
24
 
25
25
  # Version metadata
26
26
  VERSION_SUFFIX = "" # e.g., "dev", "alpha", "beta", "rc1"
@@ -0,0 +1,380 @@
1
+ Metadata-Version: 2.4
2
+ Name: exonware-xwlazy
3
+ Version: 0.1.0.11
4
+ Summary: Marker package that enables lazy install features across the eXonware suite.
5
+ Project-URL: Homepage, https://exonware.com
6
+ Project-URL: Repository, https://github.com/exonware/xwlazy
7
+ Project-URL: Documentation, https://github.com/exonware/xwlazy#readme
8
+ Project-URL: Subtree, https://github.com/Exonware/XWLazy.git
9
+ Author-email: "Eng. Muhammad AlShehri" <connect@exonware.com>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: exonware,lazy,xwlazy
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Requires-Python: >=3.8
25
+ Requires-Dist: tomli>=2.0.1; python_version < '3.11'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # xwlazy
29
+
30
+ **Enterprise-grade lazy loading with automatic dependency installation—the only lazy import library that installs missing packages on-demand while maintaining per-package isolation and security.**
31
+
32
+ [![Status](https://img.shields.io/badge/status-beta-blue.svg)](https://exonware.com)
33
+ [![Python](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://www.python.org)
34
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
35
+
36
+ ## 🎯 Overview
37
+
38
+ xwlazy is a production-ready lazy loading system that enables Python packages to automatically install missing dependencies when they're actually used. Unlike traditional dependency management, xwlazy installs dependencies **on-demand** at runtime, reducing initial installation size, avoiding conflicts, and enabling truly optional features.
39
+
40
+ **Why xwlazy exists:** Traditional dependency management requires installing all dependencies upfront, even if they're never used. This leads to bloated installations, longer setup times, and potential conflicts. xwlazy solves this by installing dependencies only when code actually needs them, while maintaining full security and isolation between packages.
41
+
42
+ ## ✨ Key Features
43
+
44
+ ### 🚀 **Auto-Installation on Demand**
45
+ Dependencies are automatically installed when code first uses them—no manual intervention required. Perfect for optional features that users may never need.
46
+
47
+ **Why it matters:** Reduces initial installation size by 60-80% for packages with many optional dependencies, while maintaining zero overhead for successful imports.
48
+
49
+ ### 🔒 **Per-Package Isolation**
50
+ Each package (xwsystem, xwnode, xwdata, etc.) can independently enable lazy mode without affecting others. Complete isolation prevents conflicts and enables flexible deployment strategies.
51
+
52
+ **Why it matters:** Allows mixing lazy and non-lazy packages in the same environment, giving developers full control over which packages use auto-installation.
53
+
54
+ ### 🎯 **Keyword-Based Auto-Detection**
55
+ Packages can opt-in to lazy loading by simply adding `"xwlazy-enabled"` to their `pyproject.toml` keywords—no code changes required.
56
+
57
+ **Why it matters:** Zero-code integration for package maintainers. Just add a keyword and lazy loading works automatically.
58
+
59
+ ### 🛡️ **Enterprise Security**
60
+ - **Allow/Deny Lists:** Whitelist or blacklist specific packages
61
+ - **SBOM Generation:** Software Bill of Materials for compliance
62
+ - **Vulnerability Auditing:** Automatic security scanning with pip-audit
63
+ - **Lockfile Management:** Track installed packages with versions
64
+ - **PEP 668 Compliance:** Respects externally-managed environments
65
+
66
+ **Why it matters:** Production environments require security controls. xwlazy provides enterprise-grade security without sacrificing usability.
67
+
68
+ ### ⚡ **Two-Stage Lazy Loading**
69
+ **Stage 1 (Import Time):** Missing imports are logged but don't raise errors—modules load successfully.
70
+ **Stage 2 (Usage Time):** Dependencies are installed automatically when code first accesses them.
71
+
72
+ **Why it matters:** Enables clean Python code with standard imports. No defensive `try/except ImportError` blocks needed.
73
+
74
+ ### 📊 **Performance Monitoring**
75
+ Built-in tracking of module load times, access counts, memory usage, and cache hit ratios. Comprehensive statistics API for optimization.
76
+
77
+ **Why it matters:** Visibility into lazy loading performance helps identify bottlenecks and optimize import strategies.
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
84
+ - **DRY_RUN:** Show what would be installed
85
+
86
+ **Why it matters:** Different environments need different policies. Development might use AUTO, production might use WARN or DISABLED.
87
+
88
+ ## 🏆 Performance Benchmarks
89
+
90
+ xwlazy has been benchmarked against 8 competing lazy import libraries. **Results show xwlazy is competitive across all load scenarios** while providing significantly more features.
91
+
92
+ ### Latest Benchmark Results (2025-11-17)
93
+
94
+ | Load Type | xwlazy Time | Rank | vs. Winner | Features |
95
+ |-----------|-------------|------|------------|----------|
96
+ | **Light Load** (1 module) | 2.08 ms | 🥇 **1st** | 2.54x faster | 7 features |
97
+ | **Medium Load** (8 modules) | 6.99 ms | 🥇 **1st** | 8.52x faster | 7 features |
98
+ | **Heavy Load** (22 modules) | 21.13 ms | 🥇 **1st** | 25.75x faster | 7 features |
99
+ | **Enterprise Load** (50+ modules) | 61.28 ms | 🥇 **1st** | 74.66x faster | 7 features |
100
+
101
+ **Competitive Advantage:** While competitors offer 1-2 features (basic lazy loading), xwlazy provides **7 enterprise features** including auto-installation, security policies, SBOM generation, and per-package isolation.
102
+
103
+ **See full benchmarks:** [benchmarks/competition_tests/output_log/](benchmarks/competition_tests/output_log/)
104
+
105
+ ## 🚀 Quick Start
106
+
107
+ ### Installation
108
+
109
+ ```bash
110
+ # Standard installation
111
+ pip install exonware-xwlazy
112
+
113
+ # Or install as xwlazy (alias package)
114
+ pip install xwlazy
115
+ ```
116
+
117
+ ### Basic Usage
118
+
119
+ **One-line setup** for per-package lazy loading:
120
+
121
+ ```python
122
+ # In your package's __init__.py
123
+ from xwlazy.lazy import config_package_lazy_install_enabled
124
+
125
+ # Auto-detects from pip install your-package[lazy]
126
+ config_package_lazy_install_enabled("your-package")
127
+ ```
128
+
129
+ **That's it!** Now use standard imports—missing dependencies install automatically:
130
+
131
+ ```python
132
+ # your-package/serialization/avro.py
133
+ import fastavro # Auto-installed if missing! ✨
134
+
135
+ # User code
136
+ from your-package.serialization.avro import AvroSerializer
137
+ serializer = AvroSerializer() # Installs fastavro on first use
138
+ ```
139
+
140
+ ### Keyword-Based Detection (Zero Code)
141
+
142
+ Add to your `pyproject.toml`:
143
+
144
+ ```toml
145
+ [project]
146
+ name = "my-package"
147
+ keywords = ["xwlazy-enabled"] # <-- Add this
148
+ ```
149
+
150
+ After `pip install -e .`, xwlazy automatically enables lazy loading for your package—no code changes needed!
151
+
152
+ ## 📖 Documentation
153
+
154
+ - **[Architecture Reference](docs/REF_ARCH.md)** - System design, patterns, and structure
155
+ - **[Keyword Detection Guide](docs/KEYWORD_DETECTION.md)** - Zero-code integration
156
+ - **[Competition Benchmarks](benchmarks/competition_tests/)** - Performance comparisons
157
+ - **[Performance Analysis](benchmarks/competition_tests/PERFORMANCE_ANALYSIS.md)** - Optimization recommendations
158
+
159
+ ## 💡 Use Cases
160
+
161
+ ### 1. Optional Format Support
162
+
163
+ ```python
164
+ # xwsystem/serialization/avro.py
165
+ import fastavro # Only installed if user needs Avro support
166
+
167
+ class AvroSerializer:
168
+ def serialize(self, data):
169
+ return fastavro.schemaless_writer(...)
170
+ ```
171
+
172
+ **Benefit:** Users who never use Avro don't install fastavro, reducing installation size.
173
+
174
+ ### 2. Development Tools
175
+
176
+ ```python
177
+ # xwnode/visualization/graphviz.py
178
+ import graphviz # Only installed in development
179
+
180
+ def visualize_graph(node):
181
+ return graphviz.render(...)
182
+ ```
183
+
184
+ **Benefit:** Production deployments don't include development-only dependencies.
185
+
186
+ ### 3. Platform-Specific Features
187
+
188
+ ```python
189
+ # xwdata/formats/excel.py
190
+ try:
191
+ import openpyxl # Windows/Linux
192
+ except ImportError:
193
+ import xlrd # macOS fallback
194
+ ```
195
+
196
+ **Benefit:** Platform-specific dependencies install automatically based on availability.
197
+
198
+ ### 4. Security-Controlled Environments
199
+
200
+ ```python
201
+ from xwlazy.lazy import (
202
+ config_package_lazy_install_enabled,
203
+ set_package_allow_list,
204
+ )
205
+
206
+ # Only allow specific packages
207
+ config_package_lazy_install_enabled("xwsystem")
208
+ set_package_allow_list("xwsystem", ["fastavro", "protobuf", "msgpack"])
209
+
210
+ # Attempts to install other packages are blocked
211
+ import suspicious_package # ❌ Blocked by security policy
212
+ ```
213
+
214
+ **Benefit:** Enterprise environments can restrict auto-installation to approved packages only.
215
+
216
+ ## 🔧 Advanced Configuration
217
+
218
+ ### Installation Modes
219
+
220
+ ```python
221
+ from xwlazy.lazy import (
222
+ config_package_lazy_install_enabled,
223
+ LazyInstallMode,
224
+ )
225
+
226
+ # Interactive mode: Ask user before installing
227
+ config_package_lazy_install_enabled(
228
+ "xwsystem",
229
+ enabled=True,
230
+ mode=LazyInstallMode.INTERACTIVE
231
+ )
232
+
233
+ # Warn mode: Log but don't install (monitoring)
234
+ config_package_lazy_install_enabled(
235
+ "xwsystem",
236
+ enabled=True,
237
+ mode=LazyInstallMode.WARN
238
+ )
239
+ ```
240
+
241
+ ### Security Policies
242
+
243
+ ```python
244
+ from xwlazy.lazy import (
245
+ set_package_allow_list,
246
+ set_package_deny_list,
247
+ set_package_lockfile,
248
+ )
249
+
250
+ # Whitelist approach
251
+ set_package_allow_list("xwsystem", ["fastavro", "protobuf"])
252
+
253
+ # Blacklist approach
254
+ set_package_deny_list("xwsystem", ["suspicious-package"])
255
+
256
+ # Track installations
257
+ set_package_lockfile("xwsystem", "xwsystem-lazy-lock.json")
258
+ ```
259
+
260
+ ### SBOM Generation
261
+
262
+ ```python
263
+ from xwlazy.lazy import generate_package_sbom
264
+
265
+ # Generate Software Bill of Materials for compliance
266
+ sbom = generate_package_sbom("xwsystem", "xwsystem-sbom.json")
267
+ ```
268
+
269
+ ### Statistics and Monitoring
270
+
271
+ ```python
272
+ from xwlazy.lazy import get_lazy_install_stats
273
+
274
+ # Get installation statistics
275
+ stats = get_lazy_install_stats("xwsystem")
276
+ # {
277
+ # 'enabled': True,
278
+ # 'mode': 'auto',
279
+ # 'installed_packages': ['fastavro', 'protobuf'],
280
+ # 'failed_packages': [],
281
+ # 'total_installed': 2
282
+ # }
283
+ ```
284
+
285
+ ## 🎨 Design Patterns
286
+
287
+ xwlazy implements 8 design patterns for maintainability and extensibility:
288
+
289
+ 1. **Facade Pattern** - Unified API to complex subsystems
290
+ 2. **Strategy Pattern** - Pluggable discovery/installation strategies
291
+ 3. **Template Method** - Base classes define common workflows
292
+ 4. **Singleton** - Global instances for system-wide state
293
+ 5. **Registry** - Per-package isolation and management
294
+ 6. **Observer** - Performance monitoring and tracking
295
+ 7. **Proxy** - Deferred loading and lazy access
296
+ 8. **Factory** - Creating appropriate handlers by context
297
+
298
+ ## 🔒 Security Considerations
299
+
300
+ ### PEP 668 Compliance
301
+ xwlazy respects externally-managed Python environments and refuses to install in system Python, suggesting virtual environments instead.
302
+
303
+ ### System Module Protection
304
+ Built-in modules (stdlib) are never auto-installed, preventing accidental system modifications.
305
+
306
+ ### Vulnerability Scanning
307
+ Optional pip-audit integration scans packages after installation and logs security warnings.
308
+
309
+ ### Custom PyPI Mirrors
310
+ Support for internal PyPI servers with custom index URLs and trusted hosts.
311
+
312
+ ## ⚡ Performance Characteristics
313
+
314
+ - **Zero overhead** for successful imports (hooks only trigger on failures)
315
+ - **Aggressive caching** with file modification time checks
316
+ - **Lazy initialization** - everything loads only when needed
317
+ - **Thread-safe** operations with proper locking
318
+ - **Import overhead:** ~0.1ms for successful imports
319
+ - **First failure:** ~50ms (discovery + policy check)
320
+ - **Subsequent failures:** ~5ms (cached discovery)
321
+
322
+ ## 🧪 Testing
323
+
324
+ xwlazy includes comprehensive test suites:
325
+
326
+ ```bash
327
+ # Run all tests
328
+ python tests/runner.py
329
+
330
+ # Run specific test layers
331
+ python tests/0.core/runner.py # Core tests (< 30s)
332
+ python tests/1.unit/runner.py # Unit tests (< 5m)
333
+ ```
334
+
335
+ ## 📊 Comparison with Competitors
336
+
337
+ | Feature | xwlazy | lazy-imports-lite | lazy-loader | lazy_import |
338
+ |---------|--------|-------------------|-------------|-------------|
339
+ | **Lazy Import** | ✅ | ✅ | ✅ | ✅ |
340
+ | **Auto-Installation** | ✅ | ❌ | ❌ | ❌ |
341
+ | **Keyword Detection** | ✅ | ✅ | ❌ | ❌ |
342
+ | **Per-Package Isolation** | ✅ | ❌ | ❌ | ❌ |
343
+ | **Security Policies** | ✅ | ❌ | ❌ | ❌ |
344
+ | **SBOM Generation** | ✅ | ❌ | ❌ | ❌ |
345
+ | **Performance Monitoring** | ✅ | ❌ | ❌ | ❌ |
346
+ | **Two-Stage Loading** | ✅ | ❌ | ❌ | ❌ |
347
+ | **Total Features** | **7** | **2** | **1** | **1** |
348
+
349
+ ## 🤝 Contributing
350
+
351
+ xwlazy is part of the eXonware ecosystem. For contributions, please follow:
352
+
353
+ - [Development Guide](../../docs/guides/GUIDE_DEV.md) - Core development standards
354
+ - [Testing Guide](../../docs/guides/GUIDE_TEST.md) - Testing standards
355
+ - [Documentation Guide](../../docs/guides/GUIDE_DOCS.md) - Documentation standards
356
+
357
+ ## 📄 License
358
+
359
+ MIT License - see [LICENSE](LICENSE) for details.
360
+
361
+ ## 🔗 Links
362
+
363
+ - **Homepage:** https://exonware.com
364
+ - **Repository:** https://github.com/exonware/xwlazy
365
+ - **Email:** connect@exonware.com
366
+ - **Author:** Eng. Muhammad AlShehri
367
+
368
+ ## 🙏 Acknowledgments
369
+
370
+ xwlazy is built with inspiration from the Python lazy import ecosystem, particularly:
371
+ - `lazy-imports-lite` for keyword-based detection concept
372
+ - `lazy-loader` for scientific Python patterns
373
+ - The broader Python import system for hook mechanisms
374
+
375
+ ---
376
+
377
+ **Part of the eXonware ecosystem** - Enterprise-grade Python libraries for modern software development.
378
+
379
+ *Version: 0.1.0.12 | Last Updated: 17-Nov-2025*
380
+
@@ -0,0 +1,20 @@
1
+ exonware/xwlazy/__init__.py,sha256=uS0FTfM1r1FqcM2C6FrLgFARp-drdMxnJOg5XATAM3U,1674
2
+ exonware/xwlazy/version.py,sha256=E5aVPnT4mfjNCGF4IEs45FOFv_vH_RspxZBtW_y8je8,2351
3
+ xwlazy/__init__.py,sha256=kMokTnTWqht1Rr4VgPfxpjp6BYQ0Pziu3rpXw93-57k,608
4
+ xwlazy/version.py,sha256=HB5UxTEw9CUiCDNVgFLHpMuojbuugXVR7kXQhdJOy9E,2351
5
+ xwlazy/lazy/__init__.py,sha256=VhBEqwhR_GUrdn5400KWS28pX7T36kqTz9p2QgxqrXA,7361
6
+ xwlazy/lazy/bootstrap.py,sha256=okGe1f30qPXC7uyz7rnY6wzan3Mkt6Z5sukyPfZK4kQ,3721
7
+ xwlazy/lazy/config.py,sha256=Wb6YMqYJT4Car79i8tvFptKlDT-15tplWeZZ2IMfZzY,5344
8
+ xwlazy/lazy/host_conf.py,sha256=w_bT8VQEOtrf8oR-rY08dxB-k-Y7nMWt2mlOiZcVaxI,11377
9
+ xwlazy/lazy/host_packages.py,sha256=7b4XmfcbSHE68aFeXgAp3ELEG0t9poa73MRULzQmtGY,4059
10
+ xwlazy/lazy/lazy_base.py,sha256=mtIq3F4LdH7IIxm0Tizma_4nkxwVVJ7IcwAPmLWqYls,13919
11
+ xwlazy/lazy/lazy_contracts.py,sha256=6GZj3svH4Tsb74Syjh0hKgkMuNGDfGCTVb4QNI9T7dM,7573
12
+ xwlazy/lazy/lazy_core.py,sha256=_FwYz140ueeRgFrQAk0K5xdmKyEcHsfYtBgzytrQ6nI,145139
13
+ xwlazy/lazy/lazy_errors.py,sha256=0ttYzcquv0jAd6cfO2be77sRHWuTPjW8KDQFQ-4JQWo,8642
14
+ xwlazy/lazy/lazy_state.py,sha256=a_pOIDI6apbpu3xWvnofyM3vReV49CXiZmplkpWATmE,3118
15
+ xwlazy/lazy/logging_utils.py,sha256=n2AkfQfFkUxlpAZyRNllwZTFrLfI0HD73ULw-AqQUCo,5830
16
+ xwlazy/lazy/manifest.py,sha256=GCExV9EDOQ3HGIwVp-9wUk5MPUnJGYGKGS7CREPHubU,18497
17
+ exonware_xwlazy-0.1.0.11.dist-info/METADATA,sha256=i77J_GYb3myTc0VCx_P96up0ZjSSaIQvkYF6RQMGb3U,13759
18
+ exonware_xwlazy-0.1.0.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
19
+ exonware_xwlazy-0.1.0.11.dist-info/licenses/LICENSE,sha256=w42ohoEUfhyT0NgiivAL4fWg2AMRLGnfXPMAR4EO-MU,1094
20
+ exonware_xwlazy-0.1.0.11.dist-info/RECORD,,
xwlazy/__init__.py ADDED
@@ -0,0 +1,34 @@
1
+ """
2
+ Top-level xwlazy package exposing lazy runtime utilities.
3
+ """
4
+
5
+ from .version import (
6
+ __version__,
7
+ VERSION_MAJOR,
8
+ VERSION_MINOR,
9
+ VERSION_PATCH,
10
+ VERSION_BUILD,
11
+ VERSION_SUFFIX,
12
+ VERSION_STRING,
13
+ get_version,
14
+ get_version_info,
15
+ get_version_dict,
16
+ is_dev_version,
17
+ is_release_version,
18
+ )
19
+
20
+ __all__ = [
21
+ "__version__",
22
+ "VERSION_MAJOR",
23
+ "VERSION_MINOR",
24
+ "VERSION_PATCH",
25
+ "VERSION_BUILD",
26
+ "VERSION_SUFFIX",
27
+ "VERSION_STRING",
28
+ "get_version",
29
+ "get_version_info",
30
+ "get_version_dict",
31
+ "is_dev_version",
32
+ "is_release_version",
33
+ ]
34
+