fastlib-py 0.3.2__tar.gz → 0.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/PKG-INFO +1 -1
  2. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/__init__.py +1 -3
  3. {fastlib_py-0.3.2/fastlib/logging → fastlib_py-0.3.4/fastlib/_logging}/handlers.py +1 -1
  4. fastlib_py-0.3.4/fastlib/logging.py +7 -0
  5. fastlib_py-0.3.4/fastlib/service/impl/__init__.py +0 -0
  6. fastlib_py-0.3.4/fastlib/utils/validate_util.py +51 -0
  7. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib_py.egg-info/PKG-INFO +1 -1
  8. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib_py.egg-info/SOURCES.txt +5 -3
  9. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/pyproject.toml +1 -1
  10. fastlib_py-0.3.2/fastlib/logging/__init__.py +0 -12
  11. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/LICENSE +0 -0
  12. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/README.md +0 -0
  13. {fastlib_py-0.3.2/fastlib/mapper → fastlib_py-0.3.4/fastlib/_logging}/__init__.py +0 -0
  14. {fastlib_py-0.3.2/fastlib/logging → fastlib_py-0.3.4/fastlib/_logging}/config.py +0 -0
  15. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/cache/__init__.py +0 -0
  16. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/cache/_disk_cache.py +0 -0
  17. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/cache/_redis_cache.py +0 -0
  18. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/cache/base.py +0 -0
  19. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/cache/manager.py +0 -0
  20. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/__init__.py +0 -0
  21. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/_database_config.py +0 -0
  22. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/_security_config.py +0 -0
  23. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/_server_config.py +0 -0
  24. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/base.py +0 -0
  25. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/loader.py +0 -0
  26. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/manager.py +0 -0
  27. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/registry.py +0 -0
  28. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/config/utils.py +0 -0
  29. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/constants.py +0 -0
  30. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/contextvars.py +0 -0
  31. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/db_engine.py +0 -0
  32. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/enums.py +0 -0
  33. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/exception/__init__.py +0 -0
  34. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/exception/base.py +0 -0
  35. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/exception/exception_handler.py +0 -0
  36. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/exception/exception_manager.py +0 -0
  37. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/i18n/__init__.py +0 -0
  38. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/i18n/manager.py +0 -0
  39. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/i18n/messages.py +0 -0
  40. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/i18n/types.py +0 -0
  41. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/i18n/utils.py +0 -0
  42. {fastlib_py-0.3.2/fastlib/mapper/impl → fastlib_py-0.3.4/fastlib/mapper}/__init__.py +0 -0
  43. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/mapper/base_mapper.py +0 -0
  44. {fastlib_py-0.3.2/fastlib/service → fastlib_py-0.3.4/fastlib/mapper/impl}/__init__.py +0 -0
  45. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/mapper/impl/base_mapper_impl.py +0 -0
  46. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/middleware/__init__.py +0 -0
  47. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/middleware/db_session.py +0 -0
  48. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/middleware/i18n.py +0 -0
  49. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/middleware/jwt.py +0 -0
  50. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/migrate.py +0 -0
  51. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/openapi.py +0 -0
  52. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/py.typed +0 -0
  53. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/request.py +0 -0
  54. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/response.py +0 -0
  55. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/router.py +0 -0
  56. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/schema.py +0 -0
  57. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/security/__init__.py +0 -0
  58. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/security/security.py +0 -0
  59. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/security/utils.py +0 -0
  60. {fastlib_py-0.3.2/fastlib/service/impl → fastlib_py-0.3.4/fastlib/service}/__init__.py +0 -0
  61. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/service/base_service.py +0 -0
  62. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/service/impl/base_service_impl.py +0 -0
  63. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/stream/__init__.py +0 -0
  64. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/stream/enums.py +0 -0
  65. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/stream/event.py +0 -0
  66. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/stream/handler.py +0 -0
  67. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/stream/schema.py +0 -0
  68. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/stream/sse.py +0 -0
  69. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/__init__.py +0 -0
  70. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/excel_util.py +0 -0
  71. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/file_util.py +0 -0
  72. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/http_util.py +0 -0
  73. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/ip_util.py +0 -0
  74. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/snowflake_util.py +0 -0
  75. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib/utils/str_util.py +0 -0
  76. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib_py.egg-info/dependency_links.txt +0 -0
  77. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib_py.egg-info/requires.txt +0 -0
  78. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/fastlib_py.egg-info/top_level.txt +0 -0
  79. {fastlib_py-0.3.2 → fastlib_py-0.3.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastlib-py
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: Fastlib, high performance, easy to use, fast to code, ready for production
5
5
  Author-email: tyvekZhang <tyvekzhang@gmail.com>
6
6
  Maintainer-email: tyvekZhang <tyvekzhang@gmail.com>
@@ -1,14 +1,12 @@
1
1
  # SPDX-License-Identifier: MIT
2
2
  """Fastlib Application Libraries Package."""
3
3
 
4
+ from ._logging.config import LogConfig as LogConfig
4
5
  from .config import ConfigManager as ConfigManager
5
- from .logging import LogConfig as LogConfig
6
- from .logging import Logger as Logger
7
6
  from .openapi import register_offline_openapi as register_offline_openapi
8
7
 
9
8
  __all__ = [
10
9
  "ConfigManager",
11
- "Logger",
12
10
  "LogConfig",
13
11
  "register_offline_openapi",
14
12
  ]
@@ -10,7 +10,7 @@ from typing import Optional
10
10
  from loguru import logger
11
11
 
12
12
  from fastlib.config.manager import ConfigManager
13
- from fastlib.logging.config import LogConfig
13
+ from fastlib._logging.config import LogConfig
14
14
 
15
15
 
16
16
  class Logger:
@@ -0,0 +1,7 @@
1
+ # SPDX-License-Identifier: MIT
2
+ """
3
+ Logging module
4
+ """
5
+ from ._logging.handlers import Logger
6
+
7
+ logger = Logger.initialize()
File without changes
@@ -0,0 +1,51 @@
1
+ # SPDX-License-Identifier: MIT
2
+ """
3
+ Validation service module for Pydantic models.
4
+ """
5
+
6
+ from typing import Optional
7
+ from pydantic import BaseModel, ValidationError
8
+
9
+
10
+ class ValidateService:
11
+ """A service class providing validation utilities for Pydantic models."""
12
+
13
+ @staticmethod
14
+ def validate(obj: BaseModel) -> Optional[str]:
15
+ """Validate a Pydantic model instance.
16
+
17
+ Args:
18
+ obj: The Pydantic BaseModel instance to validate.
19
+
20
+ Returns:
21
+ Optional[str]: None if validation passes, otherwise a comma-separated string
22
+ of validation error messages.
23
+ """
24
+ try:
25
+ # Call Pydantic's validation logic (for Pydantic v2.x)
26
+ obj.model_validate() # For v2.x Pydantic
27
+ return None
28
+ except ValidationError as e:
29
+ # Concatenate error messages
30
+ errors = ", ".join(
31
+ [f"{'->'.join(map(str, error['loc']))}: {error['msg']}" for error in e.errors()]
32
+ )
33
+ return errors
34
+
35
+ @staticmethod
36
+ def get_validate_err_msg(e: ValidationError) -> Optional[str]:
37
+ """Format validation error messages from a ValidationError exception.
38
+
39
+ Args:
40
+ e: The ValidationError exception containing validation errors.
41
+
42
+ Returns:
43
+ Optional[str]: A comma-separated string of formatted error messages,
44
+ or None if no errors exist.
45
+ """
46
+ err_msg = []
47
+ for error in e.errors():
48
+ field = " -> ".join(map(str, error["loc"])) # Field path
49
+ message = error["message"] # Error description
50
+ err_msg.append(f"Error in field '{field}': {message}")
51
+ return ",".join(err_msg)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastlib-py
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: Fastlib, high performance, easy to use, fast to code, ready for production
5
5
  Author-email: tyvekZhang <tyvekzhang@gmail.com>
6
6
  Maintainer-email: tyvekZhang <tyvekzhang@gmail.com>
@@ -6,6 +6,7 @@ fastlib/constants.py
6
6
  fastlib/contextvars.py
7
7
  fastlib/db_engine.py
8
8
  fastlib/enums.py
9
+ fastlib/logging.py
9
10
  fastlib/migrate.py
10
11
  fastlib/openapi.py
11
12
  fastlib/py.typed
@@ -13,6 +14,9 @@ fastlib/request.py
13
14
  fastlib/response.py
14
15
  fastlib/router.py
15
16
  fastlib/schema.py
17
+ fastlib/_logging/__init__.py
18
+ fastlib/_logging/config.py
19
+ fastlib/_logging/handlers.py
16
20
  fastlib/cache/__init__.py
17
21
  fastlib/cache/_disk_cache.py
18
22
  fastlib/cache/_redis_cache.py
@@ -36,9 +40,6 @@ fastlib/i18n/manager.py
36
40
  fastlib/i18n/messages.py
37
41
  fastlib/i18n/types.py
38
42
  fastlib/i18n/utils.py
39
- fastlib/logging/__init__.py
40
- fastlib/logging/config.py
41
- fastlib/logging/handlers.py
42
43
  fastlib/mapper/__init__.py
43
44
  fastlib/mapper/base_mapper.py
44
45
  fastlib/mapper/impl/__init__.py
@@ -67,6 +68,7 @@ fastlib/utils/http_util.py
67
68
  fastlib/utils/ip_util.py
68
69
  fastlib/utils/snowflake_util.py
69
70
  fastlib/utils/str_util.py
71
+ fastlib/utils/validate_util.py
70
72
  fastlib_py.egg-info/PKG-INFO
71
73
  fastlib_py.egg-info/SOURCES.txt
72
74
  fastlib_py.egg-info/dependency_links.txt
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fastlib-py"
3
- version = "0.3.2"
3
+ version = "0.3.4"
4
4
  description = "Fastlib, high performance, easy to use, fast to code, ready for production"
5
5
  readme = "README.md"
6
6
  keywords = [
@@ -1,12 +0,0 @@
1
- # SPDX-License-Identifier: MIT
2
- """
3
- Logging module
4
- """
5
-
6
- from .config import LogConfig
7
- from .handlers import Logger
8
-
9
- __all__ = [
10
- "LogConfig",
11
- "Logger",
12
- ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes