MeUtils 2024.12.6.10.34.3__py3-none-any.whl → 2024.12.6.13.37.12__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: MeUtils
3
- Version: 2024.12.6.10.34.3
3
+ Version: 2024.12.6.13.37.12
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: jmespath ; extra == 'all'
65
- Requires-Dist: filetype ; extra == 'all'
66
- Requires-Dist: openai ; extra == 'all'
64
+ Requires-Dist: jieba ; extra == 'all'
67
65
  Requires-Dist: schedule ; extra == 'all'
68
- Requires-Dist: sse-starlette ; extra == 'all'
69
- Requires-Dist: langchain ; extra == 'all'
70
- Requires-Dist: uvicorn ; extra == 'all'
71
- Requires-Dist: streamlit ; extra == 'all'
72
- Requires-Dist: fastapi ; extra == 'all'
73
- Requires-Dist: cachetools ; extra == 'all'
74
66
  Requires-Dist: pymupd ; extra == 'all'
75
- Requires-Dist: pretty-errors ; extra == 'all'
76
- Requires-Dist: pymongo ; extra == 'all'
77
- Requires-Dist: polars ; extra == 'all'
78
- Requires-Dist: pymilvus ; extra == 'all'
79
- Requires-Dist: faiss-cpu ; extra == 'all'
80
- Requires-Dist: jinja2 ; extra == 'all'
81
- Requires-Dist: seaborn ; extra == 'all'
82
- Requires-Dist: sqlalchemy ; extra == 'all'
83
- Requires-Dist: thefuck ; extra == 'all'
67
+ Requires-Dist: missingno ; extra == 'all'
68
+ Requires-Dist: reportlab ; extra == 'all'
69
+ Requires-Dist: openai ; extra == 'all'
70
+ Requires-Dist: uvicorn ; extra == 'all'
84
71
  Requires-Dist: redis-py-cluster ; extra == 'all'
85
- Requires-Dist: fastapi[all] ; extra == 'all'
86
- Requires-Dist: jieba ; extra == 'all'
72
+ Requires-Dist: polars ; extra == 'all'
87
73
  Requires-Dist: pyarrow ; extra == 'all'
74
+ Requires-Dist: streamlit ; extra == 'all'
75
+ Requires-Dist: fastapi[all] ; extra == 'all'
88
76
  Requires-Dist: pymysql ; extra == 'all'
89
- Requires-Dist: simplejson ; extra == 'all'
77
+ Requires-Dist: filetype ; extra == 'all'
78
+ Requires-Dist: geopy ; extra == 'all'
79
+ Requires-Dist: sqlalchemy ; extra == 'all'
80
+ Requires-Dist: faiss-cpu ; extra == 'all'
81
+ Requires-Dist: jinja2 ; extra == 'all'
82
+ Requires-Dist: cachetools ; extra == 'all'
90
83
  Requires-Dist: dataframe-image ; extra == 'all'
91
- Requires-Dist: pandas-summary ; extra == 'all'
92
- Requires-Dist: gunicorn ; extra == 'all'
84
+ Requires-Dist: pretty-errors ; extra == 'all'
85
+ Requires-Dist: fastapi ; extra == 'all'
86
+ Requires-Dist: pymongo ; extra == 'all'
87
+ Requires-Dist: thriftpy2 ; extra == 'all'
93
88
  Requires-Dist: asyncmy ; extra == 'all'
94
- Requires-Dist: iteration-utilities ; extra == 'all'
95
89
  Requires-Dist: pandas-profiling[notebook] ; extra == 'all'
96
- Requires-Dist: reportlab ; extra == 'all'
97
- Requires-Dist: thriftpy2 ; extra == 'all'
98
- Requires-Dist: missingno ; extra == 'all'
99
- Requires-Dist: geopy ; extra == 'all'
90
+ Requires-Dist: iteration-utilities ; extra == 'all'
91
+ Requires-Dist: thefuck ; extra == 'all'
92
+ Requires-Dist: gunicorn ; extra == 'all'
93
+ Requires-Dist: langchain ; extra == 'all'
94
+ Requires-Dist: pandas-summary ; extra == 'all'
95
+ Requires-Dist: jmespath ; extra == 'all'
96
+ Requires-Dist: seaborn ; extra == 'all'
97
+ Requires-Dist: sse-starlette ; extra == 'all'
98
+ Requires-Dist: pymilvus ; extra == 'all'
99
+ Requires-Dist: simplejson ; 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
@@ -423,12 +425,12 @@ meutils/apis/voice_clone/fish_api.py,sha256=pDpE-B8HFiGIOV3NVd1HmFrCC2GQc3wH-81o
423
425
  meutils/async_task/__init__.py,sha256=45cUr-GWvQ1JFYGOYPOIkHLyTR3JbfP_PEYrmktpMLo,367
424
426
  meutils/async_task/celery_config.py,sha256=BX1h3jY34aO6UmUFakdBUwOdsEiOxCGuUtYDUKFtafc,3461
425
427
  meutils/async_task/common.py,sha256=ZJ4e0CsEJf1ppPmGSwPCwhZBAkUL5xsi_t1ny-bJuko,845
426
- meutils/async_task/demo_create_tasks.py,sha256=Eu4XjNxRROmMJ0oKfbEhrfLTaOUgedbAhmFyQx5nOQc,2699
427
- meutils/async_task/utils.py,sha256=6M0YRIPhakpH3Geywkl-NPy_O2pQvnsDcQPyyTrA7Mc,5853
428
+ meutils/async_task/demo_create_tasks.py,sha256=E4FfVl_2RRdlHlPSp4jzo0GAonpFwD0juIvRTfIT3zs,2811
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
431
- meutils/async_task/tasks/hailuo.py,sha256=BEosSKvUyqdosSpfjJBNrvIBpV0bm85E9uPweIBAeS0,918
433
+ meutils/async_task/tasks/hailuo.py,sha256=civZaTSG-GdrENkSb8sVdl4u67WikX-AFmyrEAYs_i4,741
432
434
  meutils/async_task/tasks/kling.py,sha256=QVn5VvPdcH-BFOx8ABtVyqWiUNjI_vvwJtLeJpGNYac,948
433
435
  meutils/async_task/tasks/replicateai.py,sha256=wbxx6kB7GQZPnKRE6J6r1mEv3wO8X7XaGaNMC5rBVoE,716
434
436
  meutils/async_task/tasks/test.py,sha256=-nCQhwEP6hQEnmk3ucDbjbnxbeyOHrg0HXCJmWL0KBU,2675
@@ -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=SviVnPVoj9OAFqBRqc_c90AN9Mc5zC95QOYkgbXhs6o,19
473
+ meutils/data/VERSION,sha256=e7CHee9lBv12j535bVSqPp5MncBBbRPW7QdF7ckp0hg,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.10.34.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
806
- MeUtils-2024.12.6.10.34.3.dist-info/METADATA,sha256=UA6VOYW4vZJ1UYbPIDEXBtJU82IN3MT1Zc7k8ap_suo,6142
807
- MeUtils-2024.12.6.10.34.3.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
808
- MeUtils-2024.12.6.10.34.3.dist-info/entry_points.txt,sha256=lufZlBHRqqZKdY-ZQJ4CSZb0qhV5hQC37egZna9M7ug,357
809
- MeUtils-2024.12.6.10.34.3.dist-info/top_level.txt,sha256=cInfxMmkgNOskurdjwP5unau4rA7Uw48nu07tYhS7KY,22
810
- MeUtils-2024.12.6.10.34.3.dist-info/RECORD,,
808
+ MeUtils-2024.12.6.13.37.12.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
809
+ MeUtils-2024.12.6.13.37.12.dist-info/METADATA,sha256=XG5TEAoS_5c91VrAE3s6oXylZL_VQBfb3yBtFf8Xh3w,6143
810
+ MeUtils-2024.12.6.13.37.12.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
811
+ MeUtils-2024.12.6.13.37.12.dist-info/entry_points.txt,sha256=lufZlBHRqqZKdY-ZQJ4CSZb0qhV5hQC37egZna9M7ug,357
812
+ MeUtils-2024.12.6.13.37.12.dist-info/top_level.txt,sha256=cInfxMmkgNOskurdjwP5unau4rA7Uw48nu07tYhS7KY,22
813
+ MeUtils-2024.12.6.13.37.12.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))
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : __init__.py
5
+ # @Time : 2024/12/6 10:40
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+ from meutils.pipe import *
@@ -11,10 +11,9 @@
11
11
  from meutils.pipe import *
12
12
 
13
13
  from meutils.async_task import worker
14
- from meutils.async_task.tasks import test, kling
14
+ from meutils.async_task.tasks import test, kling, hailuo
15
15
  from celery.result import AsyncResult
16
16
 
17
-
18
17
  # print(worker.conf)
19
18
 
20
19
  # @shared_task(
@@ -47,15 +46,13 @@ if __name__ == '__main__':
47
46
  # AsyncResult("42e191a0-6099-419e-b61d-07bf7e2df2fc").get()
48
47
  # AsyncResult(r.id).result
49
48
 
50
-
51
49
  # test.do_pydantic_task.apply_async(kwargs={'request': test.Request()})
52
50
 
53
51
  # test.do_pydantic_task.apply_async(kwargs={"request": {"method": "POST", "url": "测试"}})
54
52
 
55
53
  # print(type(test.do_pydantic_task))
56
54
 
57
-
58
- test.do_pydantic_task.apply_async(kwargs={"request": {"method": "POST", "url": "测试"}})
55
+ # test.do_pydantic_task.apply_async(kwargs={"request": {"method": "POST", "url": "测试"}})
59
56
  # test.do_pydantic_task.apply_async(kwargs={"request": {"method": "xx"}})
60
57
  # test.do_pydantic_task.apply_async(args=({"method": "xxxxxxx"},))
61
58
 
@@ -71,7 +68,6 @@ if __name__ == '__main__':
71
68
  # test.ado_pydantic_task.apply_async(kwargs={"request": test.Request().model_dump()})
72
69
  # test.ado_pydantic_task_2.apply_async(kwargs={"request": test.Request().model_dump()})
73
70
 
71
+ # kling.create_task.apply_async(kwargs={"request": kling.kolors_virtual_try_on.TryOnRequest().model_dump()})
74
72
 
75
- kling.create_task.apply_async(kwargs={"request": kling.kolors_virtual_try_on.TryOnRequest().model_dump()})
76
-
77
-
73
+ hailuo.create_task.apply_async(kwargs={"request": hailuo.VideoRequest(prompt='a dog').model_dump()})
@@ -22,12 +22,3 @@ async def create_task(request, **kwargs):
22
22
 
23
23
  response = await remote_create_task(request)
24
24
  return response.model_dump()
25
-
26
-
27
- # celery_task
28
-
29
-
30
- if __name__ == '__main__':
31
- pass
32
- # create_task.apply_async()
33
- create_task.apply_async(kwargs={"request": VideoRequest(prompt='a dog').model_dump()})
@@ -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.__dict__.update(remote_task_response) # 更新 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 = "31b9bb1b-db59-4a94-9027-2ded2e4f24aa"
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, kolors_virtual_try_on.get_task))
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.10.34.03
1
+ 2024.12.06.13.37.12