xwlazy 0.1.0.1__py3-none-any.whl → 0.1.0.8__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.
README.md CHANGED
Binary file
Binary file
@@ -0,0 +1,5 @@
1
+ README.md,sha256=i0x5I62gQzMkUhxAGelCahuZdkQ3eywHW67_ivqvulU,28
2
+ xwlazy-0.1.0.8.dist-info/METADATA,sha256=yj2EEB6KsYX1zPGFBGjbuWsCr2xnoBhrdX8mPxxXqWs,1116
3
+ xwlazy-0.1.0.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
+ xwlazy-0.1.0.8.dist-info/licenses/LICENSE,sha256=w42ohoEUfhyT0NgiivAL4fWg2AMRLGnfXPMAR4EO-MU,1094
5
+ xwlazy-0.1.0.8.dist-info/RECORD,,
src/xwlazy_wrapper.py DELETED
@@ -1,20 +0,0 @@
1
- """
2
- xwlazy Wrapper Package
3
-
4
- This is a convenience wrapper that provides 'import xwlazy' functionality.
5
- The actual implementation is in the exonware-xwlazy package.
6
-
7
- Company: eXonware.com
8
- Author: Eng. Muhammad AlShehri
9
- Email: connect@exonware.com
10
- Generation Date: 10-Oct-2025
11
- """
12
-
13
- # This wrapper package depends on exonware-xwlazy
14
- # When you pip install xwlazy, it automatically installs exonware-xwlazy
15
- # Both import paths then work:
16
- # - import xwlazy
17
- # - import exonware.xwlazy
18
-
19
- __all__ = []
20
-
@@ -1,454 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: xwlazy
3
- Version: 0.1.0.1
4
- Summary: Convenience wrapper for exonware-xwlazy - provides 'import xwlazy' alias
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.12
19
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
- Requires-Python: >=3.12
21
- Requires-Dist: exonware-xwlazy
22
- Description-Content-Type: text/markdown
23
-
24
- # xwlazy
25
-
26
- **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.**
27
-
28
- [![Status](https://img.shields.io/badge/status-beta-blue.svg)](https://exonware.com)
29
- [![Python](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://www.python.org)
30
- [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
31
-
32
- ## 🎯 Overview
33
-
34
- 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.
35
-
36
- **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.
37
-
38
- ## ✨ Key Features
39
-
40
- ### 🚀 **Auto-Installation on Demand**
41
- Dependencies are automatically installed when code first uses them—no manual intervention required. Perfect for optional features that users may never need.
42
-
43
- **Why it matters:** Reduces initial installation size by 60-80% for packages with many optional dependencies, while maintaining zero overhead for successful imports.
44
-
45
- ### 🔒 **Per-Package Isolation**
46
- Each package (xwsystem, xwnode, xwdata, etc.) can independently enable lazy mode without affecting others. Complete isolation prevents conflicts and enables flexible deployment strategies.
47
-
48
- **Why it matters:** Allows mixing lazy and non-lazy packages in the same environment, giving developers full control over which packages use auto-installation.
49
-
50
- ### 🎯 **Keyword-Based Auto-Detection**
51
- Packages can opt-in to lazy loading by simply adding `"xwlazy-enabled"` to their `pyproject.toml` keywords—no code changes required.
52
-
53
- **Why it matters:** Zero-code integration for package maintainers. Just add a keyword and lazy loading works automatically.
54
-
55
- ### 🛡️ **Enterprise Security**
56
- - **Allow/Deny Lists:** Whitelist or blacklist specific packages
57
- - **SBOM Generation:** Software Bill of Materials for compliance
58
- - **Vulnerability Auditing:** Automatic security scanning with pip-audit
59
- - **Lockfile Management:** Track installed packages with versions
60
- - **PEP 668 Compliance:** Respects externally-managed environments
61
-
62
- **Why it matters:** Production environments require security controls. xwlazy provides enterprise-grade security without sacrificing usability.
63
-
64
- ### ⚡ **Two-Stage Lazy Loading**
65
- **Stage 1 (Import Time):** Missing imports are logged but don't raise errors—modules load successfully.
66
- **Stage 2 (Usage Time):** Dependencies are installed automatically when code first accesses them.
67
-
68
- **Why it matters:** Enables clean Python code with standard imports. No defensive `try/except ImportError` blocks needed.
69
-
70
- ### 📊 **Performance Monitoring**
71
- Built-in tracking of module load times, access counts, memory usage, and cache hit ratios. Comprehensive statistics API for optimization.
72
-
73
- **Why it matters:** Visibility into lazy loading performance helps identify bottlenecks and optimize import strategies.
74
-
75
- ### 🎨 **Two-Dimensional Mode System**
76
-
77
- 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.
78
-
79
- #### **Lazy Load Modes** (When modules load)
80
- - **NONE:** Standard imports (no lazy loading)
81
- - **AUTO:** Lazy loading enabled (deferred module loading)
82
- - **PRELOAD:** Preload all modules on start (parallel loading)
83
- - **BACKGROUND:** Load modules in background threads (non-blocking)
84
- - **CACHED:** Cache loaded modules but allow unloading
85
-
86
- #### **Lazy Install Modes** (When packages install)
87
- - **NONE:** No auto-installation
88
- - **SMART:** Install on first usage (on-demand)
89
- - **FULL:** Install all dependencies on start (parallel batch)
90
- - **CLEAN:** Install on usage + uninstall after completion
91
- - **TEMPORARY:** Always uninstall after use (aggressive cleanup)
92
- - **SIZE_AWARE:** Install small packages, skip large ones
93
- - **INTERACTIVE:** Ask user before installing
94
- - **WARN:** Log warning but don't install (monitoring mode)
95
- - **DISABLED:** Don't install anything (explicit)
96
- - **DRY_RUN:** Show what would be installed
97
-
98
- #### **Preset Modes** (Quick combinations)
99
- - **none:** NONE load + NONE install (standard imports)
100
- - **lite:** AUTO load + NONE install (lazy loading only)
101
- - **smart:** AUTO load + SMART install (on-demand installation)
102
- - **full:** AUTO load + FULL install (install all on start)
103
- - **clean:** AUTO load + CLEAN install (install + cleanup)
104
- - **temporary:** AUTO load + TEMPORARY install (aggressive cleanup)
105
- - **size_aware:** AUTO load + SIZE_AWARE install (smart sizing)
106
- - **auto:** AUTO load + SMART install + auto-uninstall large packages
107
-
108
- **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`.
109
-
110
- ## 🏆 Performance Benchmarks
111
-
112
- xwlazy has been benchmarked against 8 competing lazy import libraries. **Results show xwlazy is competitive across all load scenarios** while providing significantly more features.
113
-
114
- ### Latest Benchmark Results (2025-11-17)
115
-
116
- | Load Type | xwlazy Time | Rank | vs. Winner | Features |
117
- |-----------|-------------|------|------------|----------|
118
- | **Light Load** (1 module) | 2.08 ms | 🥇 **1st** | 2.54x faster | 7 features |
119
- | **Medium Load** (8 modules) | 6.99 ms | 🥇 **1st** | 8.52x faster | 7 features |
120
- | **Heavy Load** (22 modules) | 21.13 ms | 🥇 **1st** | 25.75x faster | 7 features |
121
- | **Enterprise Load** (50+ modules) | 61.28 ms | 🥇 **1st** | 74.66x faster | 7 features |
122
-
123
- **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.
124
-
125
- **See full benchmarks:** [benchmarks/competition_tests/output_log/](benchmarks/competition_tests/output_log/)
126
-
127
- ## 🚀 Quick Start
128
-
129
- ### Installation
130
-
131
- ```bash
132
- # Standard installation
133
- pip install exonware-xwlazy
134
-
135
- # Or install as xwlazy (alias package)
136
- pip install xwlazy
137
- ```
138
-
139
- ### Basic Usage
140
-
141
- **One-line setup** for per-package lazy loading:
142
-
143
- ```python
144
- # In your package's __init__.py
145
- from xwlazy.lazy import config_package_lazy_install_enabled
146
-
147
- # Auto-detects from pip install your-package[lazy]
148
- config_package_lazy_install_enabled("your-package")
149
- ```
150
-
151
- **That's it!** Now use standard imports—missing dependencies install automatically:
152
-
153
- ```python
154
- # your-package/serialization/avro.py
155
- import fastavro # Auto-installed if missing! ✨
156
-
157
- # User code
158
- from your-package.serialization.avro import AvroSerializer
159
- serializer = AvroSerializer() # Installs fastavro on first use
160
- ```
161
-
162
- ### Keyword-Based Detection (Zero Code)
163
-
164
- Add to your `pyproject.toml`:
165
-
166
- ```toml
167
- [project]
168
- name = "my-package"
169
- keywords = ["xwlazy-enabled"] # <-- Add this
170
- ```
171
-
172
- After `pip install -e .`, xwlazy automatically enables lazy loading for your package—no code changes needed!
173
-
174
- ## 📖 Documentation
175
-
176
- - **[Architecture Reference](docs/REF_ARCH.md)** - System design, patterns, and structure
177
- - **[Keyword Detection Guide](docs/KEYWORD_DETECTION.md)** - Zero-code integration
178
- - **[Competition Benchmarks](benchmarks/competition_tests/)** - Performance comparisons
179
- - **[Performance Analysis](benchmarks/competition_tests/PERFORMANCE_ANALYSIS.md)** - Optimization recommendations
180
-
181
- ## 💡 Use Cases
182
-
183
- ### 1. Optional Format Support
184
-
185
- ```python
186
- # xwsystem/serialization/avro.py
187
- import fastavro # Only installed if user needs Avro support
188
-
189
- class AvroSerializer:
190
- def serialize(self, data):
191
- return fastavro.schemaless_writer(...)
192
- ```
193
-
194
- **Benefit:** Users who never use Avro don't install fastavro, reducing installation size.
195
-
196
- ### 2. Development Tools
197
-
198
- ```python
199
- # xwnode/visualization/graphviz.py
200
- import graphviz # Only installed in development
201
-
202
- def visualize_graph(node):
203
- return graphviz.render(...)
204
- ```
205
-
206
- **Benefit:** Production deployments don't include development-only dependencies.
207
-
208
- ### 3. Platform-Specific Features
209
-
210
- ```python
211
- # xwdata/formats/excel.py
212
- try:
213
- import openpyxl # Windows/Linux
214
- except ImportError:
215
- import xlrd # macOS fallback
216
- ```
217
-
218
- **Benefit:** Platform-specific dependencies install automatically based on availability.
219
-
220
- ### 4. Security-Controlled Environments
221
-
222
- ```python
223
- from xwlazy.lazy import (
224
- config_package_lazy_install_enabled,
225
- set_package_allow_list,
226
- )
227
-
228
- # Only allow specific packages
229
- config_package_lazy_install_enabled("xwsystem")
230
- set_package_allow_list("xwsystem", ["fastavro", "protobuf", "msgpack"])
231
-
232
- # Attempts to install other packages are blocked
233
- import suspicious_package # ❌ Blocked by security policy
234
- ```
235
-
236
- **Benefit:** Enterprise environments can restrict auto-installation to approved packages only.
237
-
238
- ## 🔧 Advanced Configuration
239
-
240
- ### Two-Dimensional Mode Configuration
241
-
242
- #### Using Preset Modes (Recommended)
243
-
244
- ```python
245
- from xwlazy.lazy import config_package_lazy_install_enabled
246
-
247
- # Quick preset modes
248
- config_package_lazy_install_enabled("xwsystem", enabled=True, mode="smart") # On-demand install
249
- config_package_lazy_install_enabled("xwsystem", enabled=True, mode="full") # Install all on start
250
- config_package_lazy_install_enabled("xwsystem", enabled=True, mode="clean") # Install + cleanup
251
- config_package_lazy_install_enabled("xwsystem", enabled=True, mode="lite") # Lazy load only
252
- ```
253
-
254
- #### Using Explicit Mode Configuration
255
-
256
- ```python
257
- from xwlazy.lazy import (
258
- config_package_lazy_install_enabled,
259
- LazyLoadMode,
260
- LazyInstallMode,
261
- LazyModeConfig,
262
- )
263
-
264
- # Explicit two-dimensional configuration
265
- config_package_lazy_install_enabled(
266
- "xwsystem",
267
- enabled=True,
268
- load_mode=LazyLoadMode.PRELOAD, # Preload all modules
269
- install_mode=LazyInstallMode.SMART # Install on-demand
270
- )
271
-
272
- # Or use LazyModeConfig for full control
273
- config = LazyModeConfig(
274
- load_mode=LazyLoadMode.BACKGROUND,
275
- install_mode=LazyInstallMode.SIZE_AWARE,
276
- large_package_threshold_mb=100.0, # Skip packages > 100MB
277
- background_workers=4 # 4 background workers
278
- )
279
- config_package_lazy_install_enabled(
280
- "xwsystem",
281
- enabled=True,
282
- mode_config=config
283
- )
284
- ```
285
-
286
- #### Using exonware.conf (Global Configuration)
287
-
288
- ```python
289
- import exonware.conf as conf
290
-
291
- # Set global lazy mode for all packages
292
- conf.lazy = "smart" # or "lite", "full", "clean", "auto", etc.
293
- ```
294
-
295
- #### Special Purpose Modes
296
-
297
- ```python
298
- # Interactive mode: Ask user before installing
299
- config_package_lazy_install_enabled(
300
- "xwsystem",
301
- enabled=True,
302
- mode="interactive" # or LazyInstallMode.INTERACTIVE
303
- )
304
-
305
- # Warn mode: Log but don't install (monitoring)
306
- config_package_lazy_install_enabled(
307
- "xwsystem",
308
- enabled=True,
309
- mode="warn" # or LazyInstallMode.WARN
310
- )
311
- ```
312
-
313
- ### Security Policies
314
-
315
- ```python
316
- from xwlazy.lazy import (
317
- set_package_allow_list,
318
- set_package_deny_list,
319
- set_package_lockfile,
320
- )
321
-
322
- # Whitelist approach
323
- set_package_allow_list("xwsystem", ["fastavro", "protobuf"])
324
-
325
- # Blacklist approach
326
- set_package_deny_list("xwsystem", ["suspicious-package"])
327
-
328
- # Track installations
329
- set_package_lockfile("xwsystem", "xwsystem-lazy-lock.json")
330
- ```
331
-
332
- ### SBOM Generation
333
-
334
- ```python
335
- from xwlazy.lazy import generate_package_sbom
336
-
337
- # Generate Software Bill of Materials for compliance
338
- sbom = generate_package_sbom("xwsystem", "xwsystem-sbom.json")
339
- ```
340
-
341
- ### Statistics and Monitoring
342
-
343
- ```python
344
- from xwlazy.lazy import get_lazy_install_stats
345
-
346
- # Get installation statistics
347
- stats = get_lazy_install_stats("xwsystem")
348
- # {
349
- # 'enabled': True,
350
- # 'mode': 'auto',
351
- # 'installed_packages': ['fastavro', 'protobuf'],
352
- # 'failed_packages': [],
353
- # 'total_installed': 2
354
- # }
355
- ```
356
-
357
- ## 🎨 Design Patterns
358
-
359
- xwlazy implements 8 design patterns for maintainability and extensibility:
360
-
361
- 1. **Facade Pattern** - Unified API to complex subsystems
362
- 2. **Strategy Pattern** - Pluggable discovery/installation strategies
363
- 3. **Template Method** - Base classes define common workflows
364
- 4. **Singleton** - Global instances for system-wide state
365
- 5. **Registry** - Per-package isolation and management
366
- 6. **Observer** - Performance monitoring and tracking
367
- 7. **Proxy** - Deferred loading and lazy access
368
- 8. **Factory** - Creating appropriate handlers by context
369
-
370
- ## 🔒 Security Considerations
371
-
372
- ### PEP 668 Compliance
373
- xwlazy respects externally-managed Python environments and refuses to install in system Python, suggesting virtual environments instead.
374
-
375
- ### System Module Protection
376
- Built-in modules (stdlib) are never auto-installed, preventing accidental system modifications.
377
-
378
- ### Vulnerability Scanning
379
- Optional pip-audit integration scans packages after installation and logs security warnings.
380
-
381
- ### Custom PyPI Mirrors
382
- Support for internal PyPI servers with custom index URLs and trusted hosts.
383
-
384
- ## ⚡ Performance Characteristics
385
-
386
- - **Zero overhead** for successful imports (hooks only trigger on failures)
387
- - **Aggressive caching** with file modification time checks
388
- - **Lazy initialization** - everything loads only when needed
389
- - **Thread-safe** operations with proper locking
390
- - **Import overhead:** ~0.1ms for successful imports
391
- - **First failure:** ~50ms (discovery + policy check)
392
- - **Subsequent failures:** ~5ms (cached discovery)
393
-
394
- ## 🧪 Testing
395
-
396
- xwlazy includes comprehensive test suites:
397
-
398
- ```bash
399
- # Run all tests
400
- python tests/runner.py
401
-
402
- # Run specific test layers
403
- python tests/0.core/runner.py # Core tests (< 30s)
404
- python tests/1.unit/runner.py # Unit tests (< 5m)
405
- ```
406
-
407
- ## 📊 Comparison with Competitors
408
-
409
- | Feature | xwlazy | lazy-imports-lite | lazy-loader | lazy_import |
410
- |---------|--------|-------------------|-------------|-------------|
411
- | **Lazy Import** | ✅ | ✅ | ✅ | ✅ |
412
- | **Auto-Installation** | ✅ | ❌ | ❌ | ❌ |
413
- | **Keyword Detection** | ✅ | ✅ | ❌ | ❌ |
414
- | **Per-Package Isolation** | ✅ | ❌ | ❌ | ❌ |
415
- | **Security Policies** | ✅ | ❌ | ❌ | ❌ |
416
- | **SBOM Generation** | ✅ | ❌ | ❌ | ❌ |
417
- | **Performance Monitoring** | ✅ | ❌ | ❌ | ❌ |
418
- | **Two-Stage Loading** | ✅ | ❌ | ❌ | ❌ |
419
- | **Total Features** | **7** | **2** | **1** | **1** |
420
-
421
- ## 🤝 Contributing
422
-
423
- xwlazy is part of the eXonware ecosystem. For contributions, please follow:
424
-
425
- - [Development Guide](../../docs/guides/GUIDE_DEV.md) - Core development standards
426
- - [Testing Guide](../../docs/guides/GUIDE_TEST.md) - Testing standards
427
- - [Documentation Guide](../../docs/guides/GUIDE_DOCS.md) - Documentation standards
428
-
429
- ## 📄 License
430
-
431
- MIT License - see [LICENSE](LICENSE) for details.
432
-
433
- ## 🔗 Links
434
-
435
- - **Homepage:** https://exonware.com
436
- - **Repository:** https://github.com/exonware/xwlazy
437
- - **Email:** connect@exonware.com
438
- - **Author:** Eng. Muhammad AlShehri
439
-
440
- ## 🙏 Acknowledgments
441
-
442
- xwlazy is built with inspiration from the Python lazy import ecosystem, particularly:
443
- - `lazy-imports-lite` for keyword-based detection concept
444
- - `lazy-loader` for scientific Python patterns
445
- - The broader Python import system for hook mechanisms
446
-
447
- ---
448
-
449
- **Part of the eXonware ecosystem** - Enterprise-grade Python libraries for modern software development.
450
-
451
- *Last Updated: 17-Nov-2025*
452
-
453
- > **Note:** For the current version, use `from exonware.xwlazy import __version__` or `import exonware.xwlazy; print(exonware.xwlazy.__version__)`
454
-
@@ -1,6 +0,0 @@
1
- README.md,sha256=_TPNldwgooH5cGTNpt1GFAQTtrYM5yS-AFc0fy1VfdE,15672
2
- src/xwlazy_wrapper.py,sha256=qYc2lJ5WZdSxgBhHrEUC39KHSmWl5YGqirw_ro4WhpE,498
3
- xwlazy-0.1.0.1.dist-info/METADATA,sha256=57uPbcauFmQb-yYD0pwp2COgB7mObxDP2UYQJ7AxPXg,16622
4
- xwlazy-0.1.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
5
- xwlazy-0.1.0.1.dist-info/licenses/LICENSE,sha256=w42ohoEUfhyT0NgiivAL4fWg2AMRLGnfXPMAR4EO-MU,1094
6
- xwlazy-0.1.0.1.dist-info/RECORD,,