fmtr.tools 1.3.26__py3-none-any.whl → 1.3.27__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/constants.py CHANGED
@@ -49,3 +49,5 @@ class Constants:
49
49
  PRODUCTION = "production"
50
50
 
51
51
  INFRA = 'infra'
52
+
53
+ PROMPT_NOT_SPECIFIED = '[None Specified]'
@@ -1,35 +1,32 @@
1
+ import inspect
2
+
1
3
  import flet as ft
2
4
 
3
5
 
4
- class ContextRing(ft.ProgressRing):
6
+ class ContextBase:
5
7
  """
6
8
 
7
- Context manager progress ring.
9
+ A mixin base that can be used as both a synchronous and asynchronous context manager,
10
+ or as a decorator to wrap synchronous or asynchronous functions.
11
+ The control becomes visible when entering the context or invoking the wrapped function,
12
+ and is hidden again when exiting.
8
13
 
9
14
  """
10
15
 
11
- def __init__(self, *args, **kwargs):
12
- """
13
-
14
- Start out not visible.
15
-
16
- """
17
- super().__init__(*args, **kwargs, visible=False)
18
-
19
16
  def start(self):
20
17
  """
21
18
 
22
- Update to visible when in context.
23
-
19
+ Show the control and update the page.
24
20
  """
21
+
25
22
  self.visible = True
26
23
  self.page.update()
27
24
 
28
25
  def stop(self):
29
26
  """
30
27
 
31
- Update to not visible when exiting context.
32
-
28
+ Hide the control and update the page.
29
+
33
30
  """
34
31
  self.visible = False
35
32
  self.page.update()
@@ -37,38 +34,92 @@ class ContextRing(ft.ProgressRing):
37
34
  def context(self, func):
38
35
  """
39
36
 
40
- Context manager decorator.
37
+ Decorator that wraps a synchronous or asynchronous function.
38
+ While the function runs, the control is visible.
41
39
 
42
40
  """
41
+ if inspect.iscoroutinefunction(func):
42
+ async def async_wrapped(*args, **kwargs):
43
+ async with self:
44
+ return await func(*args, **kwargs)
43
45
 
44
- def wrapped(*args, **kwargs):
45
- with self:
46
- func(*args, **kwargs)
46
+ return async_wrapped
47
+ else:
48
+ def sync_wrapped(*args, **kwargs):
49
+ with self:
50
+ return func(*args, **kwargs)
47
51
 
48
- return wrapped
52
+ return sync_wrapped
49
53
 
50
54
  def __enter__(self):
55
+ """
56
+
57
+ Enter the control context (sync).
58
+
59
+ """
51
60
  self.start()
52
61
  return self
53
62
 
54
63
  def __exit__(self, exc_type, exc_val, exc_tb):
64
+ """
65
+
66
+ Exit the control context (sync).
67
+
68
+ """
55
69
  self.stop()
56
70
 
71
+ async def __aenter__(self):
72
+ """
73
+
74
+ Enter the control context (async).
75
+ """
76
+
77
+ result = self.start()
78
+ if inspect.isawaitable(result):
79
+ await result
80
+ return self
81
+
82
+ async def __aexit__(self, exc_type, exc_val, exc_tb):
83
+ """
84
+
85
+ Exit the control context (async).
86
+ """
87
+
88
+ result = self.stop()
89
+ if inspect.isawaitable(result):
90
+ await result
91
+
92
+
93
+ class ContextRing(ft.ProgressRing, ContextBase):
94
+ """
95
+
96
+ A progress ring as a context manager.
97
+
98
+ """
99
+
100
+ def __init__(self, *args, **kwargs):
101
+ """
102
+
103
+ Initialize the progress ring as hidden by default.
104
+
105
+ """
106
+ super().__init__(*args, **kwargs, visible=False)
57
107
 
58
108
  class ProgressButton(ft.Button):
59
109
  """
60
110
 
61
- Button with progress ring.
111
+ Button containing a progress ring.
62
112
 
63
113
  """
64
114
 
65
- def __init__(self, *args, on_click=None, **kwargs):
115
+ def __init__(self, *args, on_click=None, ring: ContextRing = None, **kwargs):
66
116
  """
67
117
 
68
118
  Run on_click in run context manager
69
119
 
70
120
  """
71
- self.ring = ContextRing()
121
+ self.ring = ring or ContextRing()
122
+
72
123
  super().__init__(*args, content=self.ring, on_click=self.ring.context(on_click), **kwargs)
73
124
  self.context = self.ring.context
74
125
 
fmtr/tools/version CHANGED
@@ -1 +1 @@
1
- 1.3.26
1
+ 1.3.27
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmtr.tools
3
- Version: 1.3.26
3
+ Version: 1.3.27
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
@@ -126,61 +126,61 @@ Requires-Dist: logfire[httpx]; extra == "http"
126
126
  Provides-Extra: setup
127
127
  Requires-Dist: setuptools; extra == "setup"
128
128
  Provides-Extra: all
129
- Requires-Dist: logfire[httpx]; extra == "all"
130
- Requires-Dist: dask[bag]; extra == "all"
131
- Requires-Dist: logfire[fastapi]; extra == "all"
132
- Requires-Dist: httpx; extra == "all"
133
- Requires-Dist: google-auth; extra == "all"
134
- Requires-Dist: tabulate; extra == "all"
135
- Requires-Dist: diskcache; extra == "all"
136
- Requires-Dist: sre_yield; extra == "all"
137
- Requires-Dist: yamlscript; extra == "all"
138
- Requires-Dist: sentence_transformers; extra == "all"
139
- Requires-Dist: uvicorn[standard]; extra == "all"
140
- Requires-Dist: cachetools; extra == "all"
141
- Requires-Dist: httpx_retries; extra == "all"
142
- Requires-Dist: docker; extra == "all"
143
- Requires-Dist: pymupdf; extra == "all"
144
- Requires-Dist: distributed; extra == "all"
145
- Requires-Dist: peft; extra == "all"
146
- Requires-Dist: fastapi; extra == "all"
147
- Requires-Dist: flet-video; extra == "all"
148
129
  Requires-Dist: tokenizers; extra == "all"
130
+ Requires-Dist: uvicorn[standard]; extra == "all"
149
131
  Requires-Dist: pytest-cov; extra == "all"
150
- Requires-Dist: faker; extra == "all"
132
+ Requires-Dist: google-auth; extra == "all"
133
+ Requires-Dist: diskcache; extra == "all"
151
134
  Requires-Dist: contexttimer; extra == "all"
152
- Requires-Dist: google-auth-oauthlib; extra == "all"
153
- Requires-Dist: huggingface_hub; extra == "all"
135
+ Requires-Dist: pydantic; extra == "all"
154
136
  Requires-Dist: logfire; extra == "all"
155
- Requires-Dist: deepmerge; extra == "all"
156
- Requires-Dist: tinynetrc; extra == "all"
157
- Requires-Dist: bokeh; extra == "all"
158
- Requires-Dist: torchaudio; extra == "all"
159
- Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
160
- Requires-Dist: html2text; extra == "all"
161
- Requires-Dist: flet[all]; extra == "all"
162
- Requires-Dist: google-auth-httplib2; extra == "all"
163
- Requires-Dist: regex; extra == "all"
164
137
  Requires-Dist: appdirs; extra == "all"
165
- Requires-Dist: pydantic-settings; extra == "all"
166
138
  Requires-Dist: pandas; extra == "all"
167
- Requires-Dist: pydantic; extra == "all"
168
- Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
169
- Requires-Dist: Unidecode; extra == "all"
139
+ Requires-Dist: sentence_transformers; extra == "all"
170
140
  Requires-Dist: openai; extra == "all"
141
+ Requires-Dist: torchaudio; extra == "all"
171
142
  Requires-Dist: google-api-python-client; extra == "all"
143
+ Requires-Dist: dask[bag]; extra == "all"
144
+ Requires-Dist: ollama; extra == "all"
172
145
  Requires-Dist: dnspython[doh]; extra == "all"
173
- Requires-Dist: pymupdf4llm; extra == "all"
174
- Requires-Dist: setuptools; extra == "all"
146
+ Requires-Dist: google-auth-httplib2; extra == "all"
147
+ Requires-Dist: fastapi; extra == "all"
148
+ Requires-Dist: regex; extra == "all"
149
+ Requires-Dist: google-auth-oauthlib; extra == "all"
150
+ Requires-Dist: peft; extra == "all"
151
+ Requires-Dist: flet[all]; extra == "all"
152
+ Requires-Dist: pymupdf; extra == "all"
153
+ Requires-Dist: huggingface_hub; extra == "all"
175
154
  Requires-Dist: filetype; extra == "all"
176
- Requires-Dist: transformers[sentencepiece]; extra == "all"
155
+ Requires-Dist: cachetools; extra == "all"
156
+ Requires-Dist: httpx_retries; extra == "all"
157
+ Requires-Dist: yamlscript; extra == "all"
158
+ Requires-Dist: faker; extra == "all"
159
+ Requires-Dist: sre_yield; extra == "all"
160
+ Requires-Dist: torchvision; extra == "all"
161
+ Requires-Dist: distributed; extra == "all"
162
+ Requires-Dist: json_repair; extra == "all"
177
163
  Requires-Dist: flet-webview; extra == "all"
164
+ Requires-Dist: setuptools; extra == "all"
165
+ Requires-Dist: tabulate; extra == "all"
166
+ Requires-Dist: deepmerge; extra == "all"
167
+ Requires-Dist: logfire[httpx]; extra == "all"
168
+ Requires-Dist: flet-video; extra == "all"
169
+ Requires-Dist: logfire[fastapi]; extra == "all"
170
+ Requires-Dist: pymupdf4llm; extra == "all"
171
+ Requires-Dist: docker; extra == "all"
172
+ Requires-Dist: pydantic-settings; extra == "all"
173
+ Requires-Dist: Unidecode; extra == "all"
174
+ Requires-Dist: transformers[sentencepiece]; extra == "all"
175
+ Requires-Dist: pyyaml; extra == "all"
176
+ Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
178
177
  Requires-Dist: openpyxl; extra == "all"
179
- Requires-Dist: json_repair; extra == "all"
178
+ Requires-Dist: html2text; extra == "all"
179
+ Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
180
180
  Requires-Dist: semver; extra == "all"
181
- Requires-Dist: torchvision; extra == "all"
182
- Requires-Dist: pyyaml; extra == "all"
183
- Requires-Dist: ollama; extra == "all"
181
+ Requires-Dist: tinynetrc; extra == "all"
182
+ Requires-Dist: httpx; extra == "all"
183
+ Requires-Dist: bokeh; extra == "all"
184
184
  Dynamic: author
185
185
  Dynamic: author-email
186
186
  Dynamic: description
@@ -3,7 +3,7 @@ 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=6kFaD7ZI7rflaVFfSAtVi0pMrMtNYhWhKNkfV3lBd60,1543
6
+ fmtr/tools/constants.py,sha256=5pZ8TOrOwM2vmag6Db4CDCGxs6kAbzjhTi28NBii5eI,1590
7
7
  fmtr/tools/data_modelling_tools.py,sha256=0BFm-F_cYzVTxftWQwORkPd0FM2BTLVh9-s0-rTTFoo,1744
8
8
  fmtr/tools/dataclass_tools.py,sha256=0Gt6KeLhtPgubo_2tYkIVqB8oQ91Qzag8OAGZDdjvMU,1209
9
9
  fmtr/tools/datatype_tools.py,sha256=3P4AWIFGkJ-UqvXlj0Jc9IvkIIgTOE9jRrOk3NVbpH8,1508
@@ -43,7 +43,7 @@ fmtr/tools/tabular_tools.py,sha256=tpIpZzYku1HcJrHZJL6BC39LmN3WUWVhFbK2N7nDVmE,1
43
43
  fmtr/tools/tokenization_tools.py,sha256=me-IBzSLyNYejLybwjO9CNB6Mj2NYfKPaOVThXyaGNg,4268
44
44
  fmtr/tools/tools.py,sha256=CAsApa1YwVdNE6H66Vjivs_mXYvOas3rh7fPELAnTpk,795
45
45
  fmtr/tools/unicode_tools.py,sha256=yS_9wpu8ogNoiIL7s1G_8bETFFO_YQlo4LNPv1NLDeY,52
46
- fmtr/tools/version,sha256=hS5wAr_5edPJvBlKaOvwuUi2O2fdFTHx-Jl3gWrRcC0,6
46
+ fmtr/tools/version,sha256=L22QqrPxBmPDhCXeqD5MlhBpAb3l7G-RhlHUumdO74k,6
47
47
  fmtr/tools/yaml_tools.py,sha256=Bhhyd6GQVKO72Lp8ky7bAUjIB_65Hdh0Q45SKIEe6S8,1901
48
48
  fmtr/tools/ai_tools/__init__.py,sha256=JZrLuOFNV1A3wvJgonxOgz_4WS-7MfCuowGWA5uYCjs,372
49
49
  fmtr/tools/ai_tools/agentic_tools.py,sha256=acSEPFS-aguDXanWGs3fAAlRyJSYPZW7L-Kb2qDLm-I,4300
@@ -60,7 +60,7 @@ fmtr/tools/entrypoints/install_yamlscript.py,sha256=D9-QET4uPkwMvOBQJAgzn1fYb7Z7
60
60
  fmtr/tools/entrypoints/remote_debug_test.py,sha256=wmKg9o2pQq7eqeHmaO8oviujNgtnsCVEXOdXLIcQWs4,123
61
61
  fmtr/tools/entrypoints/shell_debug.py,sha256=0No3tAg9Ri4_vvSlQCUtAY-11HR0nE45i0VVtiAViwY,106
62
62
  fmtr/tools/interface_tools/__init__.py,sha256=RBg-QC7OO-PdAbFBadzHTzgjASchrKavAqdVbmBq4nM,310
63
- fmtr/tools/interface_tools/controls.py,sha256=C0aE839EnA8tLQN0e2VHRbjCiCp73-3HuW_ceKiK8tQ,1620
63
+ fmtr/tools/interface_tools/controls.py,sha256=W5gVzxLqgiqVp4Ryr3UR4Yrtmoz5IeDpl9hw3Sld2W8,2991
64
64
  fmtr/tools/interface_tools/interface_tools.py,sha256=FBvtWSGFvgieDT-cOSY9KAW6csnObFKyj8O-QnsekE4,2252
65
65
  fmtr/tools/path_tools/__init__.py,sha256=v5CpmzXq5Ii90FtcmxAJKiLxmguZMrPnQ_HdT872Np0,443
66
66
  fmtr/tools/path_tools/app_path_tools.py,sha256=JrJvtTDd_gkCKcZtBCDTMktsM77PZwGV_hzQX0g5GU8,1722
@@ -78,9 +78,9 @@ fmtr/tools/tests/test_path.py,sha256=AkZQa6_8BQ-VaCyL_J-iKmdf2ZaM-xFYR37Kun3k4_g
78
78
  fmtr/tools/tests/test_yaml.py,sha256=jc0TwwKu9eC0LvFGNMERdgBue591xwLxYXFbtsRwXVM,287
79
79
  fmtr/tools/version_tools/__init__.py,sha256=pg4iLtmIr5HtyEW_j0fMFoIdzqi_w9xH8-grQaXLB28,318
80
80
  fmtr/tools/version_tools/version_tools.py,sha256=Hcc6yferZS1hHbugRTdiHhSNmXEEG0hjCiTTXKna-YY,1127
81
- fmtr_tools-1.3.26.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
82
- fmtr_tools-1.3.26.dist-info/METADATA,sha256=NPa0iGerC4VdBPNEfmWWUotvqUz0V2ROXbpf5GzB_0o,15938
83
- fmtr_tools-1.3.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
84
- fmtr_tools-1.3.26.dist-info/entry_points.txt,sha256=h-r__Xh5njtFqreMLg6cGuTFS4Qh-QqJPU1HB-_BS-Q,357
85
- fmtr_tools-1.3.26.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
86
- fmtr_tools-1.3.26.dist-info/RECORD,,
81
+ fmtr_tools-1.3.27.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
82
+ fmtr_tools-1.3.27.dist-info/METADATA,sha256=fVe8m5ZB4wBTxaDT86g6JvR3NuWwVtIwJLsaX7u1im8,15938
83
+ fmtr_tools-1.3.27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
84
+ fmtr_tools-1.3.27.dist-info/entry_points.txt,sha256=h-r__Xh5njtFqreMLg6cGuTFS4Qh-QqJPU1HB-_BS-Q,357
85
+ fmtr_tools-1.3.27.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
86
+ fmtr_tools-1.3.27.dist-info/RECORD,,