fmtr.tools 1.3.34__py3-none-any.whl → 1.3.36__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.
Potentially problematic release.
This version of fmtr.tools might be problematic. Click here for more details.
- fmtr/tools/__init__.py +5 -0
- fmtr/tools/constants.py +1 -0
- fmtr/tools/function_tools.py +20 -20
- fmtr/tools/version +1 -1
- fmtr/tools/webhook_tools.py +17 -0
- {fmtr_tools-1.3.34.dist-info → fmtr_tools-1.3.36.dist-info}/METADATA +49 -44
- {fmtr_tools-1.3.34.dist-info → fmtr_tools-1.3.36.dist-info}/RECORD +11 -10
- {fmtr_tools-1.3.34.dist-info → fmtr_tools-1.3.36.dist-info}/WHEEL +0 -0
- {fmtr_tools-1.3.34.dist-info → fmtr_tools-1.3.36.dist-info}/entry_points.txt +0 -0
- {fmtr_tools-1.3.34.dist-info → fmtr_tools-1.3.36.dist-info}/licenses/LICENSE +0 -0
- {fmtr_tools-1.3.34.dist-info → fmtr_tools-1.3.36.dist-info}/top_level.txt +0 -0
fmtr/tools/__init__.py
CHANGED
|
@@ -168,6 +168,11 @@ try:
|
|
|
168
168
|
except ImportError as exception:
|
|
169
169
|
http = Client = MissingExtraMockModule('http', exception)
|
|
170
170
|
|
|
171
|
+
try:
|
|
172
|
+
from fmtr.tools import webhook_tools as webhook
|
|
173
|
+
except ImportError as exception:
|
|
174
|
+
webhook = MissingExtraMockModule('webhook', exception)
|
|
175
|
+
|
|
171
176
|
|
|
172
177
|
def get_version():
|
|
173
178
|
"""
|
fmtr/tools/constants.py
CHANGED
fmtr/tools/function_tools.py
CHANGED
|
@@ -47,7 +47,7 @@ class MethodDecorator:
|
|
|
47
47
|
def __init__(self):
|
|
48
48
|
"""
|
|
49
49
|
|
|
50
|
-
Initialise
|
|
50
|
+
Initialise the decorator itself with any arguments
|
|
51
51
|
|
|
52
52
|
"""
|
|
53
53
|
self.func = None
|
|
@@ -55,28 +55,17 @@ class MethodDecorator:
|
|
|
55
55
|
def __call__(self, func: Callable) -> Self:
|
|
56
56
|
"""
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
Add the (unbound) method.
|
|
59
59
|
|
|
60
60
|
"""
|
|
61
61
|
self.func = func
|
|
62
62
|
functools.update_wrapper(self, func)
|
|
63
63
|
return self
|
|
64
64
|
|
|
65
|
-
def get_context(self, instance):
|
|
66
|
-
"""
|
|
67
|
-
|
|
68
|
-
If the instance has a context attribute, use that - otherwise use a null context.
|
|
69
|
-
|
|
70
|
-
"""
|
|
71
|
-
context = getattr(instance, self.CONTEXT_KEY, None)
|
|
72
|
-
if context:
|
|
73
|
-
return context
|
|
74
|
-
return context_tools.null()
|
|
75
|
-
|
|
76
65
|
def __get__(self, instance, owner):
|
|
77
66
|
"""
|
|
78
67
|
|
|
79
|
-
Wrap at runtime, call start/stop within context.
|
|
68
|
+
Wrap bound method at runtime, call start/stop within context.
|
|
80
69
|
|
|
81
70
|
"""
|
|
82
71
|
if instance is None: # Class method called.
|
|
@@ -85,9 +74,9 @@ class MethodDecorator:
|
|
|
85
74
|
if inspect.iscoroutinefunction(self.func):
|
|
86
75
|
async def async_wrapper(*args, **kwargs):
|
|
87
76
|
with self.get_context(instance):
|
|
88
|
-
self.start(instance)
|
|
77
|
+
self.start(instance, *args, **kwargs)
|
|
89
78
|
result = await self.func(instance, *args, **kwargs)
|
|
90
|
-
self.stop(instance)
|
|
79
|
+
self.stop(instance, *args, **kwargs)
|
|
91
80
|
return result
|
|
92
81
|
|
|
93
82
|
return async_wrapper
|
|
@@ -95,15 +84,26 @@ class MethodDecorator:
|
|
|
95
84
|
else:
|
|
96
85
|
def sync_wrapper(*args, **kwargs):
|
|
97
86
|
with self.get_context(instance):
|
|
98
|
-
self.start(instance)
|
|
87
|
+
self.start(instance, *args, **kwargs)
|
|
99
88
|
result = self.func(instance, *args, **kwargs)
|
|
100
|
-
self.stop(instance)
|
|
89
|
+
self.stop(instance, *args, **kwargs)
|
|
101
90
|
return result
|
|
102
91
|
|
|
103
92
|
return sync_wrapper
|
|
104
93
|
|
|
105
|
-
def
|
|
94
|
+
def get_context(self, instance):
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
If the instance has a context attribute, use that - otherwise use a null context.
|
|
98
|
+
|
|
99
|
+
"""
|
|
100
|
+
context = getattr(instance, self.CONTEXT_KEY, None)
|
|
101
|
+
if context:
|
|
102
|
+
return context
|
|
103
|
+
return context_tools.null()
|
|
104
|
+
|
|
105
|
+
def start(self, instance, *args, **kwargs):
|
|
106
106
|
pass
|
|
107
107
|
|
|
108
|
-
def stop(self, instance):
|
|
108
|
+
def stop(self, instance, *args, **kwargs):
|
|
109
109
|
pass
|
fmtr/tools/version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.3.
|
|
1
|
+
1.3.36
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from fmtr.tools import environment_tools, Constants
|
|
2
|
+
from fmtr.tools.http_tools import client
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def notify(title, body, url=None):
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
Send simple debug notification
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
url = url or environment_tools.get(Constants.WEBHOOK_URL_NOTIFY_KEY)
|
|
12
|
+
client.post(url, json=dict(title=title, body=body))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
if __name__ == '__main__':
|
|
16
|
+
notify('Title', 'Body')
|
|
17
|
+
notify
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fmtr.tools
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.36
|
|
4
4
|
Summary: Collection of high-level tools to simplify everyday development tasks, with a focus on AI/ML
|
|
5
5
|
Home-page: https://github.com/fmtr/fmtr.tools
|
|
6
6
|
Author: Frontmatter
|
|
@@ -125,62 +125,67 @@ Requires-Dist: logfire; extra == "http"
|
|
|
125
125
|
Requires-Dist: logfire[httpx]; extra == "http"
|
|
126
126
|
Provides-Extra: setup
|
|
127
127
|
Requires-Dist: setuptools; extra == "setup"
|
|
128
|
+
Provides-Extra: webhook
|
|
129
|
+
Requires-Dist: httpx; extra == "webhook"
|
|
130
|
+
Requires-Dist: httpx_retries; extra == "webhook"
|
|
131
|
+
Requires-Dist: logfire; extra == "webhook"
|
|
132
|
+
Requires-Dist: logfire[httpx]; extra == "webhook"
|
|
128
133
|
Provides-Extra: all
|
|
129
|
-
Requires-Dist: dnspython[doh]; extra == "all"
|
|
130
134
|
Requires-Dist: yamlscript; extra == "all"
|
|
131
|
-
Requires-Dist: regex; extra == "all"
|
|
132
|
-
Requires-Dist: dask[bag]; extra == "all"
|
|
133
|
-
Requires-Dist: appdirs; extra == "all"
|
|
134
|
-
Requires-Dist: flet-webview; extra == "all"
|
|
135
|
-
Requires-Dist: diskcache; extra == "all"
|
|
136
|
-
Requires-Dist: peft; extra == "all"
|
|
137
|
-
Requires-Dist: openai; extra == "all"
|
|
138
|
-
Requires-Dist: filetype; extra == "all"
|
|
139
|
-
Requires-Dist: google-auth-httplib2; extra == "all"
|
|
140
|
-
Requires-Dist: deepmerge; extra == "all"
|
|
141
|
-
Requires-Dist: transformers[sentencepiece]; extra == "all"
|
|
142
|
-
Requires-Dist: flet-video; extra == "all"
|
|
143
|
-
Requires-Dist: google-auth; extra == "all"
|
|
144
|
-
Requires-Dist: pydantic-settings; extra == "all"
|
|
145
|
-
Requires-Dist: tokenizers; extra == "all"
|
|
146
|
-
Requires-Dist: torchaudio; extra == "all"
|
|
147
|
-
Requires-Dist: google-api-python-client; extra == "all"
|
|
148
|
-
Requires-Dist: pymupdf4llm; extra == "all"
|
|
149
|
-
Requires-Dist: distributed; extra == "all"
|
|
150
|
-
Requires-Dist: docker; extra == "all"
|
|
151
|
-
Requires-Dist: faker; extra == "all"
|
|
152
135
|
Requires-Dist: flet[all]; extra == "all"
|
|
153
|
-
Requires-Dist:
|
|
154
|
-
Requires-Dist: tabulate; extra == "all"
|
|
155
|
-
Requires-Dist: sre_yield; extra == "all"
|
|
156
|
-
Requires-Dist: contexttimer; extra == "all"
|
|
157
|
-
Requires-Dist: pandas; extra == "all"
|
|
158
|
-
Requires-Dist: json_repair; extra == "all"
|
|
159
|
-
Requires-Dist: huggingface_hub; extra == "all"
|
|
136
|
+
Requires-Dist: logfire[httpx]; extra == "all"
|
|
160
137
|
Requires-Dist: torchvision; extra == "all"
|
|
161
|
-
Requires-Dist:
|
|
162
|
-
Requires-Dist: tinynetrc; extra == "all"
|
|
163
|
-
Requires-Dist: sentence_transformers; extra == "all"
|
|
138
|
+
Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
|
|
164
139
|
Requires-Dist: html2text; extra == "all"
|
|
165
|
-
Requires-Dist:
|
|
166
|
-
Requires-Dist:
|
|
167
|
-
Requires-Dist:
|
|
168
|
-
Requires-Dist: logfire[httpx]; extra == "all"
|
|
140
|
+
Requires-Dist: docker; extra == "all"
|
|
141
|
+
Requires-Dist: sentence_transformers; extra == "all"
|
|
142
|
+
Requires-Dist: logfire; extra == "all"
|
|
169
143
|
Requires-Dist: pydantic; extra == "all"
|
|
144
|
+
Requires-Dist: google-api-python-client; extra == "all"
|
|
145
|
+
Requires-Dist: pydantic-settings; extra == "all"
|
|
146
|
+
Requires-Dist: pytest-cov; extra == "all"
|
|
170
147
|
Requires-Dist: google-auth-oauthlib; extra == "all"
|
|
148
|
+
Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
|
|
149
|
+
Requires-Dist: dnspython[doh]; extra == "all"
|
|
150
|
+
Requires-Dist: tinynetrc; extra == "all"
|
|
151
|
+
Requires-Dist: sre_yield; extra == "all"
|
|
152
|
+
Requires-Dist: json_repair; extra == "all"
|
|
153
|
+
Requires-Dist: bokeh; extra == "all"
|
|
154
|
+
Requires-Dist: openai; extra == "all"
|
|
155
|
+
Requires-Dist: tabulate; extra == "all"
|
|
156
|
+
Requires-Dist: huggingface_hub; extra == "all"
|
|
157
|
+
Requires-Dist: logfire[fastapi]; extra == "all"
|
|
158
|
+
Requires-Dist: pymupdf4llm; extra == "all"
|
|
171
159
|
Requires-Dist: httpx; extra == "all"
|
|
160
|
+
Requires-Dist: filetype; extra == "all"
|
|
161
|
+
Requires-Dist: appdirs; extra == "all"
|
|
162
|
+
Requires-Dist: torchaudio; extra == "all"
|
|
172
163
|
Requires-Dist: Unidecode; extra == "all"
|
|
173
|
-
Requires-Dist:
|
|
174
|
-
Requires-Dist:
|
|
175
|
-
Requires-Dist:
|
|
164
|
+
Requires-Dist: contexttimer; extra == "all"
|
|
165
|
+
Requires-Dist: pandas; extra == "all"
|
|
166
|
+
Requires-Dist: faker; extra == "all"
|
|
167
|
+
Requires-Dist: deepmerge; extra == "all"
|
|
176
168
|
Requires-Dist: openpyxl; extra == "all"
|
|
177
|
-
Requires-Dist:
|
|
178
|
-
Requires-Dist:
|
|
169
|
+
Requires-Dist: diskcache; extra == "all"
|
|
170
|
+
Requires-Dist: regex; extra == "all"
|
|
171
|
+
Requires-Dist: google-auth-httplib2; extra == "all"
|
|
172
|
+
Requires-Dist: flet-webview; extra == "all"
|
|
173
|
+
Requires-Dist: distributed; extra == "all"
|
|
174
|
+
Requires-Dist: flet-video; extra == "all"
|
|
175
|
+
Requires-Dist: pymupdf; extra == "all"
|
|
176
|
+
Requires-Dist: httpx_retries; extra == "all"
|
|
179
177
|
Requires-Dist: setuptools; extra == "all"
|
|
180
|
-
Requires-Dist:
|
|
178
|
+
Requires-Dist: dask[bag]; extra == "all"
|
|
179
|
+
Requires-Dist: pyyaml; extra == "all"
|
|
181
180
|
Requires-Dist: fastapi; extra == "all"
|
|
182
181
|
Requires-Dist: ollama; extra == "all"
|
|
183
|
-
Requires-Dist:
|
|
182
|
+
Requires-Dist: transformers[sentencepiece]; extra == "all"
|
|
183
|
+
Requires-Dist: peft; extra == "all"
|
|
184
|
+
Requires-Dist: cachetools; extra == "all"
|
|
185
|
+
Requires-Dist: semver; extra == "all"
|
|
186
|
+
Requires-Dist: google-auth; extra == "all"
|
|
187
|
+
Requires-Dist: uvicorn[standard]; extra == "all"
|
|
188
|
+
Requires-Dist: tokenizers; extra == "all"
|
|
184
189
|
Dynamic: author
|
|
185
190
|
Dynamic: author-email
|
|
186
191
|
Dynamic: description
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
fmtr/tools/__init__.py,sha256=
|
|
1
|
+
fmtr/tools/__init__.py,sha256=S09QiP8hSJcJKWWFxgrFOunToA4yKCnnq9SaNGtfWYs,5818
|
|
2
2
|
fmtr/tools/api_tools.py,sha256=RyZUlTefSQozfl-8feZGauyUkwcFd-jU0KtKHFxHea4,2272
|
|
3
3
|
fmtr/tools/async_tools.py,sha256=ewz757WcveQJd-G5SVr2JDOQVbdLGecCgl-tsBGVZz4,284
|
|
4
4
|
fmtr/tools/augmentation_tools.py,sha256=-6ESbO4CDlKqVOV1J1V6qBeoBMzbFIinkDHRHnCBej0,55
|
|
5
5
|
fmtr/tools/caching_tools.py,sha256=74p7m2GLFfeP41LX69wxgfkilxEAoWkMIfFMjKsYpyg,4976
|
|
6
|
-
fmtr/tools/constants.py,sha256=
|
|
6
|
+
fmtr/tools/constants.py,sha256=idsZZ_IBkWFZusrv0_0YM0_yHM92_jqiFhfTz-GYkBg,1698
|
|
7
7
|
fmtr/tools/context_tools.py,sha256=4UvIHYgLqAh7dXMX9EBrLEpYp81qfzhSVrkffOSAoGA,350
|
|
8
8
|
fmtr/tools/data_modelling_tools.py,sha256=0BFm-F_cYzVTxftWQwORkPd0FM2BTLVh9-s0-rTTFoo,1744
|
|
9
9
|
fmtr/tools/dataclass_tools.py,sha256=0Gt6KeLhtPgubo_2tYkIVqB8oQ91Qzag8OAGZDdjvMU,1209
|
|
@@ -11,7 +11,7 @@ fmtr/tools/datatype_tools.py,sha256=3P4AWIFGkJ-UqvXlj0Jc9IvkIIgTOE9jRrOk3NVbpH8,
|
|
|
11
11
|
fmtr/tools/debugging_tools.py,sha256=_xzqS0V5BpL8d06j-jVQjGgI7T020QsqVXKAKMz7Du8,2082
|
|
12
12
|
fmtr/tools/docker_tools.py,sha256=rdaZje2xhlmnfQqZnR7IHgRdWncTLjrJcViUTt5oEwk,617
|
|
13
13
|
fmtr/tools/environment_tools.py,sha256=jlx6LYFVv9tyNBT_pVD-tDhyR3ccNC7w6ENVlnoxCLM,1823
|
|
14
|
-
fmtr/tools/function_tools.py,sha256=
|
|
14
|
+
fmtr/tools/function_tools.py,sha256=O1K8HwftXfzrBblNZrj-BhWNbr4poJghrXNr2mFcylI,2831
|
|
15
15
|
fmtr/tools/google_api_tools.py,sha256=owWE0GlnJjmVbXus8ENxT2PH7Fnd3m_r-14xyR7lAnA,1107
|
|
16
16
|
fmtr/tools/hash_tools.py,sha256=tr4HXpeT6rRrDk6TvMlRPUSrLRRaov96y128OI2tzsc,729
|
|
17
17
|
fmtr/tools/hfh_tools.py,sha256=DCDIWuWlhtmIGCtp9cLcOTTEw_4yN_NocLX8w5NZsbk,2384
|
|
@@ -45,7 +45,8 @@ fmtr/tools/tabular_tools.py,sha256=tpIpZzYku1HcJrHZJL6BC39LmN3WUWVhFbK2N7nDVmE,1
|
|
|
45
45
|
fmtr/tools/tokenization_tools.py,sha256=me-IBzSLyNYejLybwjO9CNB6Mj2NYfKPaOVThXyaGNg,4268
|
|
46
46
|
fmtr/tools/tools.py,sha256=CAsApa1YwVdNE6H66Vjivs_mXYvOas3rh7fPELAnTpk,795
|
|
47
47
|
fmtr/tools/unicode_tools.py,sha256=yS_9wpu8ogNoiIL7s1G_8bETFFO_YQlo4LNPv1NLDeY,52
|
|
48
|
-
fmtr/tools/version,sha256=
|
|
48
|
+
fmtr/tools/version,sha256=xvILRagoG7hEEPWTSMHMAuoniWksi-1PA7Yi_3QgMoc,6
|
|
49
|
+
fmtr/tools/webhook_tools.py,sha256=q3pVJ1NCem2SrMuFcLxiWd7DibFs7Q-uGtojfXd3Qcg,380
|
|
49
50
|
fmtr/tools/yaml_tools.py,sha256=Bhhyd6GQVKO72Lp8ky7bAUjIB_65Hdh0Q45SKIEe6S8,1901
|
|
50
51
|
fmtr/tools/ai_tools/__init__.py,sha256=JZrLuOFNV1A3wvJgonxOgz_4WS-7MfCuowGWA5uYCjs,372
|
|
51
52
|
fmtr/tools/ai_tools/agentic_tools.py,sha256=8su8wmSEoQaDoDnmcKy_DvtWzssBEpNJtH4PzNAKZUE,4782
|
|
@@ -80,9 +81,9 @@ fmtr/tools/tests/test_path.py,sha256=AkZQa6_8BQ-VaCyL_J-iKmdf2ZaM-xFYR37Kun3k4_g
|
|
|
80
81
|
fmtr/tools/tests/test_yaml.py,sha256=jc0TwwKu9eC0LvFGNMERdgBue591xwLxYXFbtsRwXVM,287
|
|
81
82
|
fmtr/tools/version_tools/__init__.py,sha256=pg4iLtmIr5HtyEW_j0fMFoIdzqi_w9xH8-grQaXLB28,318
|
|
82
83
|
fmtr/tools/version_tools/version_tools.py,sha256=Hcc6yferZS1hHbugRTdiHhSNmXEEG0hjCiTTXKna-YY,1127
|
|
83
|
-
fmtr_tools-1.3.
|
|
84
|
-
fmtr_tools-1.3.
|
|
85
|
-
fmtr_tools-1.3.
|
|
86
|
-
fmtr_tools-1.3.
|
|
87
|
-
fmtr_tools-1.3.
|
|
88
|
-
fmtr_tools-1.3.
|
|
84
|
+
fmtr_tools-1.3.36.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
|
|
85
|
+
fmtr_tools-1.3.36.dist-info/METADATA,sha256=1JH4PkeU1OkqTNkJC8q-f4m5QO6LcFoBSSgPGenZMtI,16145
|
|
86
|
+
fmtr_tools-1.3.36.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
87
|
+
fmtr_tools-1.3.36.dist-info/entry_points.txt,sha256=h-r__Xh5njtFqreMLg6cGuTFS4Qh-QqJPU1HB-_BS-Q,357
|
|
88
|
+
fmtr_tools-1.3.36.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
|
|
89
|
+
fmtr_tools-1.3.36.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|