exonware-xwsystem 0.0.1.407__py3-none-any.whl → 0.0.1.408__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- exonware/__init__.py +21 -12
- exonware/conf.py +89 -149
- exonware/xwsystem/__init__.py +18 -159
- exonware/xwsystem/caching/__init__.py +1 -1
- exonware/xwsystem/caching/base.py +1 -1
- exonware/xwsystem/caching/bloom_cache.py +1 -1
- exonware/xwsystem/caching/cache_manager.py +1 -1
- exonware/xwsystem/caching/conditional.py +1 -1
- exonware/xwsystem/caching/contracts.py +1 -1
- exonware/xwsystem/caching/decorators.py +1 -1
- exonware/xwsystem/caching/defs.py +1 -1
- exonware/xwsystem/caching/disk_cache.py +1 -1
- exonware/xwsystem/caching/distributed.py +1 -1
- exonware/xwsystem/caching/errors.py +1 -1
- exonware/xwsystem/caching/events.py +1 -1
- exonware/xwsystem/caching/eviction_strategies.py +1 -1
- exonware/xwsystem/caching/fluent.py +1 -1
- exonware/xwsystem/caching/integrity.py +1 -1
- exonware/xwsystem/caching/lfu_cache.py +1 -1
- exonware/xwsystem/caching/lfu_optimized.py +1 -1
- exonware/xwsystem/caching/lru_cache.py +1 -1
- exonware/xwsystem/caching/memory_bounded.py +1 -1
- exonware/xwsystem/caching/metrics_exporter.py +1 -1
- exonware/xwsystem/caching/observable_cache.py +1 -1
- exonware/xwsystem/caching/pluggable_cache.py +1 -1
- exonware/xwsystem/caching/rate_limiter.py +1 -1
- exonware/xwsystem/caching/read_through.py +1 -1
- exonware/xwsystem/caching/secure_cache.py +1 -1
- exonware/xwsystem/caching/serializable.py +1 -1
- exonware/xwsystem/caching/stats.py +1 -1
- exonware/xwsystem/caching/tagging.py +1 -1
- exonware/xwsystem/caching/ttl_cache.py +1 -1
- exonware/xwsystem/caching/two_tier_cache.py +1 -1
- exonware/xwsystem/caching/utils.py +1 -1
- exonware/xwsystem/caching/validation.py +1 -1
- exonware/xwsystem/caching/warming.py +1 -1
- exonware/xwsystem/caching/write_behind.py +1 -1
- exonware/xwsystem/cli/__init__.py +1 -1
- exonware/xwsystem/cli/args.py +1 -1
- exonware/xwsystem/cli/base.py +1 -1
- exonware/xwsystem/cli/colors.py +1 -1
- exonware/xwsystem/cli/console.py +1 -1
- exonware/xwsystem/cli/contracts.py +1 -1
- exonware/xwsystem/cli/defs.py +1 -1
- exonware/xwsystem/cli/errors.py +1 -1
- exonware/xwsystem/cli/progress.py +1 -1
- exonware/xwsystem/cli/prompts.py +1 -1
- exonware/xwsystem/cli/tables.py +1 -1
- exonware/xwsystem/conf.py +1 -21
- exonware/xwsystem/config/__init__.py +1 -1
- exonware/xwsystem/config/base.py +1 -1
- exonware/xwsystem/config/contracts.py +1 -1
- exonware/xwsystem/config/defaults.py +1 -1
- exonware/xwsystem/config/defs.py +1 -1
- exonware/xwsystem/config/errors.py +1 -1
- exonware/xwsystem/config/logging.py +1 -1
- exonware/xwsystem/config/logging_setup.py +1 -1
- exonware/xwsystem/config/performance.py +1 -1
- exonware/xwsystem/http/__init__.py +1 -1
- exonware/xwsystem/http/advanced_client.py +5 -1
- exonware/xwsystem/http/base.py +1 -1
- exonware/xwsystem/http/client.py +5 -1
- exonware/xwsystem/http/contracts.py +1 -1
- exonware/xwsystem/http/defs.py +1 -1
- exonware/xwsystem/http/errors.py +1 -1
- exonware/xwsystem/io/__init__.py +1 -1
- exonware/xwsystem/io/archive/__init__.py +1 -1
- exonware/xwsystem/io/archive/archive.py +1 -1
- exonware/xwsystem/io/archive/archive_files.py +1 -1
- exonware/xwsystem/io/archive/archivers.py +1 -1
- exonware/xwsystem/io/archive/base.py +1 -1
- exonware/xwsystem/io/archive/codec_integration.py +1 -1
- exonware/xwsystem/io/archive/compression.py +1 -1
- exonware/xwsystem/io/archive/formats/__init__.py +1 -1
- exonware/xwsystem/io/archive/formats/brotli_format.py +1 -1
- exonware/xwsystem/io/archive/formats/lz4_format.py +1 -1
- exonware/xwsystem/io/archive/formats/rar.py +1 -1
- exonware/xwsystem/io/archive/formats/sevenzip.py +1 -1
- exonware/xwsystem/io/archive/formats/squashfs_format.py +1 -1
- exonware/xwsystem/io/archive/formats/tar.py +1 -1
- exonware/xwsystem/io/archive/formats/wim_format.py +1 -1
- exonware/xwsystem/io/archive/formats/zip.py +1 -1
- exonware/xwsystem/io/archive/formats/zpaq_format.py +1 -1
- exonware/xwsystem/io/archive/formats/zstandard.py +1 -1
- exonware/xwsystem/io/base.py +1 -1
- exonware/xwsystem/io/codec/__init__.py +1 -1
- exonware/xwsystem/io/codec/base.py +1 -1
- exonware/xwsystem/io/codec/contracts.py +1 -1
- exonware/xwsystem/io/codec/registry.py +1 -1
- exonware/xwsystem/io/common/__init__.py +1 -1
- exonware/xwsystem/io/common/base.py +1 -1
- exonware/xwsystem/io/common/lock.py +1 -1
- exonware/xwsystem/io/common/watcher.py +1 -1
- exonware/xwsystem/io/contracts.py +1 -1
- exonware/xwsystem/io/defs.py +1 -1
- exonware/xwsystem/io/errors.py +1 -1
- exonware/xwsystem/io/facade.py +1 -1
- exonware/xwsystem/io/file/__init__.py +1 -1
- exonware/xwsystem/io/file/base.py +1 -1
- exonware/xwsystem/io/file/conversion.py +1 -1
- exonware/xwsystem/io/file/file.py +1 -1
- exonware/xwsystem/io/file/paged_source.py +1 -1
- exonware/xwsystem/io/file/paging/__init__.py +1 -1
- exonware/xwsystem/io/file/paging/byte_paging.py +1 -1
- exonware/xwsystem/io/file/paging/line_paging.py +1 -1
- exonware/xwsystem/io/file/paging/record_paging.py +1 -1
- exonware/xwsystem/io/file/paging/registry.py +1 -1
- exonware/xwsystem/io/file/source.py +1 -1
- exonware/xwsystem/io/filesystem/__init__.py +1 -1
- exonware/xwsystem/io/filesystem/base.py +1 -1
- exonware/xwsystem/io/filesystem/local.py +1 -1
- exonware/xwsystem/io/folder/__init__.py +1 -1
- exonware/xwsystem/io/folder/base.py +1 -1
- exonware/xwsystem/io/folder/folder.py +1 -1
- exonware/xwsystem/io/serialization/__init__.py +1 -1
- exonware/xwsystem/io/serialization/auto_serializer.py +1 -1
- exonware/xwsystem/io/serialization/base.py +2 -2
- exonware/xwsystem/io/serialization/contracts.py +1 -1
- exonware/xwsystem/io/serialization/defs.py +1 -1
- exonware/xwsystem/io/serialization/errors.py +1 -1
- exonware/xwsystem/io/serialization/flyweight.py +1 -1
- exonware/xwsystem/io/serialization/format_detector.py +1 -1
- exonware/xwsystem/io/serialization/formats/__init__.py +1 -1
- exonware/xwsystem/io/serialization/formats/binary/bson.py +1 -1
- exonware/xwsystem/io/serialization/formats/binary/cbor.py +1 -1
- exonware/xwsystem/io/serialization/formats/binary/marshal.py +1 -1
- exonware/xwsystem/io/serialization/formats/binary/msgpack.py +1 -1
- exonware/xwsystem/io/serialization/formats/binary/pickle.py +1 -1
- exonware/xwsystem/io/serialization/formats/binary/plistlib.py +1 -1
- exonware/xwsystem/io/serialization/formats/database/dbm.py +1 -1
- exonware/xwsystem/io/serialization/formats/database/shelve.py +1 -1
- exonware/xwsystem/io/serialization/formats/database/sqlite3.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/configparser.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/csv.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/formdata.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/json.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/json5.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/jsonlines.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/multipart.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/toml.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/xml.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/yaml.py +1 -1
- exonware/xwsystem/io/serialization/registry.py +1 -1
- exonware/xwsystem/io/serialization/serializer.py +1 -1
- exonware/xwsystem/io/serialization/utils/__init__.py +1 -1
- exonware/xwsystem/io/serialization/utils/path_ops.py +1 -1
- exonware/xwsystem/io/stream/__init__.py +1 -1
- exonware/xwsystem/io/stream/async_operations.py +1 -1
- exonware/xwsystem/io/stream/base.py +1 -1
- exonware/xwsystem/io/stream/codec_io.py +1 -1
- exonware/xwsystem/ipc/async_fabric.py +1 -1
- exonware/xwsystem/ipc/base.py +1 -1
- exonware/xwsystem/ipc/contracts.py +1 -1
- exonware/xwsystem/ipc/defs.py +1 -1
- exonware/xwsystem/ipc/errors.py +1 -1
- exonware/xwsystem/lazy_bootstrap.py +79 -0
- exonware/xwsystem/monitoring/base.py +1 -1
- exonware/xwsystem/monitoring/contracts.py +1 -1
- exonware/xwsystem/monitoring/defs.py +1 -1
- exonware/xwsystem/monitoring/errors.py +1 -1
- exonware/xwsystem/monitoring/performance_manager_generic.py +1 -1
- exonware/xwsystem/monitoring/system_monitor.py +1 -1
- exonware/xwsystem/monitoring/tracing.py +17 -15
- exonware/xwsystem/monitoring/tracker.py +1 -1
- exonware/xwsystem/operations/__init__.py +1 -1
- exonware/xwsystem/operations/base.py +1 -1
- exonware/xwsystem/operations/defs.py +1 -1
- exonware/xwsystem/operations/diff.py +1 -1
- exonware/xwsystem/operations/merge.py +1 -1
- exonware/xwsystem/operations/patch.py +1 -1
- exonware/xwsystem/patterns/base.py +1 -1
- exonware/xwsystem/patterns/contracts.py +1 -1
- exonware/xwsystem/patterns/defs.py +1 -1
- exonware/xwsystem/patterns/errors.py +1 -1
- exonware/xwsystem/patterns/registry.py +1 -1
- exonware/xwsystem/plugins/__init__.py +1 -1
- exonware/xwsystem/plugins/base.py +1 -1
- exonware/xwsystem/plugins/contracts.py +1 -1
- exonware/xwsystem/plugins/defs.py +1 -1
- exonware/xwsystem/plugins/errors.py +1 -1
- exonware/xwsystem/runtime/__init__.py +1 -1
- exonware/xwsystem/runtime/base.py +1 -1
- exonware/xwsystem/runtime/contracts.py +1 -1
- exonware/xwsystem/runtime/defs.py +1 -1
- exonware/xwsystem/runtime/env.py +1 -1
- exonware/xwsystem/runtime/errors.py +1 -1
- exonware/xwsystem/runtime/reflection.py +1 -1
- exonware/xwsystem/security/auth.py +1 -1
- exonware/xwsystem/security/base.py +1 -1
- exonware/xwsystem/security/contracts.py +1 -1
- exonware/xwsystem/security/crypto.py +1 -1
- exonware/xwsystem/security/defs.py +1 -1
- exonware/xwsystem/security/errors.py +1 -1
- exonware/xwsystem/security/hazmat.py +1 -1
- exonware/xwsystem/shared/__init__.py +1 -1
- exonware/xwsystem/shared/base.py +1 -1
- exonware/xwsystem/shared/contracts.py +1 -1
- exonware/xwsystem/shared/defs.py +1 -1
- exonware/xwsystem/shared/errors.py +1 -1
- exonware/xwsystem/structures/base.py +1 -1
- exonware/xwsystem/structures/contracts.py +1 -1
- exonware/xwsystem/structures/defs.py +1 -1
- exonware/xwsystem/structures/errors.py +1 -1
- exonware/xwsystem/threading/async_primitives.py +1 -1
- exonware/xwsystem/threading/base.py +1 -1
- exonware/xwsystem/threading/contracts.py +1 -1
- exonware/xwsystem/threading/defs.py +1 -1
- exonware/xwsystem/threading/errors.py +1 -1
- exonware/xwsystem/utils/base.py +1 -1
- exonware/xwsystem/utils/contracts.py +1 -1
- exonware/xwsystem/utils/dt/__init__.py +1 -1
- exonware/xwsystem/utils/dt/base.py +1 -1
- exonware/xwsystem/utils/dt/contracts.py +1 -1
- exonware/xwsystem/utils/dt/defs.py +1 -1
- exonware/xwsystem/utils/dt/errors.py +1 -1
- exonware/xwsystem/utils/dt/formatting.py +1 -1
- exonware/xwsystem/utils/dt/humanize.py +1 -1
- exonware/xwsystem/utils/dt/parsing.py +1 -1
- exonware/xwsystem/utils/dt/timezone_utils.py +1 -1
- exonware/xwsystem/utils/errors.py +1 -1
- exonware/xwsystem/utils/test_runner.py +1 -1
- exonware/xwsystem/utils/utils_contracts.py +1 -1
- exonware/xwsystem/validation/__init__.py +1 -1
- exonware/xwsystem/validation/base.py +1 -1
- exonware/xwsystem/validation/contracts.py +1 -1
- exonware/xwsystem/validation/declarative.py +1 -1
- exonware/xwsystem/validation/defs.py +1 -1
- exonware/xwsystem/validation/errors.py +1 -1
- exonware/xwsystem/validation/fluent_validator.py +1 -1
- exonware/xwsystem/version.py +2 -2
- {exonware_xwsystem-0.0.1.407.dist-info → exonware_xwsystem-0.0.1.408.dist-info}/METADATA +3 -3
- exonware_xwsystem-0.0.1.408.dist-info/RECORD +274 -0
- exonware/xwsystem/_lazy_bootstrap.py +0 -77
- exonware/xwsystem/utils/lazy_package/ARCHITECTURE.md +0 -820
- exonware/xwsystem/utils/lazy_package/__init__.py +0 -268
- exonware/xwsystem/utils/lazy_package/config.py +0 -163
- exonware/xwsystem/utils/lazy_package/lazy_base.py +0 -465
- exonware/xwsystem/utils/lazy_package/lazy_contracts.py +0 -290
- exonware/xwsystem/utils/lazy_package/lazy_core.py +0 -2248
- exonware/xwsystem/utils/lazy_package/lazy_errors.py +0 -253
- exonware/xwsystem/utils/lazy_package/lazy_state.py +0 -86
- exonware_xwsystem-0.0.1.407.dist-info/RECORD +0 -282
- {exonware_xwsystem-0.0.1.407.dist-info → exonware_xwsystem-0.0.1.408.dist-info}/WHEEL +0 -0
- {exonware_xwsystem-0.0.1.407.dist-info → exonware_xwsystem-0.0.1.408.dist-info}/licenses/LICENSE +0 -0
exonware/__init__.py
CHANGED
|
@@ -4,7 +4,7 @@ exonware package - Enterprise-grade Python framework ecosystem
|
|
|
4
4
|
Company: eXonware.com
|
|
5
5
|
Author: Eng. Muhammad AlShehri
|
|
6
6
|
Email: connect@exonware.com
|
|
7
|
-
Version: 0.0.1.
|
|
7
|
+
Version: 0.0.1.408
|
|
8
8
|
Generation Date: September 04, 2025
|
|
9
9
|
|
|
10
10
|
This is a namespace package allowing multiple exonware subpackages
|
|
@@ -14,17 +14,26 @@ to coexist (xwsystem, xwnode, xwdata, etc.)
|
|
|
14
14
|
# Make this a namespace package
|
|
15
15
|
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
import importlib.metadata
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _load_version() -> str:
|
|
22
|
+
try:
|
|
23
|
+
return importlib.metadata.version("exonware-xwsystem")
|
|
24
|
+
except importlib.metadata.PackageNotFoundError:
|
|
25
|
+
version_path = Path(__file__).parent / "xwsystem" / "version.py"
|
|
26
|
+
ns: dict = {}
|
|
27
|
+
try:
|
|
28
|
+
exec(version_path.read_text(encoding="utf-8"), ns) # noqa: S102
|
|
29
|
+
except FileNotFoundError as exc: # pragma: no cover
|
|
30
|
+
raise ImportError(
|
|
31
|
+
f"Version metadata unavailable at {version_path}."
|
|
32
|
+
) from exc
|
|
33
|
+
return ns["__version__"]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
__version__ = _load_version()
|
|
28
37
|
|
|
29
38
|
__author__ = 'Eng. Muhammad AlShehri'
|
|
30
39
|
__email__ = 'connect@exonware.com'
|
exonware/conf.py
CHANGED
|
@@ -9,7 +9,7 @@ works across all exonware packages (xwsystem, xwnode, xwdata, etc.).
|
|
|
9
9
|
Company: eXonware.com
|
|
10
10
|
Author: Eng. Muhammad AlShehri
|
|
11
11
|
Email: connect@exonware.com
|
|
12
|
-
Version: 0.0.1.
|
|
12
|
+
Version: 0.0.1.408
|
|
13
13
|
Generation Date: 11-Nov-2025
|
|
14
14
|
"""
|
|
15
15
|
|
|
@@ -17,163 +17,103 @@ from __future__ import annotations
|
|
|
17
17
|
|
|
18
18
|
import sys
|
|
19
19
|
import types
|
|
20
|
-
from typing import Dict, Optional, Any
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
# CRITICAL: Set up warning filter BEFORE any other imports to catch early warnings
|
|
22
|
+
# This suppresses the decimal module mpd_setminalloc warning that appears on stderr
|
|
23
|
+
_original_stderr = sys.stderr
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
self.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return self._get_lazy_config().lazy_import
|
|
37
|
-
|
|
38
|
-
@lazy_install.setter
|
|
39
|
-
def lazy_install(self, value: bool) -> None:
|
|
40
|
-
"""Set lazy install for this package."""
|
|
41
|
-
self._get_lazy_config().lazy_import = value
|
|
25
|
+
class _FilteredStderr:
|
|
26
|
+
"""Stderr wrapper that filters out decimal module warnings."""
|
|
27
|
+
def __init__(self, original_stderr):
|
|
28
|
+
self._original = original_stderr
|
|
29
|
+
# Match various forms of the decimal warning
|
|
30
|
+
self._filter_patterns = [
|
|
31
|
+
"mpd_setminalloc",
|
|
32
|
+
"MPD_MINALLOC",
|
|
33
|
+
"ignoring request to set",
|
|
34
|
+
"libmpdec",
|
|
35
|
+
"context.c:57"
|
|
36
|
+
]
|
|
42
37
|
|
|
43
|
-
def
|
|
44
|
-
"""
|
|
45
|
-
|
|
38
|
+
def write(self, text: str) -> int:
|
|
39
|
+
"""Write to stderr, filtering out unwanted warnings."""
|
|
40
|
+
# Check if this line contains any of our filter patterns
|
|
41
|
+
if any(pattern.lower() in text.lower() for pattern in self._filter_patterns):
|
|
42
|
+
return len(text) # Pretend we wrote it, but don't actually write
|
|
43
|
+
return self._original.write(text)
|
|
46
44
|
|
|
47
|
-
def
|
|
48
|
-
"""
|
|
49
|
-
|
|
45
|
+
def flush(self) -> None:
|
|
46
|
+
"""Flush the original stderr."""
|
|
47
|
+
self._original.flush()
|
|
50
48
|
|
|
51
|
-
def
|
|
52
|
-
"""
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
self._lazy_config = LazyConfig(packages=(self._package_name,))
|
|
60
|
-
except (ImportError, AttributeError):
|
|
61
|
-
# Fallback config that uses environment variables for early hook installation
|
|
62
|
-
class _StandaloneConfig:
|
|
63
|
-
def __init__(self, pkg, parent):
|
|
64
|
-
self._pkg = pkg
|
|
65
|
-
self._parent = parent
|
|
66
|
-
import os
|
|
67
|
-
# Check environment variable for initial state
|
|
68
|
-
env_var = f"{pkg.upper()}_LAZY_INSTALL"
|
|
69
|
-
self._enabled = os.environ.get(env_var, '').lower() in ('true', '1', 'yes', 'on')
|
|
70
|
-
|
|
71
|
-
@property
|
|
72
|
-
def lazy_import(self):
|
|
73
|
-
return self._enabled
|
|
74
|
-
|
|
75
|
-
@lazy_import.setter
|
|
76
|
-
def lazy_import(self, value):
|
|
77
|
-
import os
|
|
78
|
-
self._enabled = value
|
|
79
|
-
state_manager = LazyStateManager(self._pkg)
|
|
80
|
-
state_manager.set_manual_state(value)
|
|
81
|
-
if not value:
|
|
82
|
-
state_manager.set_auto_state(False)
|
|
83
|
-
# Set environment variable so bootstrap can read it
|
|
84
|
-
env_var = f"{self._pkg.upper()}_LAZY_INSTALL"
|
|
85
|
-
if value:
|
|
86
|
-
os.environ[env_var] = '1'
|
|
87
|
-
# Try to install hook if xwsystem is available
|
|
88
|
-
self._parent._try_install_hook(self._pkg)
|
|
89
|
-
else:
|
|
90
|
-
os.environ.pop(env_var, None)
|
|
91
|
-
|
|
92
|
-
def get_lazy_status(self):
|
|
93
|
-
# Try to get real status if xwsystem is now available
|
|
94
|
-
try:
|
|
95
|
-
import importlib
|
|
96
|
-
config_module = importlib.import_module('exonware.xwsystem.utils.lazy_package.config')
|
|
97
|
-
LazyConfig = config_module.LazyConfig
|
|
98
|
-
real_config = LazyConfig(packages=(self._pkg,))
|
|
99
|
-
return real_config.get_lazy_status()
|
|
100
|
-
except (ImportError, AttributeError):
|
|
101
|
-
return {
|
|
102
|
-
'enabled': self._enabled,
|
|
103
|
-
'hook_installed': False,
|
|
104
|
-
'lazy_install_enabled': False,
|
|
105
|
-
'active': False,
|
|
106
|
-
'error': 'xwsystem not available'
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
def is_lazy_active(self):
|
|
110
|
-
try:
|
|
111
|
-
import importlib
|
|
112
|
-
config_module = importlib.import_module('exonware.xwsystem.utils.lazy_package.config')
|
|
113
|
-
LazyConfig = config_module.LazyConfig
|
|
114
|
-
real_config = LazyConfig(packages=(self._pkg,))
|
|
115
|
-
return real_config.is_lazy_active()
|
|
116
|
-
except (ImportError, AttributeError):
|
|
117
|
-
return False
|
|
118
|
-
|
|
119
|
-
self._lazy_config = _StandaloneConfig(self._package_name, self._parent_conf)
|
|
120
|
-
return self._lazy_config
|
|
49
|
+
def reconfigure(self, *args, **kwargs):
|
|
50
|
+
"""Handle reconfigure calls - update original reference and reapply filter."""
|
|
51
|
+
# Update the original reference after reconfigure
|
|
52
|
+
result = self._original.reconfigure(*args, **kwargs)
|
|
53
|
+
# Ensure filter stays active
|
|
54
|
+
if sys.stderr is not self:
|
|
55
|
+
sys.stderr = self # type: ignore[assignment]
|
|
56
|
+
return result
|
|
121
57
|
|
|
122
|
-
def
|
|
123
|
-
"""
|
|
124
|
-
|
|
125
|
-
import importlib
|
|
126
|
-
lazy_core = importlib.import_module('exonware.xwsystem.utils.lazy_package.lazy_core')
|
|
127
|
-
if hasattr(lazy_core, 'install_import_hook'):
|
|
128
|
-
lazy_core.install_import_hook(package_name)
|
|
129
|
-
except (ImportError, AttributeError):
|
|
130
|
-
# xwsystem not available yet - bootstrap will install hook when it loads
|
|
131
|
-
pass
|
|
58
|
+
def __getattr__(self, name: str):
|
|
59
|
+
"""Delegate all other attributes to original stderr."""
|
|
60
|
+
return getattr(self._original, name)
|
|
132
61
|
|
|
62
|
+
# Set up filter immediately (default: suppress warnings)
|
|
63
|
+
_filtered_stderr = _FilteredStderr(_original_stderr)
|
|
64
|
+
sys.stderr = _filtered_stderr # type: ignore[assignment]
|
|
133
65
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if name.startswith('_'):
|
|
166
|
-
super().__setattr__(name, value)
|
|
167
|
-
return
|
|
168
|
-
|
|
169
|
-
# Global lazy_install (defaults to xwsystem)
|
|
170
|
-
if name == "lazy_install":
|
|
171
|
-
self.xwsystem.lazy_install = value
|
|
172
|
-
else:
|
|
173
|
-
super().__setattr__(name, value)
|
|
66
|
+
# CRITICAL: Configure UTF-8 encoding on Windows for emoji support
|
|
67
|
+
# This ensures emojis work automatically when exonware.conf is imported
|
|
68
|
+
# Root cause: Windows console defaults to cp1252 encoding, which can't encode emojis
|
|
69
|
+
# Trigger: This code runs at import time, before any prints, ensuring UTF-8 is active
|
|
70
|
+
if sys.platform == "win32":
|
|
71
|
+
try:
|
|
72
|
+
# Try to reconfigure stdout/stderr to UTF-8 (Python 3.7+)
|
|
73
|
+
if hasattr(sys.stdout, "reconfigure"):
|
|
74
|
+
try:
|
|
75
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
76
|
+
except (ValueError, OSError):
|
|
77
|
+
pass # May fail if already reconfigured or not supported
|
|
78
|
+
if hasattr(sys.stderr, "reconfigure"):
|
|
79
|
+
try:
|
|
80
|
+
sys.stderr.reconfigure(encoding="utf-8")
|
|
81
|
+
except (ValueError, OSError):
|
|
82
|
+
pass # May fail if already reconfigured or not supported
|
|
83
|
+
except Exception:
|
|
84
|
+
# Fallback: wrap stdout/stderr with UTF-8 TextIOWrapper
|
|
85
|
+
import io
|
|
86
|
+
try:
|
|
87
|
+
if hasattr(sys.stdout, "buffer"):
|
|
88
|
+
sys.stdout = io.TextIOWrapper(
|
|
89
|
+
sys.stdout.buffer, encoding="utf-8", errors="replace", line_buffering=True
|
|
90
|
+
)
|
|
91
|
+
if hasattr(_filtered_stderr._original, "buffer"):
|
|
92
|
+
_filtered_stderr._original = io.TextIOWrapper(
|
|
93
|
+
_filtered_stderr._original.buffer, encoding="utf-8", errors="replace", line_buffering=True
|
|
94
|
+
)
|
|
95
|
+
except Exception:
|
|
96
|
+
pass # Silently fail if wrapping is not possible
|
|
174
97
|
|
|
98
|
+
try:
|
|
99
|
+
# Try new path first (exonware.xwlazy.host.conf)
|
|
100
|
+
from exonware.xwlazy.host.conf import get_conf_module
|
|
101
|
+
except ImportError:
|
|
102
|
+
try:
|
|
103
|
+
# Fall back to old path (xwlazy.lazy.host_conf) for installed packages
|
|
104
|
+
from xwlazy.lazy.host_conf import get_conf_module
|
|
105
|
+
except ImportError: # xwlazy not installed yet
|
|
106
|
+
class _UnavailableConf(types.ModuleType):
|
|
107
|
+
def __getattr__(self, name: str):
|
|
108
|
+
raise RuntimeError(
|
|
109
|
+
"Lazy configuration requires 'exonware-xwlazy'. "
|
|
110
|
+
"Install it via 'pip install exonware-xwlazy' to enable lazy mode."
|
|
111
|
+
)
|
|
112
|
+
_module_instance = _UnavailableConf(__name__, __doc__)
|
|
113
|
+
else:
|
|
114
|
+
_module_instance = get_conf_module(__name__, __doc__)
|
|
115
|
+
else:
|
|
116
|
+
_module_instance = get_conf_module(__name__, __doc__)
|
|
175
117
|
|
|
176
|
-
# Replace module with custom class instance
|
|
177
|
-
_module_instance = _ExonwareConfModule(__name__, __doc__)
|
|
178
118
|
sys.modules[__name__] = _module_instance
|
|
179
119
|
|
exonware/xwsystem/__init__.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Company: eXonware.com
|
|
4
4
|
Author: Eng. Muhammad AlShehri
|
|
5
5
|
Email: connect@exonware.com
|
|
6
|
-
Version: 0.0.1.
|
|
6
|
+
Version: 0.0.1.408
|
|
7
7
|
Generation Date: October 10, 2025
|
|
8
8
|
|
|
9
9
|
XWSystem - Enterprise-grade Python framework with AI-powered performance optimization.
|
|
@@ -50,6 +50,7 @@ This module provides common utilities that can be used across different
|
|
|
50
50
|
components including threading, security, I/O, data structures, and design patterns.
|
|
51
51
|
"""
|
|
52
52
|
|
|
53
|
+
import importlib
|
|
53
54
|
import logging
|
|
54
55
|
from typing import TYPE_CHECKING
|
|
55
56
|
|
|
@@ -58,103 +59,15 @@ if TYPE_CHECKING:
|
|
|
58
59
|
from typing import Any
|
|
59
60
|
|
|
60
61
|
# =============================================================================
|
|
61
|
-
#
|
|
62
|
+
# LAZY MODE INTEGRATION
|
|
62
63
|
# =============================================================================
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
#
|
|
68
|
-
|
|
69
|
-
#
|
|
70
|
-
# All lazy loading functionality consolidated into lazy_package following DEV_GUIDELINES.md
|
|
71
|
-
# Implements per-package lazy loading with automatic installation of missing dependencies.
|
|
72
|
-
|
|
73
|
-
from .utils.lazy_package import (
|
|
74
|
-
# Core classes
|
|
75
|
-
LazyLoader,
|
|
76
|
-
LazyModuleRegistry,
|
|
77
|
-
LazyModeFacade,
|
|
78
|
-
LazyPerformanceMonitor,
|
|
79
|
-
LazyInstaller,
|
|
80
|
-
LazyInstallerRegistry,
|
|
81
|
-
LazyInstallMode,
|
|
82
|
-
LazyInstallPolicy,
|
|
83
|
-
DependencyMapper,
|
|
84
|
-
LazyDiscovery,
|
|
85
|
-
LazyInstallConfig,
|
|
86
|
-
DeferredImportError,
|
|
87
|
-
LazyMetaPathFinder,
|
|
88
|
-
|
|
89
|
-
# Dataclasses
|
|
90
|
-
DependencyInfo,
|
|
91
|
-
|
|
92
|
-
# Lazy mode functions
|
|
93
|
-
register_lazy_module,
|
|
94
|
-
get_lazy_module,
|
|
95
|
-
get_loading_stats,
|
|
96
|
-
preload_frequently_used,
|
|
97
|
-
enable_lazy_mode,
|
|
98
|
-
disable_lazy_mode,
|
|
99
|
-
is_lazy_mode_enabled,
|
|
100
|
-
get_lazy_mode_stats,
|
|
101
|
-
configure_lazy_mode,
|
|
102
|
-
preload_modules,
|
|
103
|
-
optimize_lazy_mode,
|
|
104
|
-
|
|
105
|
-
# Install functions
|
|
106
|
-
enable_lazy_install,
|
|
107
|
-
disable_lazy_install,
|
|
108
|
-
is_lazy_install_enabled,
|
|
109
|
-
set_lazy_install_mode,
|
|
110
|
-
get_lazy_install_mode,
|
|
111
|
-
install_missing_package,
|
|
112
|
-
install_and_import,
|
|
113
|
-
get_lazy_install_stats,
|
|
114
|
-
get_all_lazy_install_stats,
|
|
115
|
-
lazy_import_with_install,
|
|
116
|
-
xwimport,
|
|
117
|
-
|
|
118
|
-
# Discovery functions
|
|
119
|
-
discover_dependencies,
|
|
120
|
-
get_lazy_discovery,
|
|
121
|
-
export_dependency_mappings,
|
|
122
|
-
config_package_lazy_install_enabled,
|
|
123
|
-
|
|
124
|
-
# Hook functions
|
|
125
|
-
install_import_hook,
|
|
126
|
-
uninstall_import_hook,
|
|
127
|
-
is_import_hook_installed,
|
|
128
|
-
|
|
129
|
-
# Security & Policy APIs
|
|
130
|
-
set_package_allow_list,
|
|
131
|
-
set_package_deny_list,
|
|
132
|
-
add_to_package_allow_list,
|
|
133
|
-
add_to_package_deny_list,
|
|
134
|
-
set_package_index_url,
|
|
135
|
-
set_package_extra_index_urls,
|
|
136
|
-
add_package_trusted_host,
|
|
137
|
-
set_package_lockfile,
|
|
138
|
-
generate_package_sbom,
|
|
139
|
-
check_externally_managed_environment,
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
# Auto-detect [lazy] installation mode and install import hook only when enabled
|
|
143
|
-
config_package_lazy_install_enabled("xwsystem")
|
|
144
|
-
|
|
145
|
-
# =============================================================================
|
|
146
|
-
# LAZY INSTALLATION - Simple One-Line Configuration
|
|
147
|
-
# =============================================================================
|
|
148
|
-
# DISABLED BY DEFAULT - Users can enable manually if needed
|
|
149
|
-
# Auto-detects if user installed with [lazy] extra: pip install xwsystem[lazy]
|
|
150
|
-
# config_package_lazy_install_enabled("xwsystem", install_hook=False) # Configure lazy mode
|
|
151
|
-
|
|
152
|
-
# =============================================================================
|
|
153
|
-
# TWO-STAGE LAZY LOADING - Install import hook BEFORE importing serialization
|
|
154
|
-
# =============================================================================
|
|
155
|
-
# DISABLED BY DEFAULT - Prevents import hook interference
|
|
156
|
-
# Install the hook NOW, before serialization imports, so it can intercept them
|
|
157
|
-
# install_import_hook("xwsystem") # Install hook to intercept serialization module imports
|
|
64
|
+
# Minimal-intrusion lazy mode bootstrap (one line)
|
|
65
|
+
# Enables optimized lazy mode for xwsystem if xwlazy is installed
|
|
66
|
+
# Uses fastest mode from benchmarks: cached + full (1.482 ms)
|
|
67
|
+
try:
|
|
68
|
+
from .lazy_bootstrap import _bootstrap_lazy_mode # noqa: F401
|
|
69
|
+
except ImportError:
|
|
70
|
+
pass # xwlazy not installed - silently continue
|
|
158
71
|
|
|
159
72
|
# Logging utilities
|
|
160
73
|
from .config.logging_setup import get_logger, setup_logging
|
|
@@ -446,6 +359,14 @@ from .shared.contracts import IStringable
|
|
|
446
359
|
# Import version from centralized location
|
|
447
360
|
from .version import __version__
|
|
448
361
|
|
|
362
|
+
try:
|
|
363
|
+
import sys as _sys
|
|
364
|
+
_parent_pkg = _sys.modules.get("exonware")
|
|
365
|
+
if _parent_pkg is not None:
|
|
366
|
+
_parent_pkg.__version__ = __version__
|
|
367
|
+
except Exception: # pragma: no cover
|
|
368
|
+
pass
|
|
369
|
+
|
|
449
370
|
# =============================================================================
|
|
450
371
|
# CONVENIENCE FUNCTIONS - Quick access to common operations
|
|
451
372
|
# =============================================================================
|
|
@@ -932,68 +853,6 @@ __all__ = [
|
|
|
932
853
|
"Pipe",
|
|
933
854
|
"AsyncPipe",
|
|
934
855
|
|
|
935
|
-
# Lazy Mode - Performance optimization
|
|
936
|
-
"LazyLoader",
|
|
937
|
-
"LazyModuleRegistry",
|
|
938
|
-
"LazyModeFacade",
|
|
939
|
-
"LazyPerformanceMonitor",
|
|
940
|
-
"register_lazy_module",
|
|
941
|
-
"get_lazy_module",
|
|
942
|
-
"get_loading_stats",
|
|
943
|
-
"preload_frequently_used",
|
|
944
|
-
"enable_lazy_mode",
|
|
945
|
-
"disable_lazy_mode",
|
|
946
|
-
"is_lazy_mode_enabled",
|
|
947
|
-
"get_lazy_mode_stats",
|
|
948
|
-
"configure_lazy_mode",
|
|
949
|
-
"preload_modules",
|
|
950
|
-
"optimize_lazy_mode",
|
|
951
|
-
|
|
952
|
-
# Lazy Install - Auto-install missing packages (per-package isolation)
|
|
953
|
-
"LazyInstaller",
|
|
954
|
-
"LazyInstallerRegistry",
|
|
955
|
-
"LazyInstallMode",
|
|
956
|
-
"LazyInstallPolicy",
|
|
957
|
-
"DependencyMapper",
|
|
958
|
-
"enable_lazy_install",
|
|
959
|
-
"disable_lazy_install",
|
|
960
|
-
"is_lazy_install_enabled",
|
|
961
|
-
"set_lazy_install_mode",
|
|
962
|
-
"get_lazy_install_mode",
|
|
963
|
-
"install_missing_package",
|
|
964
|
-
"install_and_import",
|
|
965
|
-
"get_lazy_install_stats",
|
|
966
|
-
"get_all_lazy_install_stats",
|
|
967
|
-
"lazy_import_with_install",
|
|
968
|
-
"xwimport",
|
|
969
|
-
# Security & Policy APIs
|
|
970
|
-
"set_package_allow_list",
|
|
971
|
-
"set_package_deny_list",
|
|
972
|
-
"add_to_package_allow_list",
|
|
973
|
-
"add_to_package_deny_list",
|
|
974
|
-
"set_package_index_url",
|
|
975
|
-
"set_package_extra_index_urls",
|
|
976
|
-
"add_package_trusted_host",
|
|
977
|
-
"set_package_lockfile",
|
|
978
|
-
"generate_package_sbom",
|
|
979
|
-
"check_externally_managed_environment",
|
|
980
|
-
|
|
981
|
-
# Lazy Discovery - Package-agnostic dependency discovery with auto-detection
|
|
982
|
-
"LazyDiscovery",
|
|
983
|
-
"LazyInstallConfig",
|
|
984
|
-
"DependencyInfo",
|
|
985
|
-
"discover_dependencies",
|
|
986
|
-
"get_lazy_discovery",
|
|
987
|
-
"export_dependency_mappings",
|
|
988
|
-
"config_package_lazy_install_enabled",
|
|
989
|
-
|
|
990
|
-
# Lazy Import Hook - Performance optimized automatic import interception
|
|
991
|
-
"DeferredImportError",
|
|
992
|
-
"LazyMetaPathFinder",
|
|
993
|
-
"install_import_hook",
|
|
994
|
-
"uninstall_import_hook",
|
|
995
|
-
"is_import_hook_installed",
|
|
996
|
-
|
|
997
856
|
# Convenience Functions - Quick access patterns
|
|
998
857
|
"quick_serialize",
|
|
999
858
|
"quick_deserialize",
|