MeUtils 2024.12.12.17.3.48__py3-none-any.whl → 2024.12.12.19.4.48__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.
- {MeUtils-2024.12.12.17.3.48.dist-info → MeUtils-2024.12.12.19.4.48.dist-info}/METADATA +26 -26
- {MeUtils-2024.12.12.17.3.48.dist-info → MeUtils-2024.12.12.19.4.48.dist-info}/RECORD +8 -8
- meutils/config_utils/manager.py +109 -0
- meutils/data/VERSION +1 -1
- meutils/config_utils/config_manager.py +0 -77
- {MeUtils-2024.12.12.17.3.48.dist-info → MeUtils-2024.12.12.19.4.48.dist-info}/LICENSE +0 -0
- {MeUtils-2024.12.12.17.3.48.dist-info → MeUtils-2024.12.12.19.4.48.dist-info}/WHEEL +0 -0
- {MeUtils-2024.12.12.17.3.48.dist-info → MeUtils-2024.12.12.19.4.48.dist-info}/entry_points.txt +0 -0
- {MeUtils-2024.12.12.17.3.48.dist-info → MeUtils-2024.12.12.19.4.48.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: MeUtils
|
3
|
-
Version: 2024.12.12.
|
3
|
+
Version: 2024.12.12.19.4.48
|
4
4
|
Summary: description
|
5
5
|
Home-page: https://github.com/yuanjie-ai/MeUtils
|
6
6
|
Author: yuanjie
|
@@ -62,42 +62,42 @@ Requires-Dist: sse-starlette ; extra == 'ai'
|
|
62
62
|
Requires-Dist: openai ; extra == 'ai'
|
63
63
|
Requires-Dist: langchain ; extra == 'ai'
|
64
64
|
Provides-Extra: all
|
65
|
-
Requires-Dist:
|
66
|
-
Requires-Dist: langchain ; extra == 'all'
|
67
|
-
Requires-Dist: asyncmy ; extra == 'all'
|
68
|
-
Requires-Dist: pymongo ; extra == 'all'
|
65
|
+
Requires-Dist: jinja2 ; extra == 'all'
|
69
66
|
Requires-Dist: fastapi[all] ; extra == 'all'
|
70
|
-
Requires-Dist: geopy ; extra == 'all'
|
71
67
|
Requires-Dist: redis-py-cluster ; extra == 'all'
|
72
|
-
Requires-Dist:
|
68
|
+
Requires-Dist: langchain ; extra == 'all'
|
69
|
+
Requires-Dist: fastapi ; extra == 'all'
|
70
|
+
Requires-Dist: cachetools ; extra == 'all'
|
71
|
+
Requires-Dist: pymongo ; extra == 'all'
|
72
|
+
Requires-Dist: asyncmy ; extra == 'all'
|
73
|
+
Requires-Dist: pymysql ; extra == 'all'
|
73
74
|
Requires-Dist: gunicorn ; extra == 'all'
|
74
75
|
Requires-Dist: pymilvus ; extra == 'all'
|
75
|
-
Requires-Dist:
|
76
|
-
Requires-Dist:
|
76
|
+
Requires-Dist: reportlab ; extra == 'all'
|
77
|
+
Requires-Dist: pandas-profiling[notebook] ; extra == 'all'
|
77
78
|
Requires-Dist: pandas-summary ; extra == 'all'
|
78
|
-
Requires-Dist: streamlit ; extra == 'all'
|
79
|
-
Requires-Dist: faiss-cpu ; extra == 'all'
|
80
79
|
Requires-Dist: pymupd ; extra == 'all'
|
81
|
-
Requires-Dist:
|
82
|
-
Requires-Dist:
|
83
|
-
Requires-Dist: filetype ; extra == 'all'
|
84
|
-
Requires-Dist: cachetools ; extra == 'all'
|
85
|
-
Requires-Dist: reportlab ; extra == 'all'
|
86
|
-
Requires-Dist: schedule ; extra == 'all'
|
80
|
+
Requires-Dist: pyarrow ; extra == 'all'
|
81
|
+
Requires-Dist: sse-starlette ; extra == 'all'
|
87
82
|
Requires-Dist: iteration-utilities ; extra == 'all'
|
83
|
+
Requires-Dist: pretty-errors ; extra == 'all'
|
84
|
+
Requires-Dist: schedule ; extra == 'all'
|
85
|
+
Requires-Dist: seaborn ; extra == 'all'
|
86
|
+
Requires-Dist: missingno ; extra == 'all'
|
87
|
+
Requires-Dist: openai ; extra == 'all'
|
88
88
|
Requires-Dist: uvicorn ; extra == 'all'
|
89
|
+
Requires-Dist: faiss-cpu ; extra == 'all'
|
90
|
+
Requires-Dist: thriftpy2 ; extra == 'all'
|
89
91
|
Requires-Dist: jmespath ; extra == 'all'
|
90
|
-
Requires-Dist: pymysql ; extra == 'all'
|
91
|
-
Requires-Dist: missingno ; extra == 'all'
|
92
|
-
Requires-Dist: thefuck ; extra == 'all'
|
93
92
|
Requires-Dist: simplejson ; extra == 'all'
|
94
|
-
Requires-Dist:
|
95
|
-
Requires-Dist:
|
96
|
-
Requires-Dist:
|
97
|
-
Requires-Dist:
|
93
|
+
Requires-Dist: streamlit ; extra == 'all'
|
94
|
+
Requires-Dist: polars ; extra == 'all'
|
95
|
+
Requires-Dist: sqlalchemy ; extra == 'all'
|
96
|
+
Requires-Dist: jieba ; extra == 'all'
|
97
|
+
Requires-Dist: thefuck ; extra == 'all'
|
98
|
+
Requires-Dist: filetype ; extra == 'all'
|
98
99
|
Requires-Dist: dataframe-image ; extra == 'all'
|
99
|
-
Requires-Dist:
|
100
|
-
Requires-Dist: fastapi ; extra == 'all'
|
100
|
+
Requires-Dist: geopy ; extra == 'all'
|
101
101
|
Provides-Extra: ann
|
102
102
|
Requires-Dist: pymilvus ; extra == 'ann'
|
103
103
|
Requires-Dist: faiss-cpu ; extra == 'ann'
|
@@ -471,7 +471,7 @@ meutils/cmds/subprocess_demo.py,sha256=oTeTIx8k6XwtOT6hZpmy9XNcRErzilqWcdoxcrVcH
|
|
471
471
|
meutils/comp_utils/__init__.py,sha256=Q4BW-gHnOUiSSpupHsprsOAPp4kuBLcH60sL1RfS3PQ,361
|
472
472
|
meutils/comp_utils/reverse_metric.py,sha256=qwcGgiHhaupIJER4gO0HQhhO07FDLFv-vfFhg6K6Q4s,1705
|
473
473
|
meutils/config_utils/__init__.py,sha256=GhgsStfGJDC8F_YgC6X5Jnj9HkgXJXxeYiJWTAkWKTo,271
|
474
|
-
meutils/config_utils/
|
474
|
+
meutils/config_utils/manager.py,sha256=li3NgSfbO3-QTo5NPkMD3Hl5dnEr5q_J5F2WgmyhRqk,3106
|
475
475
|
meutils/config_utils/nacosx.py,sha256=5x6WlCvjExaA7R9moBxc3DV9l1oFTtNazC6pObaYjMg,1110
|
476
476
|
meutils/config_utils/lark_utils/__init__.py,sha256=Gf-5Y8uZiqY9jdbfiIboL92MQjOTOo0ZZ245PGxCbaY,297
|
477
477
|
meutils/config_utils/lark_utils/common.py,sha256=WB1VKB3vdYyzqWosp5T-7uBIupNXl1L7SM3Lf5GRaOU,14274
|
@@ -479,7 +479,7 @@ meutils/config_utils/lark_utils/demo.py,sha256=3g0Fs7oLaeW75T60gYWMLgyNg1OnfOjfH
|
|
479
479
|
meutils/config_utils/lark_utils/x.py,sha256=MlMQGhehP9xMEgetxVCX68XFaosfKoW1JA5cZ3JqN2w,1857
|
480
480
|
meutils/crawlers/__init__.py,sha256=TBU4xA-IOsHV-0yIkW7YXxn_QT7TT8NncqxO7IykEfs,271
|
481
481
|
meutils/data/SimHei.ttf,sha256=-XEnekS5yHP_URkT4XBI2w22ylV-KxudhkeIYFbrILA,10062565
|
482
|
-
meutils/data/VERSION,sha256=
|
482
|
+
meutils/data/VERSION,sha256=dVfZd2A1H6Eivbd-XprrXnpN0aIbQ359KN1yqy-9m5A,19
|
483
483
|
meutils/data/_FLAG,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
484
484
|
meutils/data/_SUCCESS,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
485
485
|
meutils/data/__init__.py,sha256=Hfwkkxs4zHqKhxht0YrhS566a9P5axtmgNvM5wF8ceQ,243
|
@@ -816,9 +816,9 @@ meutils/tools/seize.py,sha256=nOKAS63w-Lbi48I0m2MPhdsokUTwxco0laPxYVmW4Mw,1064
|
|
816
816
|
meutils/tools/service_monitor.py,sha256=ibsLtBN2g2DL7ZnLJ8vhiZOiOcqTAyx711djDdBK-3M,1255
|
817
817
|
meutils/tools/sys_monitor.py,sha256=6MoyzrItqDUOSjfHcMJmMofQkEPTW36CT_aKui0rg84,429
|
818
818
|
meutils/tools/token_monitor.py,sha256=Np-YK-R4P4IPAXyZvMxwvXI4sFmNJQAQK1lSegNaYpA,997
|
819
|
-
MeUtils-2024.12.12.
|
820
|
-
MeUtils-2024.12.12.
|
821
|
-
MeUtils-2024.12.12.
|
822
|
-
MeUtils-2024.12.12.
|
823
|
-
MeUtils-2024.12.12.
|
824
|
-
MeUtils-2024.12.12.
|
819
|
+
MeUtils-2024.12.12.19.4.48.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
820
|
+
MeUtils-2024.12.12.19.4.48.dist-info/METADATA,sha256=Jv1oYUjQjZ-E2BC4oZs_08Aq1pDdkB3333xZvh-lKOU,6170
|
821
|
+
MeUtils-2024.12.12.19.4.48.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
822
|
+
MeUtils-2024.12.12.19.4.48.dist-info/entry_points.txt,sha256=lufZlBHRqqZKdY-ZQJ4CSZb0qhV5hQC37egZna9M7ug,357
|
823
|
+
MeUtils-2024.12.12.19.4.48.dist-info/top_level.txt,sha256=cInfxMmkgNOskurdjwP5unau4rA7Uw48nu07tYhS7KY,22
|
824
|
+
MeUtils-2024.12.12.19.4.48.dist-info/RECORD,,
|
@@ -0,0 +1,109 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# @Project : AI. @by PyCharm
|
4
|
+
# @File : config_manager
|
5
|
+
# @Time : 2024/12/4 12:07
|
6
|
+
# @Author : betterme
|
7
|
+
# @WeChat : meutils
|
8
|
+
# @Software : PyCharm
|
9
|
+
# @Description :
|
10
|
+
|
11
|
+
import nacos
|
12
|
+
from meutils.pipe import *
|
13
|
+
|
14
|
+
|
15
|
+
class Manager(object):
|
16
|
+
_instance = None
|
17
|
+
_config: str = ""
|
18
|
+
|
19
|
+
def __new__(cls, *args):
|
20
|
+
if cls._instance is None:
|
21
|
+
cls._instance = super().__new__(cls)
|
22
|
+
return cls._instance
|
23
|
+
|
24
|
+
def __init__(self, namespace: str, data_id: str, group: str = "DEFAULT_GROUP", ):
|
25
|
+
NACOS_URL = os.getenv("NACOS_URL")
|
26
|
+
assert NACOS_URL
|
27
|
+
if NACOS_URL:
|
28
|
+
server_addresses = NACOS_URL.split('@')[1]
|
29
|
+
username, password = NACOS_URL.split('@')[0].split(":")
|
30
|
+
|
31
|
+
# Nacos客户端配置
|
32
|
+
self.client = nacos.NacosClient(
|
33
|
+
server_addresses=server_addresses, # Nacos服务器地址
|
34
|
+
namespace=namespace, # 命名空间
|
35
|
+
username=username, # 用户名
|
36
|
+
password=password # 密码
|
37
|
+
)
|
38
|
+
|
39
|
+
self.init_config(data_id, group)
|
40
|
+
|
41
|
+
def init_config(self, data_id: str, group: str = "DEFAULT_GROUP"):
|
42
|
+
"""初始化配置并添加监听器"""
|
43
|
+
# 获取初始配置
|
44
|
+
config = self.client.get_config(data_id, group)
|
45
|
+
logger.info(f"初始配置\n{config}")
|
46
|
+
if config:
|
47
|
+
self._config = config
|
48
|
+
|
49
|
+
# 添加配置变更监听器
|
50
|
+
self.client.add_config_watcher(
|
51
|
+
data_id,
|
52
|
+
group,
|
53
|
+
self._config_changed_callback
|
54
|
+
)
|
55
|
+
|
56
|
+
def _config_changed_callback(self, args):
|
57
|
+
"""配置变更回调函数"""
|
58
|
+
logger.debug(f"配置发生变更: {json.dumps(args, indent=4)}")
|
59
|
+
# {'data_id': 'testdata', 'group': 'DEFAULT_GROUP', 'namespace': 'test', 'raw_content': 'sk-\nsk-',
|
60
|
+
# 'content': 'sk-\nsk-'}
|
61
|
+
self._config = args['content']
|
62
|
+
|
63
|
+
@property
|
64
|
+
def text(self) -> str:
|
65
|
+
"""获取当前配置: 原始内容"""
|
66
|
+
return self._config
|
67
|
+
|
68
|
+
@property
|
69
|
+
def json(self) -> Dict[str, Any]:
|
70
|
+
text = self._config
|
71
|
+
try:
|
72
|
+
return json.loads(text)
|
73
|
+
except json.decoder.JSONDecodeError as e:
|
74
|
+
logger.warning(f"标准json 配置加载失败: {e}")
|
75
|
+
|
76
|
+
logger.debug(f"尝试用json_repair解析")
|
77
|
+
return json_repair.repair_json(text, return_objects=True)
|
78
|
+
|
79
|
+
@property
|
80
|
+
def yaml(self) -> Dict[str, Any]:
|
81
|
+
text = self._config
|
82
|
+
|
83
|
+
try:
|
84
|
+
return yaml.safe_load(text)
|
85
|
+
except Exception as e:
|
86
|
+
logger.error(f"yaml 配置加载失败: {e}")
|
87
|
+
|
88
|
+
@property
|
89
|
+
def xml(self):
|
90
|
+
return self._config
|
91
|
+
|
92
|
+
@property
|
93
|
+
def html(self):
|
94
|
+
return self._config
|
95
|
+
|
96
|
+
@property
|
97
|
+
def properties(self):
|
98
|
+
return self._config
|
99
|
+
|
100
|
+
|
101
|
+
if __name__ == '__main__':
|
102
|
+
# 初始化配置管理器
|
103
|
+
namespace = 'test'
|
104
|
+
data_id = "testdata"
|
105
|
+
|
106
|
+
manager = Manager(namespace, data_id)
|
107
|
+
# manager_ = Manager(namespace, data_id, group)
|
108
|
+
|
109
|
+
print(manager.text)
|
meutils/data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2024.12.12.
|
1
|
+
2024.12.12.19.04.48
|
@@ -1,77 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
# @Project : AI. @by PyCharm
|
4
|
-
# @File : config_manager
|
5
|
-
# @Time : 2024/12/4 12:07
|
6
|
-
# @Author : betterme
|
7
|
-
# @WeChat : meutils
|
8
|
-
# @Software : PyCharm
|
9
|
-
# @Description :
|
10
|
-
|
11
|
-
import nacos
|
12
|
-
import yaml
|
13
|
-
|
14
|
-
from meutils.pipe import *
|
15
|
-
|
16
|
-
|
17
|
-
class ConfigManager:
|
18
|
-
_instance = None
|
19
|
-
_config: Dict[str, Any] = {}
|
20
|
-
|
21
|
-
def __new__(cls):
|
22
|
-
if cls._instance is None:
|
23
|
-
cls._instance = super().__new__(cls)
|
24
|
-
return cls._instance
|
25
|
-
|
26
|
-
def __init__(self):
|
27
|
-
# Nacos客户端配置
|
28
|
-
self.client = nacos.NacosClient(
|
29
|
-
server_addresses="nacos.chatfire.cc", # Nacos服务器地址
|
30
|
-
namespace="test", # 命名空间
|
31
|
-
username="chatfire", # 用户名
|
32
|
-
password="chatfirechatfire" # 密码
|
33
|
-
)
|
34
|
-
|
35
|
-
def init_config(self, data_id: str, group: str = "DEFAULT_GROUP"):
|
36
|
-
"""初始化配置并添加监听器"""
|
37
|
-
# 获取初始配置
|
38
|
-
config = self.client.get_config(data_id, group)
|
39
|
-
logger.debug(config)
|
40
|
-
|
41
|
-
if config:
|
42
|
-
self._config = yaml.safe_load(config)
|
43
|
-
|
44
|
-
# 添加配置变更监听器
|
45
|
-
self.client.add_config_watcher(
|
46
|
-
data_id,
|
47
|
-
group,
|
48
|
-
self._config_changed_callback
|
49
|
-
)
|
50
|
-
|
51
|
-
def _config_changed_callback(self, args):
|
52
|
-
"""配置变更回调函数"""
|
53
|
-
print(f"配置发生变更: {args}")
|
54
|
-
try:
|
55
|
-
self._config = yaml.safe_load(args['content'])
|
56
|
-
print(f"最新配置: {self._config}")
|
57
|
-
except Exception as e:
|
58
|
-
print(f"配置更新失败: {e}")
|
59
|
-
|
60
|
-
@property
|
61
|
-
def config(self) -> Dict[str, Any]:
|
62
|
-
"""获取当前配置"""
|
63
|
-
return self._config
|
64
|
-
|
65
|
-
|
66
|
-
if __name__ == '__main__':
|
67
|
-
# 初始化配置管理器
|
68
|
-
|
69
|
-
data_id = "testdata"
|
70
|
-
group = "DEFAULT_GROUP"
|
71
|
-
|
72
|
-
config_manager = ConfigManager()
|
73
|
-
config_manager.init_config(
|
74
|
-
data_id=data_id, # 配置ID
|
75
|
-
)
|
76
|
-
|
77
|
-
# yaml.safe_load("- 1")
|
File without changes
|
File without changes
|
{MeUtils-2024.12.12.17.3.48.dist-info → MeUtils-2024.12.12.19.4.48.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|