exonware-xwlazy 0.1.0.22__py3-none-any.whl → 1.0.1.2__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.
Files changed (90) hide show
  1. exonware/__init__.py +86 -16
  2. exonware/xwlazy/version.py +5 -5
  3. exonware/xwlazy.py +2546 -0
  4. exonware/xwlazy_external_libs.toml +716 -0
  5. {exonware_xwlazy-0.1.0.22.dist-info → exonware_xwlazy-1.0.1.2.dist-info}/METADATA +6 -6
  6. exonware_xwlazy-1.0.1.2.dist-info/RECORD +8 -0
  7. exonware/xwlazy/__init__.py +0 -367
  8. exonware/xwlazy/common/__init__.py +0 -47
  9. exonware/xwlazy/common/base.py +0 -56
  10. exonware/xwlazy/common/cache.py +0 -504
  11. exonware/xwlazy/common/logger.py +0 -257
  12. exonware/xwlazy/common/services/__init__.py +0 -72
  13. exonware/xwlazy/common/services/dependency_mapper.py +0 -232
  14. exonware/xwlazy/common/services/install_async_utils.py +0 -165
  15. exonware/xwlazy/common/services/install_cache_utils.py +0 -245
  16. exonware/xwlazy/common/services/keyword_detection.py +0 -283
  17. exonware/xwlazy/common/services/spec_cache.py +0 -165
  18. exonware/xwlazy/common/services/state_manager.py +0 -84
  19. exonware/xwlazy/common/strategies/__init__.py +0 -28
  20. exonware/xwlazy/common/strategies/caching_dict.py +0 -44
  21. exonware/xwlazy/common/strategies/caching_installation.py +0 -88
  22. exonware/xwlazy/common/strategies/caching_lfu.py +0 -66
  23. exonware/xwlazy/common/strategies/caching_lru.py +0 -63
  24. exonware/xwlazy/common/strategies/caching_multitier.py +0 -59
  25. exonware/xwlazy/common/strategies/caching_ttl.py +0 -59
  26. exonware/xwlazy/config.py +0 -193
  27. exonware/xwlazy/contracts.py +0 -1396
  28. exonware/xwlazy/defs.py +0 -378
  29. exonware/xwlazy/errors.py +0 -276
  30. exonware/xwlazy/facade.py +0 -991
  31. exonware/xwlazy/module/__init__.py +0 -18
  32. exonware/xwlazy/module/base.py +0 -565
  33. exonware/xwlazy/module/data.py +0 -17
  34. exonware/xwlazy/module/facade.py +0 -246
  35. exonware/xwlazy/module/importer_engine.py +0 -2117
  36. exonware/xwlazy/module/strategies/__init__.py +0 -22
  37. exonware/xwlazy/module/strategies/module_helper_lazy.py +0 -93
  38. exonware/xwlazy/module/strategies/module_helper_simple.py +0 -65
  39. exonware/xwlazy/module/strategies/module_manager_advanced.py +0 -111
  40. exonware/xwlazy/module/strategies/module_manager_simple.py +0 -95
  41. exonware/xwlazy/package/__init__.py +0 -18
  42. exonware/xwlazy/package/base.py +0 -798
  43. exonware/xwlazy/package/conf.py +0 -324
  44. exonware/xwlazy/package/data.py +0 -17
  45. exonware/xwlazy/package/facade.py +0 -480
  46. exonware/xwlazy/package/services/__init__.py +0 -84
  47. exonware/xwlazy/package/services/async_install_handle.py +0 -87
  48. exonware/xwlazy/package/services/config_manager.py +0 -245
  49. exonware/xwlazy/package/services/discovery.py +0 -370
  50. exonware/xwlazy/package/services/host_packages.py +0 -145
  51. exonware/xwlazy/package/services/install_async.py +0 -277
  52. exonware/xwlazy/package/services/install_cache.py +0 -145
  53. exonware/xwlazy/package/services/install_interactive.py +0 -59
  54. exonware/xwlazy/package/services/install_policy.py +0 -156
  55. exonware/xwlazy/package/services/install_registry.py +0 -54
  56. exonware/xwlazy/package/services/install_result.py +0 -17
  57. exonware/xwlazy/package/services/install_sbom.py +0 -153
  58. exonware/xwlazy/package/services/install_utils.py +0 -79
  59. exonware/xwlazy/package/services/installer_engine.py +0 -406
  60. exonware/xwlazy/package/services/lazy_installer.py +0 -718
  61. exonware/xwlazy/package/services/manifest.py +0 -496
  62. exonware/xwlazy/package/services/strategy_registry.py +0 -186
  63. exonware/xwlazy/package/strategies/__init__.py +0 -57
  64. exonware/xwlazy/package/strategies/package_discovery_file.py +0 -129
  65. exonware/xwlazy/package/strategies/package_discovery_hybrid.py +0 -84
  66. exonware/xwlazy/package/strategies/package_discovery_manifest.py +0 -101
  67. exonware/xwlazy/package/strategies/package_execution_async.py +0 -113
  68. exonware/xwlazy/package/strategies/package_execution_cached.py +0 -90
  69. exonware/xwlazy/package/strategies/package_execution_pip.py +0 -99
  70. exonware/xwlazy/package/strategies/package_execution_wheel.py +0 -106
  71. exonware/xwlazy/package/strategies/package_mapping_discovery_first.py +0 -100
  72. exonware/xwlazy/package/strategies/package_mapping_hybrid.py +0 -105
  73. exonware/xwlazy/package/strategies/package_mapping_manifest_first.py +0 -100
  74. exonware/xwlazy/package/strategies/package_policy_allow_list.py +0 -57
  75. exonware/xwlazy/package/strategies/package_policy_deny_list.py +0 -57
  76. exonware/xwlazy/package/strategies/package_policy_permissive.py +0 -46
  77. exonware/xwlazy/package/strategies/package_timing_clean.py +0 -67
  78. exonware/xwlazy/package/strategies/package_timing_full.py +0 -66
  79. exonware/xwlazy/package/strategies/package_timing_smart.py +0 -68
  80. exonware/xwlazy/package/strategies/package_timing_temporary.py +0 -66
  81. exonware/xwlazy/runtime/__init__.py +0 -18
  82. exonware/xwlazy/runtime/adaptive_learner.py +0 -129
  83. exonware/xwlazy/runtime/base.py +0 -274
  84. exonware/xwlazy/runtime/facade.py +0 -94
  85. exonware/xwlazy/runtime/intelligent_selector.py +0 -170
  86. exonware/xwlazy/runtime/metrics.py +0 -60
  87. exonware/xwlazy/runtime/performance.py +0 -37
  88. exonware_xwlazy-0.1.0.22.dist-info/RECORD +0 -87
  89. {exonware_xwlazy-0.1.0.22.dist-info → exonware_xwlazy-1.0.1.2.dist-info}/WHEEL +0 -0
  90. {exonware_xwlazy-0.1.0.22.dist-info → exonware_xwlazy-1.0.1.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: exonware-xwlazy
3
- Version: 0.1.0.22
3
+ Version: 1.0.1.2
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
@@ -15,13 +15,9 @@ Classifier: Intended Audience :: Developers
15
15
  Classifier: License :: OSI Approved :: MIT License
16
16
  Classifier: Operating System :: OS Independent
17
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
18
  Classifier: Programming Language :: Python :: 3.12
23
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
- Requires-Python: >=3.8
20
+ Requires-Python: >=3.12
25
21
  Requires-Dist: tomli>=2.0.1; python_version < '3.11'
26
22
  Description-Content-Type: text/markdown
27
23
 
@@ -178,6 +174,10 @@ After `pip install -e .`, xwlazy automatically enables lazy loading for your pac
178
174
  ## 📖 Documentation
179
175
 
180
176
  - **[Architecture Reference](docs/REF_ARCH.md)** - System design, patterns, and structure
177
+ - **[Integration Guide](docs/INTEGRATION_GUIDE.md)** - Integration with xw libraries
178
+ - **[Best Practices](docs/BEST_PRACTICES.md)** - Usage guidelines and recommendations
179
+ - **[Troubleshooting Guide](docs/TROUBLESHOOTING.md)** - Common issues and solutions
180
+ - **[Production Deployment](docs/PRODUCTION_DEPLOYMENT.md)** - Production deployment guide
181
181
  - **[Keyword Detection Guide](docs/KEYWORD_DETECTION.md)** - Zero-code integration
182
182
  - **[Competition Benchmarks](benchmarks/competition_tests/)** - Performance comparisons
183
183
  - **[Performance Analysis](benchmarks/competition_tests/PERFORMANCE_ANALYSIS.md)** - Optimization recommendations
@@ -0,0 +1,8 @@
1
+ exonware/__init__.py,sha256=pJ73geou9GfYyPqjK4AzPGIrVT3zU_Gvr2vt2ndkUhM,3774
2
+ exonware/xwlazy.py,sha256=5iAWriwqzmCqv68DLmw2fwm4whz6FLSNDn8hHk6TPBU,113036
3
+ exonware/xwlazy_external_libs.toml,sha256=-btpWbrLeXC-0ojFD8lJl_kNT5V_ZYbk5ZqSAUrsdjs,17965
4
+ exonware/xwlazy/version.py,sha256=1FTi6sQR_qQoHLHVMX6Mz8xbwdwpQbZwaSuYUFNvV3w,2349
5
+ exonware_xwlazy-1.0.1.2.dist-info/METADATA,sha256=GPeqvBdqeban3zpr3MiOjw_Rg0kgQmClicx9vdikopo,17004
6
+ exonware_xwlazy-1.0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ exonware_xwlazy-1.0.1.2.dist-info/licenses/LICENSE,sha256=w42ohoEUfhyT0NgiivAL4fWg2AMRLGnfXPMAR4EO-MU,1094
8
+ exonware_xwlazy-1.0.1.2.dist-info/RECORD,,
@@ -1,367 +0,0 @@
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
- Generation Date: 10-Oct-2025
14
-
15
- Main Features:
16
- - Automatic dependency discovery from pyproject.toml and requirements.txt
17
- - On-demand package installation via import hooks
18
- - Two-stage lazy loading for optimal performance
19
- - Per-package lazy mode configuration
20
- - Security policies and allow/deny lists
21
- - SBOM generation and lockfile management
22
-
23
- Example:
24
- >>> from exonware.xwlazy import enable_lazy_mode, xwimport
25
- >>>
26
- >>> # Enable lazy mode for your package
27
- >>> enable_lazy_mode(package_name="my_package", lazy_install_mode="smart")
28
- >>>
29
- >>> # Import with automatic installation
30
- >>> pandas = xwimport("pandas") # Installs pandas if not available
31
- """
32
-
33
- # =============================================================================
34
- # VERSION
35
- # =============================================================================
36
-
37
- from .version import (
38
- __version__,
39
- VERSION_MAJOR,
40
- VERSION_MINOR,
41
- VERSION_PATCH,
42
- VERSION_BUILD,
43
- VERSION_SUFFIX,
44
- VERSION_STRING,
45
- get_version,
46
- get_version_info,
47
- get_version_dict,
48
- is_dev_version,
49
- is_release_version,
50
- )
51
-
52
- # =============================================================================
53
- # IMPORTS - Standard Python Imports (No Defensive Code!)
54
- # =============================================================================
55
-
56
- # Import from facade - provides unified public API
57
- from .facade import (
58
- # Facade functions
59
- enable_lazy_mode,
60
- disable_lazy_mode,
61
- is_lazy_mode_enabled,
62
- get_lazy_mode_stats,
63
- configure_lazy_mode,
64
- preload_modules,
65
- optimize_lazy_mode,
66
- # Public API functions
67
- enable_lazy_install,
68
- disable_lazy_install,
69
- is_lazy_install_enabled,
70
- set_lazy_install_mode,
71
- get_lazy_install_mode,
72
- install_missing_package,
73
- install_and_import,
74
- get_lazy_install_stats,
75
- get_all_lazy_install_stats,
76
- lazy_import_with_install,
77
- xwimport,
78
- # Hook functions
79
- install_import_hook,
80
- uninstall_import_hook,
81
- is_import_hook_installed,
82
- # Lazy loading functions
83
- enable_lazy_imports,
84
- disable_lazy_imports,
85
- is_lazy_import_enabled,
86
- lazy_import,
87
- register_lazy_module,
88
- preload_module,
89
- get_lazy_module,
90
- get_loading_stats,
91
- preload_frequently_used,
92
- get_lazy_import_stats,
93
- # Configuration
94
- config_package_lazy_install_enabled,
95
- config_module_lazy_load_enabled,
96
- sync_manifest_configuration,
97
- refresh_lazy_manifests,
98
- # Security & Policy
99
- set_package_allow_list,
100
- set_package_deny_list,
101
- add_to_package_allow_list,
102
- add_to_package_deny_list,
103
- set_package_index_url,
104
- set_package_extra_index_urls,
105
- add_package_trusted_host,
106
- set_package_lockfile,
107
- generate_package_sbom,
108
- check_externally_managed_environment,
109
- register_lazy_module_prefix,
110
- register_lazy_module_methods,
111
- # Keyword-based detection
112
- enable_keyword_detection,
113
- is_keyword_detection_enabled,
114
- get_keyword_detection_keyword,
115
- check_package_keywords,
116
- # Discovery functions
117
- get_lazy_discovery,
118
- discover_dependencies,
119
- export_dependency_mappings,
120
- )
121
-
122
- # Import contracts and base for advanced usage
123
- from .defs import PRESET_MODES, get_preset_mode
124
- from .defs import (
125
- LazyLoadMode,
126
- LazyInstallMode,
127
- PathType,
128
- DependencyInfo,
129
- LazyModeConfig,
130
- )
131
- from .contracts import (
132
- IPackageHelper,
133
- IModuleHelper,
134
- IRuntime,
135
- )
136
-
137
- # Import errors
138
- from .errors import (
139
- LazySystemError,
140
- LazyInstallError,
141
- LazyDiscoveryError,
142
- LazyHookError,
143
- LazySecurityError,
144
- ExternallyManagedError,
145
- DeferredImportError,
146
- )
147
-
148
- # Import config
149
- from .config import LazyConfig, DEFAULT_LAZY_CONFIG
150
-
151
- # Import abstract base classes directly from submodules
152
- from .package.base import APackageHelper
153
- from .module.base import AModuleHelper
154
- from .runtime.base import ARuntimeHelper
155
-
156
- # Import concrete implementations (lazy to prevent circular imports)
157
- from typing import Any
158
-
159
- def __getattr__(name: str) -> Any:
160
- """Lazy import for concrete facades to prevent circular dependencies."""
161
- if name == "XWPackageHelper":
162
- from .package import XWPackageHelper
163
- return XWPackageHelper
164
- elif name == "XWModuleHelper":
165
- from .module import XWModuleHelper
166
- return XWModuleHelper
167
- elif name == "XWRuntimeHelper":
168
- from .runtime import XWRuntimeHelper
169
- return XWRuntimeHelper
170
- raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
171
-
172
- # Import core classes for advanced usage
173
- from .package.services.config_manager import LazyInstallConfig
174
- from .package.services import LazyInstallerRegistry, AsyncInstallHandle, LazyInstaller
175
- from .common.services.dependency_mapper import DependencyMapper
176
- from .module.importer_engine import (
177
- LazyMetaPathFinder,
178
- WatchedPrefixRegistry,
179
- LazyLoader,
180
- )
181
- from .package.services.manifest import LazyManifestLoader, PackageManifest
182
- from .facade import _lazy_importer
183
-
184
- # Import internal utilities (for advanced usage)
185
- from .common.services import (
186
- check_package_keywords,
187
- _detect_lazy_installation,
188
- _detect_meta_info_mode,
189
- )
190
- from .module.importer_engine import (
191
- _set_package_class_hints,
192
- _get_package_class_hints,
193
- _clear_all_package_class_hints,
194
- _spec_for_existing_module,
195
- )
196
- from .common.services.spec_cache import (
197
- _cached_stdlib_check,
198
- _spec_cache_get,
199
- _spec_cache_put,
200
- _spec_cache_clear,
201
- _cache_spec_if_missing,
202
- _spec_cache_prune_locked,
203
- )
204
- from .package.services import (
205
- is_externally_managed as _is_externally_managed,
206
- check_pip_audit_available as _check_pip_audit_available,
207
- )
208
- from .module.importer_engine import (
209
- _is_import_in_progress,
210
- _mark_import_started,
211
- _mark_import_finished,
212
- _lazy_aware_import_module,
213
- _patch_import_module,
214
- _unpatch_import_module,
215
- )
216
-
217
- # Version info
218
- __author__ = 'Eng. Muhammad AlShehri'
219
- __email__ = 'connect@exonware.com'
220
- __company__ = 'eXonware.com'
221
-
222
- # =============================================================================
223
- # PUBLIC API
224
- # =============================================================================
225
-
226
- __all__ = [
227
- # Version
228
- "__version__",
229
- "VERSION_MAJOR",
230
- "VERSION_MINOR",
231
- "VERSION_PATCH",
232
- "VERSION_BUILD",
233
- "VERSION_SUFFIX",
234
- "VERSION_STRING",
235
- "get_version",
236
- "get_version_info",
237
- "get_version_dict",
238
- "is_dev_version",
239
- "is_release_version",
240
- # Facade functions
241
- "enable_lazy_mode",
242
- "disable_lazy_mode",
243
- "is_lazy_mode_enabled",
244
- "get_lazy_mode_stats",
245
- "configure_lazy_mode",
246
- "preload_modules",
247
- "optimize_lazy_mode",
248
- # Public API functions
249
- "enable_lazy_install",
250
- "disable_lazy_install",
251
- "is_lazy_install_enabled",
252
- "set_lazy_install_mode",
253
- "get_lazy_install_mode",
254
- "install_missing_package",
255
- "install_and_import",
256
- "get_lazy_install_stats",
257
- "get_all_lazy_install_stats",
258
- "lazy_import_with_install",
259
- "xwimport",
260
- # Hook functions
261
- "install_import_hook",
262
- "uninstall_import_hook",
263
- "is_import_hook_installed",
264
- # Lazy loading functions
265
- "enable_lazy_imports",
266
- "disable_lazy_imports",
267
- "is_lazy_import_enabled",
268
- "lazy_import",
269
- "register_lazy_module",
270
- "preload_module",
271
- "get_lazy_module",
272
- "get_loading_stats",
273
- "preload_frequently_used",
274
- "get_lazy_import_stats",
275
- # Configuration
276
- "config_package_lazy_install_enabled",
277
- "sync_manifest_configuration",
278
- "refresh_lazy_manifests",
279
- # Security & Policy
280
- "set_package_allow_list",
281
- "set_package_deny_list",
282
- "add_to_package_allow_list",
283
- "add_to_package_deny_list",
284
- "set_package_index_url",
285
- "set_package_extra_index_urls",
286
- "add_package_trusted_host",
287
- "set_package_lockfile",
288
- "generate_package_sbom",
289
- "check_externally_managed_environment",
290
- "register_lazy_module_prefix",
291
- "register_lazy_module_methods",
292
- # Keyword-based detection
293
- "enable_keyword_detection",
294
- "is_keyword_detection_enabled",
295
- "get_keyword_detection_keyword",
296
- "check_package_keywords",
297
- # Discovery functions
298
- "get_lazy_discovery",
299
- "discover_dependencies",
300
- "export_dependency_mappings",
301
- # Contracts
302
- "LazyLoadMode",
303
- "LazyInstallMode",
304
- "PathType",
305
- "DependencyInfo",
306
- "LazyModeConfig",
307
- "PRESET_MODES",
308
- "get_preset_mode",
309
- "IPackageHelper",
310
- "IModuleHelper",
311
- "IRuntime",
312
- # Abstract base classes
313
- "APackageHelper",
314
- "AModuleHelper",
315
- "ARuntimeHelper",
316
- # Concrete implementations
317
- "XWPackageHelper",
318
- "XWModuleHelper",
319
- "XWRuntimeHelper",
320
- # Errors
321
- "LazySystemError",
322
- "LazyInstallError",
323
- "LazyDiscoveryError",
324
- "LazyHookError",
325
- "LazySecurityError",
326
- "ExternallyManagedError",
327
- "DeferredImportError",
328
- # Config
329
- "LazyConfig",
330
- "DEFAULT_LAZY_CONFIG",
331
- # Core classes (for advanced usage)
332
- "LazyInstallConfig",
333
- "LazyInstallerRegistry",
334
- "AsyncInstallHandle",
335
- "LazyInstaller",
336
- "DependencyMapper",
337
- "LazyMetaPathFinder",
338
- "WatchedPrefixRegistry",
339
- "LazyLoader",
340
- "LazyManifestLoader",
341
- "PackageManifest",
342
- "manifest",
343
- "_lazy_importer",
344
- # Internal utilities (for advanced usage)
345
- "check_package_keywords",
346
- "_detect_lazy_installation",
347
- "_detect_meta_info_mode",
348
- "_set_package_class_hints",
349
- "_get_package_class_hints",
350
- "_clear_all_package_class_hints",
351
- "_spec_for_existing_module",
352
- "_cached_stdlib_check",
353
- "_spec_cache_get",
354
- "_spec_cache_put",
355
- "_spec_cache_clear",
356
- "_cache_spec_if_missing",
357
- "_spec_cache_prune_locked",
358
- "_is_externally_managed",
359
- "_check_pip_audit_available",
360
- "_is_import_in_progress",
361
- "_mark_import_started",
362
- "_mark_import_finished",
363
- "_lazy_aware_import_module",
364
- "_patch_import_module",
365
- "_unpatch_import_module",
366
- ]
367
-
@@ -1,47 +0,0 @@
1
- """
2
- #exonware/xwlazy/src/exonware/xwlazy/common/__init__.py
3
-
4
- Common utilities shared across package, module, and runtime.
5
-
6
- Company: eXonware.com
7
- Author: Eng. Muhammad AlShehri
8
- Email: connect@exonware.com
9
-
10
- Generation Date: 15-Nov-2025
11
- """
12
-
13
- from .logger import (
14
- get_logger,
15
- log_event,
16
- print_formatted,
17
- format_message,
18
- is_log_category_enabled,
19
- set_log_category,
20
- set_log_categories,
21
- get_log_categories,
22
- XWLazyFormatter,
23
- )
24
-
25
- from .cache import (
26
- MultiTierCache,
27
- BytecodeCache,
28
- InstallationCache,
29
- )
30
-
31
- __all__ = [
32
- # Logger
33
- 'get_logger',
34
- 'log_event',
35
- 'print_formatted',
36
- 'format_message',
37
- 'is_log_category_enabled',
38
- 'set_log_category',
39
- 'set_log_categories',
40
- 'get_log_categories',
41
- 'XWLazyFormatter',
42
- # Cache
43
- 'MultiTierCache',
44
- 'BytecodeCache',
45
- 'InstallationCache',
46
- ]
47
-
@@ -1,56 +0,0 @@
1
- """
2
- Common Abstract Base Classes
3
-
4
- Company: eXonware.com
5
- Author: Eng. Muhammad AlShehri
6
- Email: connect@exonware.com
7
-
8
- Generation Date: 15-Nov-2025
9
-
10
- Abstract base classes for shared/common strategies.
11
- """
12
-
13
- from abc import ABC, abstractmethod
14
- from typing import Optional, Any
15
- from ..contracts import ICachingStrategy
16
-
17
- # =============================================================================
18
- # ABSTRACT CACHING STRATEGY
19
- # =============================================================================
20
-
21
- class ACachingStrategy(ICachingStrategy, ABC):
22
- """
23
- Abstract base class for caching strategies.
24
-
25
- Works with ANY data type (modules, packages, etc.).
26
- All caching strategies must extend this class.
27
- """
28
-
29
- @abstractmethod
30
- def get(self, key: str) -> Optional[Any]:
31
- """Get value from cache."""
32
- ...
33
-
34
- @abstractmethod
35
- def set(self, key: str, value: Any) -> None:
36
- """Set value in cache."""
37
- ...
38
-
39
- @abstractmethod
40
- def invalidate(self, key: str) -> None:
41
- """Invalidate cached value."""
42
- ...
43
-
44
- @abstractmethod
45
- def clear(self) -> None:
46
- """Clear all cached values."""
47
- ...
48
-
49
- # =============================================================================
50
- # EXPORT ALL
51
- # =============================================================================
52
-
53
- __all__ = [
54
- 'ACachingStrategy',
55
- ]
56
-