MeUtils 2024.12.6.10.36.57__py3-none-any.whl → 2024.12.6.13.38.47__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.6.10.36.57.dist-info → MeUtils-2024.12.6.13.38.47.dist-info}/METADATA +27 -27
- {MeUtils-2024.12.6.10.36.57.dist-info → MeUtils-2024.12.6.13.38.47.dist-info}/RECORD +11 -8
- examples/cache_demo/HermesCache_demo.py +67 -0
- examples/caches/__init__.py +11 -0
- meutils/async_task/utils.py +12 -6
- meutils/cache/redis_cache.py +21 -0
- meutils/data/VERSION +1 -1
- {MeUtils-2024.12.6.10.36.57.dist-info → MeUtils-2024.12.6.13.38.47.dist-info}/LICENSE +0 -0
- {MeUtils-2024.12.6.10.36.57.dist-info → MeUtils-2024.12.6.13.38.47.dist-info}/WHEEL +0 -0
- {MeUtils-2024.12.6.10.36.57.dist-info → MeUtils-2024.12.6.13.38.47.dist-info}/entry_points.txt +0 -0
- {MeUtils-2024.12.6.10.36.57.dist-info → MeUtils-2024.12.6.13.38.47.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.6.
|
3
|
+
Version: 2024.12.6.13.38.47
|
4
4
|
Summary: description
|
5
5
|
Home-page: https://github.com/yuanjie-ai/MeUtils
|
6
6
|
Author: yuanjie
|
@@ -61,42 +61,42 @@ Requires-Dist: sse-starlette ; extra == 'ai'
|
|
61
61
|
Requires-Dist: openai ; extra == 'ai'
|
62
62
|
Requires-Dist: langchain ; extra == 'ai'
|
63
63
|
Provides-Extra: all
|
64
|
-
Requires-Dist:
|
65
|
-
Requires-Dist: pymupd ; extra == 'all'
|
66
|
-
Requires-Dist: polars ; extra == 'all'
|
64
|
+
Requires-Dist: uvicorn ; extra == 'all'
|
67
65
|
Requires-Dist: seaborn ; extra == 'all'
|
68
|
-
Requires-Dist: geopy ; extra == 'all'
|
69
|
-
Requires-Dist: fastapi[all] ; extra == 'all'
|
70
|
-
Requires-Dist: sse-starlette ; extra == 'all'
|
71
|
-
Requires-Dist: pymilvus ; extra == 'all'
|
72
66
|
Requires-Dist: gunicorn ; extra == 'all'
|
73
|
-
Requires-Dist:
|
74
|
-
Requires-Dist:
|
75
|
-
Requires-Dist:
|
67
|
+
Requires-Dist: jieba ; extra == 'all'
|
68
|
+
Requires-Dist: reportlab ; extra == 'all'
|
69
|
+
Requires-Dist: filetype ; extra == 'all'
|
70
|
+
Requires-Dist: asyncmy ; extra == 'all'
|
71
|
+
Requires-Dist: fastapi[all] ; extra == 'all'
|
72
|
+
Requires-Dist: pandas-profiling[notebook] ; extra == 'all'
|
76
73
|
Requires-Dist: streamlit ; extra == 'all'
|
77
|
-
Requires-Dist:
|
78
|
-
Requires-Dist: uvicorn ; extra == 'all'
|
79
|
-
Requires-Dist: thriftpy2 ; extra == 'all'
|
80
|
-
Requires-Dist: pandas-summary ; extra == 'all'
|
74
|
+
Requires-Dist: openai ; extra == 'all'
|
81
75
|
Requires-Dist: pyarrow ; extra == 'all'
|
82
76
|
Requires-Dist: redis-py-cluster ; extra == 'all'
|
83
|
-
Requires-Dist:
|
84
|
-
Requires-Dist: dataframe-image ; extra == 'all'
|
85
|
-
Requires-Dist: jieba ; extra == 'all'
|
86
|
-
Requires-Dist: filetype ; extra == 'all'
|
87
|
-
Requires-Dist: jmespath ; extra == 'all'
|
88
|
-
Requires-Dist: reportlab ; extra == 'all'
|
77
|
+
Requires-Dist: iteration-utilities ; extra == 'all'
|
89
78
|
Requires-Dist: simplejson ; extra == 'all'
|
90
|
-
Requires-Dist:
|
91
|
-
Requires-Dist:
|
79
|
+
Requires-Dist: sqlalchemy ; extra == 'all'
|
80
|
+
Requires-Dist: geopy ; extra == 'all'
|
81
|
+
Requires-Dist: pandas-summary ; extra == 'all'
|
92
82
|
Requires-Dist: langchain ; extra == 'all'
|
93
|
-
Requires-Dist:
|
94
|
-
Requires-Dist:
|
95
|
-
Requires-Dist:
|
83
|
+
Requires-Dist: pymupd ; extra == 'all'
|
84
|
+
Requires-Dist: thriftpy2 ; extra == 'all'
|
85
|
+
Requires-Dist: faiss-cpu ; extra == 'all'
|
96
86
|
Requires-Dist: schedule ; extra == 'all'
|
97
|
-
Requires-Dist:
|
87
|
+
Requires-Dist: jinja2 ; extra == 'all'
|
88
|
+
Requires-Dist: pretty-errors ; extra == 'all'
|
89
|
+
Requires-Dist: dataframe-image ; extra == 'all'
|
90
|
+
Requires-Dist: jmespath ; extra == 'all'
|
98
91
|
Requires-Dist: thefuck ; extra == 'all'
|
92
|
+
Requires-Dist: fastapi ; extra == 'all'
|
93
|
+
Requires-Dist: sse-starlette ; extra == 'all'
|
94
|
+
Requires-Dist: polars ; extra == 'all'
|
95
|
+
Requires-Dist: pymongo ; extra == 'all'
|
99
96
|
Requires-Dist: pymysql ; extra == 'all'
|
97
|
+
Requires-Dist: cachetools ; extra == 'all'
|
98
|
+
Requires-Dist: missingno ; extra == 'all'
|
99
|
+
Requires-Dist: pymilvus ; extra == 'all'
|
100
100
|
Provides-Extra: ann
|
101
101
|
Requires-Dist: pymilvus ; extra == 'ann'
|
102
102
|
Requires-Dist: faiss-cpu ; extra == 'ann'
|
@@ -129,10 +129,12 @@ examples/apis/x.py,sha256=9Ikk04WyxfGpWsp0zp5izYd9OOuPUmb_aNj9DjBTG54,349
|
|
129
129
|
examples/apis/xx.py,sha256=seiBYTFL8iEqSFNcNjIYuwNa4jpqc9YoO7QWBIOdSzU,350
|
130
130
|
examples/arq_demo/__init__.py,sha256=HE2-lA6x7oAvEJRzR9yrEwGuTze_jMUBoeO1Mv7wdGY,271
|
131
131
|
examples/arq_demo/demo.py,sha256=AHiXlio3nom3I1Zb0pdSbOum3L8HHF_6sg5F-EwGJ5g,1389
|
132
|
+
examples/cache_demo/HermesCache_demo.py,sha256=rHqBDNuOBfiTBEuS3EFuc0To8fuaixvl64UISY6bSkQ,1273
|
132
133
|
examples/cache_demo/__init__.py,sha256=zYdsVkzlPyaHOyG9HpW_AMriiEH_Pi8AmLUOS7Jbguk,961
|
133
134
|
examples/cache_demo/acacge.py,sha256=rlwMWUO4tWi9Y-gXnFUsRn__N_AaPP0icDlwDAYcf1Y,577
|
134
135
|
examples/cache_demo/demo.py,sha256=iGuQTfV23eqtGIB8QqfQYa7qRNGPxqkUNAcws-fsh60,2528
|
135
136
|
examples/cache_demo/test.py,sha256=gWY_oMf76RSqXdTHGOCcd-7cObkw8X1hovSVPHeyjkk,427
|
137
|
+
examples/caches/__init__.py,sha256=vUpPT-UpH1mFDO2gv5mI7hACcBJYMiIgmb2r4Pr2yUo,271
|
136
138
|
examples/celery_demo/__init__.py,sha256=d3jEYE9LZjFyMly5Djp5vVMlDcmWL5IE6vQoK-tVgK0,271
|
137
139
|
examples/celery_demo/producer.py,sha256=py3Tjcb140zc5mzOGbxf2QIV6ZsXLPX1gjOnHXGysvk,342
|
138
140
|
examples/celery_demo/product_task.py,sha256=4N-sBDtdbb3kneg0zBHB9nlNv-fZltDZOwI1bRAf8AE,382
|
@@ -424,7 +426,7 @@ meutils/async_task/__init__.py,sha256=45cUr-GWvQ1JFYGOYPOIkHLyTR3JbfP_PEYrmktpML
|
|
424
426
|
meutils/async_task/celery_config.py,sha256=BX1h3jY34aO6UmUFakdBUwOdsEiOxCGuUtYDUKFtafc,3461
|
425
427
|
meutils/async_task/common.py,sha256=ZJ4e0CsEJf1ppPmGSwPCwhZBAkUL5xsi_t1ny-bJuko,845
|
426
428
|
meutils/async_task/demo_create_tasks.py,sha256=E4FfVl_2RRdlHlPSp4jzo0GAonpFwD0juIvRTfIT3zs,2811
|
427
|
-
meutils/async_task/utils.py,sha256=
|
429
|
+
meutils/async_task/utils.py,sha256=3y-dl0hwGFJAqm4ZsGRIudqjMAL97bJHRkG27ZlrWuM,6126
|
428
430
|
meutils/async_task/通用设计.py,sha256=kGdrJHJu9VoOkyGHREn0KUtBTibAaLIcG0O6hEJNhLA,3232
|
429
431
|
meutils/async_task/tasks/__init__.py,sha256=flHRXJMdts_9az9T9V1c5l3Y-gaDD88COWrARr4WAKU,246
|
430
432
|
meutils/async_task/tasks/_all.py,sha256=Vz63k9yvgj-IBGjekm0u2t571TTT0nMRMqcPvPqJAbY,533
|
@@ -439,6 +441,7 @@ meutils/async_utils/background.py,sha256=dl6UaMIFBZDB1uxSZzGFJdSnpt3Xo0flK7gwsok
|
|
439
441
|
meutils/async_utils/common.py,sha256=WIQ7CVaZiaUeFA3IInM_4uaehJQiTdr_g3Q_8_yQrgc,4899
|
440
442
|
meutils/async_utils/test.py,sha256=lkZdgSzzgVg8hYVcaBNEJ3KBvFTEfjbXZVvtknQZsRQ,1155
|
441
443
|
meutils/cache/__init__.py,sha256=7ke7BKRUkp1raYrsgOIojHHdeHYNstw9APIdBNDNRzc,2129
|
444
|
+
meutils/cache/redis_cache.py,sha256=AOlhe30j_sVmR-DQ4Jkwzzq4hF5XOknp45GIUN4MNg4,503
|
442
445
|
meutils/clis/__init__.py,sha256=2Fhn43X8kFP6FpAnnAMiPcdnjUwQaukiIr2uGB6mGAY,279
|
443
446
|
meutils/clis/browser.py,sha256=eMQ-7LlFJN_Sqs0DMnCVulfdUv9aGhHm5drCViQm4CY,4511
|
444
447
|
meutils/clis/check_api.py,sha256=WKsLupPlM0PI6SzfVOwoqoYNEmOj_Jb-bsRDYA_SXsE,2367
|
@@ -467,7 +470,7 @@ meutils/config_utils/lark_utils/demo.py,sha256=3g0Fs7oLaeW75T60gYWMLgyNg1OnfOjfH
|
|
467
470
|
meutils/config_utils/lark_utils/x.py,sha256=MlMQGhehP9xMEgetxVCX68XFaosfKoW1JA5cZ3JqN2w,1857
|
468
471
|
meutils/crawlers/__init__.py,sha256=TBU4xA-IOsHV-0yIkW7YXxn_QT7TT8NncqxO7IykEfs,271
|
469
472
|
meutils/data/SimHei.ttf,sha256=-XEnekS5yHP_URkT4XBI2w22ylV-KxudhkeIYFbrILA,10062565
|
470
|
-
meutils/data/VERSION,sha256=
|
473
|
+
meutils/data/VERSION,sha256=3fylVji8UDp4adBlOcAOoFjZydzWzzd2wHDG6LINIF4,19
|
471
474
|
meutils/data/_FLAG,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
472
475
|
meutils/data/_SUCCESS,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
473
476
|
meutils/data/__init__.py,sha256=Hfwkkxs4zHqKhxht0YrhS566a9P5axtmgNvM5wF8ceQ,243
|
@@ -802,9 +805,9 @@ meutils/tools/seize.py,sha256=nOKAS63w-Lbi48I0m2MPhdsokUTwxco0laPxYVmW4Mw,1064
|
|
802
805
|
meutils/tools/service_monitor.py,sha256=ibsLtBN2g2DL7ZnLJ8vhiZOiOcqTAyx711djDdBK-3M,1255
|
803
806
|
meutils/tools/sys_monitor.py,sha256=6MoyzrItqDUOSjfHcMJmMofQkEPTW36CT_aKui0rg84,429
|
804
807
|
meutils/tools/token_monitor.py,sha256=Np-YK-R4P4IPAXyZvMxwvXI4sFmNJQAQK1lSegNaYpA,997
|
805
|
-
MeUtils-2024.12.6.
|
806
|
-
MeUtils-2024.12.6.
|
807
|
-
MeUtils-2024.12.6.
|
808
|
-
MeUtils-2024.12.6.
|
809
|
-
MeUtils-2024.12.6.
|
810
|
-
MeUtils-2024.12.6.
|
808
|
+
MeUtils-2024.12.6.13.38.47.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
809
|
+
MeUtils-2024.12.6.13.38.47.dist-info/METADATA,sha256=PXOpJaS8KfYgVyBal0P8gqEJDx7e6joYRN7l65YdemM,6143
|
810
|
+
MeUtils-2024.12.6.13.38.47.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
811
|
+
MeUtils-2024.12.6.13.38.47.dist-info/entry_points.txt,sha256=lufZlBHRqqZKdY-ZQJ4CSZb0qhV5hQC37egZna9M7ug,357
|
812
|
+
MeUtils-2024.12.6.13.38.47.dist-info/top_level.txt,sha256=cInfxMmkgNOskurdjwP5unau4rA7Uw48nu07tYhS7KY,22
|
813
|
+
MeUtils-2024.12.6.13.38.47.dist-info/RECORD,,
|
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# @Project : AI. @by PyCharm
|
4
|
+
# @File : HermesCache_tes
|
5
|
+
# @Time : 2024/12/6 10:40
|
6
|
+
# @Author : betterme
|
7
|
+
# @WeChat : meutils
|
8
|
+
# @Software : PyCharm
|
9
|
+
# @Description : https://hermescache.readthedocs.io/en/latest/
|
10
|
+
import asyncio
|
11
|
+
|
12
|
+
from meutils.pipe import *
|
13
|
+
import hermes.backend.redis
|
14
|
+
|
15
|
+
cache = hermes.Hermes(
|
16
|
+
hermes.backend.redis.Backend,
|
17
|
+
ttl=600,
|
18
|
+
host='localhost',
|
19
|
+
db=1,
|
20
|
+
)
|
21
|
+
|
22
|
+
hermes.Serialiser
|
23
|
+
|
24
|
+
|
25
|
+
@cache
|
26
|
+
def foo(a, b):
|
27
|
+
return a * b
|
28
|
+
|
29
|
+
@cache
|
30
|
+
async def func(x):
|
31
|
+
await asyncio.sleep(5)
|
32
|
+
logger.debug('异步函数')
|
33
|
+
return x
|
34
|
+
|
35
|
+
|
36
|
+
class Example:
|
37
|
+
|
38
|
+
@cache(tags=('math', 'power'), ttl=1200)
|
39
|
+
def bar(self, a, b):
|
40
|
+
return a ** b
|
41
|
+
|
42
|
+
@cache(tags=('math', 'avg'), key=lambda fn, a, b: f'avg:{a}:{b}')
|
43
|
+
def baz(self, a, b):
|
44
|
+
return (a + b) / 2
|
45
|
+
|
46
|
+
|
47
|
+
print(foo(2, 333))
|
48
|
+
|
49
|
+
example = Example()
|
50
|
+
print(example.bar(2, 10))
|
51
|
+
print(example.baz(2, 10))
|
52
|
+
|
53
|
+
foo.invalidate(2, 333)
|
54
|
+
example.bar.invalidate(2, 10)
|
55
|
+
example.baz.invalidate(2, 10)
|
56
|
+
|
57
|
+
cache.clean(['math']) # invalidate entries tagged 'math'
|
58
|
+
cache.clean() # flush cache
|
59
|
+
|
60
|
+
|
61
|
+
if __name__ == '__main__':
|
62
|
+
class Request(BaseModel):
|
63
|
+
a: str = "a"
|
64
|
+
|
65
|
+
class Config:
|
66
|
+
frozen = True
|
67
|
+
arun(func(1))
|
meutils/async_task/utils.py
CHANGED
@@ -108,12 +108,14 @@ async def get_task(
|
|
108
108
|
if not isinstance(remote_task_response, dict):
|
109
109
|
remote_task_response = remote_task_response.model_dump()
|
110
110
|
|
111
|
-
# logger.debug(response)
|
112
|
-
# logger.debug(remote_task_response)
|
111
|
+
# logger.debug(response.model_dump_json(indent=4))
|
112
|
+
# logger.debug(bjson(remote_task_response))
|
113
113
|
|
114
|
-
response.
|
115
|
-
# logger.debug(response)
|
114
|
+
_response = {**response.model_dump(), **remote_task_response}
|
116
115
|
|
116
|
+
response = response.construct(**_response)
|
117
|
+
|
118
|
+
# logger.debug(response.model_dump_json(indent=4))
|
117
119
|
|
118
120
|
else:
|
119
121
|
response = TaskResponse(
|
@@ -174,8 +176,9 @@ if __name__ == '__main__':
|
|
174
176
|
from meutils.async_task import worker, shared_task #######重要 需要识别到worker
|
175
177
|
|
176
178
|
from meutils.apis.kling import kolors_virtual_try_on
|
179
|
+
from meutils.async_task.tasks import hailuo
|
177
180
|
|
178
|
-
task_id = "
|
181
|
+
task_id = "7d4fbaf3-f641-482b-b02c-ccd30e61195a"
|
179
182
|
# filter_kwargs = {
|
180
183
|
# "task_id": task_id, #########理论上只需这个
|
181
184
|
# "user_id": 1,
|
@@ -183,4 +186,7 @@ if __name__ == '__main__':
|
|
183
186
|
# "action": "kling", # 模型
|
184
187
|
# }
|
185
188
|
|
186
|
-
arun(get_task(task_id,
|
189
|
+
# arun(get_task(task_id, hailuo.get_task))
|
190
|
+
#
|
191
|
+
# task_id = "e3f76be8-f7eb-4562-a7af-029928d074d5"
|
192
|
+
# arun(get_task(task_id, kolors_virtual_try_on.get_task))
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# @Project : AI. @by PyCharm
|
4
|
+
# @File : redis_cache
|
5
|
+
# @Time : 2024/12/6 10:46
|
6
|
+
# @Author : betterme
|
7
|
+
# @WeChat : meutils
|
8
|
+
# @Software : PyCharm
|
9
|
+
# @Description : https://hermescache.readthedocs.io/en/latest/
|
10
|
+
# https://mp.weixin.qq.com/s/-T2UmkinmtQoNQo4DVpnfw
|
11
|
+
|
12
|
+
from meutils.pipe import *
|
13
|
+
|
14
|
+
import hermes.backend.redis
|
15
|
+
|
16
|
+
cache = hermes.Hermes(
|
17
|
+
hermes.backend.redis.Backend,
|
18
|
+
ttl=600,
|
19
|
+
host='localhost',
|
20
|
+
db=1,
|
21
|
+
)
|
meutils/data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2024.12.06.
|
1
|
+
2024.12.06.13.38.47
|
File without changes
|
File without changes
|
{MeUtils-2024.12.6.10.36.57.dist-info → MeUtils-2024.12.6.13.38.47.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|