fmtr.tools 1.3.29__py3-none-any.whl → 1.3.30__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
@@ -32,6 +32,8 @@ class Constants:
32
32
  FMTR_AI_HOST_KEY = 'FMTR_URL_HOST'
33
33
  FMTR_AI_HOST_DEFAULT = 'ai.gex.fmtr.dev'
34
34
 
35
+ FMTR_DEV_INTERFACE_URL = 'https://ws.gex.fmtr.dev/'
36
+
35
37
  FILENAME_CONFIG = 'settings.yaml'
36
38
  DIR_NAME_REPO = 'repo'
37
39
  DIR_NAME_DATA = 'data'
@@ -1,7 +1,7 @@
1
1
  from fmtr.tools.import_tools import MissingExtraMockModule
2
2
 
3
3
  try:
4
- from fmtr.tools.interface_tools.interface_tools import Interface, update
4
+ from fmtr.tools.interface_tools.interface_tools import Interface, update, progress
5
5
  from fmtr.tools.interface_tools import controls
6
6
  except ImportError as exception:
7
- Interface = update = controls = MissingExtraMockModule('interface', exception)
7
+ Interface = update = progress = controls = MissingExtraMockModule('interface', exception)
@@ -1,129 +1,5 @@
1
- import inspect
2
-
3
1
  import flet as ft
4
2
 
5
-
6
- class ContextBase:
7
- """
8
-
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.
13
-
14
- """
15
-
16
- def start(self):
17
- """
18
-
19
- Show the control and update the page.
20
- """
21
-
22
- self.visible = True
23
- self.page.update()
24
-
25
- def stop(self):
26
- """
27
-
28
- Hide the control and update the page.
29
-
30
- """
31
- self.visible = False
32
- self.page.update()
33
-
34
- def context(self, func):
35
- """
36
-
37
- Decorator that wraps a synchronous or asynchronous function.
38
- While the function runs, the control is visible.
39
-
40
- """
41
- if inspect.iscoroutinefunction(func):
42
- async def async_wrapped(*args, **kwargs):
43
- async with self:
44
- return await func(*args, **kwargs)
45
-
46
- return async_wrapped
47
- else:
48
- def sync_wrapped(*args, **kwargs):
49
- with self:
50
- return func(*args, **kwargs)
51
-
52
- return sync_wrapped
53
-
54
- def __enter__(self):
55
- """
56
-
57
- Enter the control context (sync).
58
-
59
- """
60
- self.start()
61
- return self
62
-
63
- def __exit__(self, exc_type, exc_val, exc_tb):
64
- """
65
-
66
- Exit the control context (sync).
67
-
68
- """
69
- self.stop()
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)
107
-
108
- class ProgressButton(ft.Button):
109
- """
110
-
111
- Button containing a progress ring.
112
-
113
- """
114
-
115
- def __init__(self, *args, on_click=None, ring: ContextRing = None, **kwargs):
116
- """
117
-
118
- Run on_click in run context manager
119
-
120
- """
121
- self.ring = ring or ContextRing()
122
-
123
- super().__init__(*args, content=self.ring, on_click=self.ring.context(on_click), **kwargs)
124
- self.context = self.ring.context
125
-
126
-
127
3
  class SliderSteps(ft.Slider):
128
4
  """
129
5
 
@@ -2,21 +2,58 @@ import flet as ft
2
2
  from flet.core.types import AppView
3
3
  from flet.core.view import View
4
4
 
5
+ from fmtr.tools import environment_tools
6
+ from fmtr.tools.constants import Constants
7
+ from fmtr.tools.function_tools import BoundDecorator
5
8
  from fmtr.tools.logging_tools import logger
6
9
 
7
10
 
8
- def update(func):
11
+ class update(BoundDecorator):
9
12
  """
10
13
 
11
- Page update decorator
14
+ Update the page after the decorated function is called.
12
15
 
13
16
  """
14
17
 
15
- def wrapped(*args, **kwargs):
16
- func(*args, **kwargs)
17
- func.__self__.page.update()
18
+ def stop(self, instance):
19
+ instance.page.update()
20
+
21
+
22
+ class progress(update):
23
+ """
24
+
25
+ Run the function while a progress indicator (e.g. spinner) is and within the object-defined context (e.g. logging span).
26
+
27
+ """
28
+
29
+ def get_context(self, instance):
30
+ """
31
+
32
+ Use instance-defined context.
33
+
34
+ """
35
+ return instance.context
36
+
37
+ def start(self, instance):
38
+ """
39
+
40
+ Make progress visible and update.
41
+
42
+ """
43
+ instance.progress.visible = True
44
+ instance.page.update()
45
+
46
+ def stop(self, instance):
47
+ """
48
+
49
+ Make progress not visible and update.
50
+
51
+ """
52
+ instance.progress.visible = False
53
+ super().stop(instance)
54
+
55
+
18
56
 
19
- return wrapped
20
57
 
21
58
  class Interface(ft.Column):
22
59
  """
@@ -27,7 +64,7 @@ class Interface(ft.Column):
27
64
  TITLE = 'Base Interface'
28
65
  HOST = '0.0.0.0'
29
66
  PORT = 8080
30
- URL = None
67
+ URL = Constants.FMTR_DEV_INTERFACE_URL if environment_tools.IS_DEV else None
31
68
  APPVIEW = AppView.WEB_BROWSER
32
69
  PATH_ASSETS = None
33
70
  ROUTE_ROOT = '/'
fmtr/tools/version CHANGED
@@ -1 +1 @@
1
- 1.3.29
1
+ 1.3.30
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmtr.tools
3
- Version: 1.3.29
3
+ Version: 1.3.30
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: cachetools; extra == "all"
130
+ Requires-Dist: Unidecode; extra == "all"
129
131
  Requires-Dist: httpx_retries; extra == "all"
130
- Requires-Dist: google-auth; extra == "all"
131
- Requires-Dist: openai; extra == "all"
132
- Requires-Dist: google-auth-oauthlib; extra == "all"
133
- Requires-Dist: transformers[sentencepiece]; extra == "all"
132
+ Requires-Dist: regex; extra == "all"
134
133
  Requires-Dist: pymupdf; extra == "all"
135
- Requires-Dist: faker; extra == "all"
136
- Requires-Dist: cachetools; extra == "all"
137
- Requires-Dist: tabulate; extra == "all"
138
- Requires-Dist: huggingface_hub; extra == "all"
139
- Requires-Dist: diskcache; extra == "all"
140
- Requires-Dist: pydantic-settings; extra == "all"
134
+ Requires-Dist: yamlscript; extra == "all"
135
+ Requires-Dist: openpyxl; extra == "all"
136
+ Requires-Dist: logfire[httpx]; extra == "all"
137
+ Requires-Dist: sentence_transformers; extra == "all"
141
138
  Requires-Dist: filetype; extra == "all"
142
- Requires-Dist: logfire[fastapi]; extra == "all"
143
- Requires-Dist: pydantic; extra == "all"
144
- Requires-Dist: torchaudio; extra == "all"
145
- Requires-Dist: pandas; extra == "all"
146
- Requires-Dist: distributed; extra == "all"
139
+ Requires-Dist: google-api-python-client; extra == "all"
140
+ Requires-Dist: pymupdf4llm; extra == "all"
141
+ Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
147
142
  Requires-Dist: dnspython[doh]; extra == "all"
148
- Requires-Dist: regex; extra == "all"
149
- Requires-Dist: sentence_transformers; extra == "all"
150
- Requires-Dist: contexttimer; extra == "all"
151
- Requires-Dist: google-auth-httplib2; extra == "all"
152
- Requires-Dist: tinynetrc; extra == "all"
153
- Requires-Dist: ollama; extra == "all"
143
+ Requires-Dist: pytest-cov; extra == "all"
154
144
  Requires-Dist: docker; extra == "all"
155
- Requires-Dist: logfire[httpx]; extra == "all"
156
- Requires-Dist: dask[bag]; extra == "all"
157
- Requires-Dist: yamlscript; extra == "all"
158
- Requires-Dist: flet[all]; extra == "all"
145
+ Requires-Dist: pydantic-settings; extra == "all"
146
+ Requires-Dist: google-auth-oauthlib; extra == "all"
147
+ Requires-Dist: flet-webview; extra == "all"
148
+ Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
149
+ Requires-Dist: transformers[sentencepiece]; extra == "all"
150
+ Requires-Dist: torchvision; extra == "all"
151
+ Requires-Dist: appdirs; extra == "all"
152
+ Requires-Dist: httpx; extra == "all"
153
+ Requires-Dist: tinynetrc; extra == "all"
154
+ Requires-Dist: tabulate; extra == "all"
155
+ Requires-Dist: setuptools; extra == "all"
156
+ Requires-Dist: faker; extra == "all"
157
+ Requires-Dist: google-auth-httplib2; extra == "all"
159
158
  Requires-Dist: peft; extra == "all"
160
- Requires-Dist: pytest-cov; extra == "all"
159
+ Requires-Dist: torchaudio; extra == "all"
161
160
  Requires-Dist: fastapi; extra == "all"
162
- Requires-Dist: deepmerge; extra == "all"
163
- Requires-Dist: torchvision; extra == "all"
164
- Requires-Dist: sre_yield; extra == "all"
165
- Requires-Dist: tokenizers; extra == "all"
161
+ Requires-Dist: pydantic; extra == "all"
162
+ Requires-Dist: openai; extra == "all"
163
+ Requires-Dist: flet-video; extra == "all"
164
+ Requires-Dist: logfire; extra == "all"
165
+ Requires-Dist: distributed; extra == "all"
166
+ Requires-Dist: dask[bag]; extra == "all"
166
167
  Requires-Dist: html2text; extra == "all"
167
- Requires-Dist: flet-webview; extra == "all"
168
- Requires-Dist: appdirs; extra == "all"
169
- Requires-Dist: json_repair; extra == "all"
170
- Requires-Dist: google-api-python-client; extra == "all"
171
168
  Requires-Dist: pyyaml; extra == "all"
172
- Requires-Dist: logfire; extra == "all"
173
- Requires-Dist: Unidecode; extra == "all"
169
+ Requires-Dist: json_repair; extra == "all"
170
+ Requires-Dist: diskcache; extra == "all"
174
171
  Requires-Dist: semver; extra == "all"
175
- Requires-Dist: setuptools; extra == "all"
172
+ Requires-Dist: sre_yield; extra == "all"
173
+ Requires-Dist: flet[all]; extra == "all"
174
+ Requires-Dist: google-auth; extra == "all"
176
175
  Requires-Dist: bokeh; extra == "all"
177
- Requires-Dist: openpyxl; extra == "all"
178
- Requires-Dist: flet-video; extra == "all"
179
- Requires-Dist: pymupdf4llm; extra == "all"
180
- Requires-Dist: httpx; extra == "all"
181
- Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
176
+ Requires-Dist: pandas; extra == "all"
177
+ Requires-Dist: ollama; extra == "all"
178
+ Requires-Dist: deepmerge; extra == "all"
179
+ Requires-Dist: huggingface_hub; extra == "all"
182
180
  Requires-Dist: uvicorn[standard]; extra == "all"
183
- Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
181
+ Requires-Dist: logfire[fastapi]; extra == "all"
182
+ Requires-Dist: tokenizers; extra == "all"
183
+ Requires-Dist: contexttimer; 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=5pZ8TOrOwM2vmag6Db4CDCGxs6kAbzjhTi28NBii5eI,1590
6
+ fmtr/tools/constants.py,sha256=Fn2slqXD3H-aNRtAWlMC_917QLQE3j6EoluubluU7K0,1647
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
@@ -45,7 +45,7 @@ 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=NUTl8Yr_rYvLMHb0tH-4fCfEhIlAfyA63OegFPMrwgc,6
48
+ fmtr/tools/version,sha256=YBoYNR9WchaLncc91xeTHbs6ppdY4HdAcbzle2w5d90,6
49
49
  fmtr/tools/yaml_tools.py,sha256=Bhhyd6GQVKO72Lp8ky7bAUjIB_65Hdh0Q45SKIEe6S8,1901
50
50
  fmtr/tools/ai_tools/__init__.py,sha256=JZrLuOFNV1A3wvJgonxOgz_4WS-7MfCuowGWA5uYCjs,372
51
51
  fmtr/tools/ai_tools/agentic_tools.py,sha256=acSEPFS-aguDXanWGs3fAAlRyJSYPZW7L-Kb2qDLm-I,4300
@@ -61,9 +61,9 @@ fmtr/tools/entrypoints/ep_test.py,sha256=B8HfWISfSgw_xVX475CbJGh_QnpOe9MH65H8qGj
61
61
  fmtr/tools/entrypoints/install_yamlscript.py,sha256=D9-QET4uPkwMvOBQJAgzn1fYb7Z7VAgZzFdHSAXc3Qc,116
62
62
  fmtr/tools/entrypoints/remote_debug_test.py,sha256=wmKg9o2pQq7eqeHmaO8oviujNgtnsCVEXOdXLIcQWs4,123
63
63
  fmtr/tools/entrypoints/shell_debug.py,sha256=0No3tAg9Ri4_vvSlQCUtAY-11HR0nE45i0VVtiAViwY,106
64
- fmtr/tools/interface_tools/__init__.py,sha256=RBg-QC7OO-PdAbFBadzHTzgjASchrKavAqdVbmBq4nM,310
65
- fmtr/tools/interface_tools/controls.py,sha256=W5gVzxLqgiqVp4Ryr3UR4Yrtmoz5IeDpl9hw3Sld2W8,2991
66
- fmtr/tools/interface_tools/interface_tools.py,sha256=FBvtWSGFvgieDT-cOSY9KAW6csnObFKyj8O-QnsekE4,2252
64
+ fmtr/tools/interface_tools/__init__.py,sha256=nODVT7v657onpmak7qbW4P8NoW2HQqyeEDUSx5pZAFg,331
65
+ fmtr/tools/interface_tools/controls.py,sha256=oOl0_sZB8fkvYB-9A5yjArfQmFQLMCsVGgRNrJAFJm4,332
66
+ fmtr/tools/interface_tools/interface_tools.py,sha256=wo5lVJrk3SxsByFTT0L1dkZpxsSdvx7U-Oh0-c_GowE,3098
67
67
  fmtr/tools/path_tools/__init__.py,sha256=v5CpmzXq5Ii90FtcmxAJKiLxmguZMrPnQ_HdT872Np0,443
68
68
  fmtr/tools/path_tools/app_path_tools.py,sha256=JrJvtTDd_gkCKcZtBCDTMktsM77PZwGV_hzQX0g5GU8,1722
69
69
  fmtr/tools/path_tools/path_tools.py,sha256=eh30PpmH0wopy0wNWuPT84cmXY1EvqsTSDT7AV_GPOY,8034
@@ -80,9 +80,9 @@ fmtr/tools/tests/test_path.py,sha256=AkZQa6_8BQ-VaCyL_J-iKmdf2ZaM-xFYR37Kun3k4_g
80
80
  fmtr/tools/tests/test_yaml.py,sha256=jc0TwwKu9eC0LvFGNMERdgBue591xwLxYXFbtsRwXVM,287
81
81
  fmtr/tools/version_tools/__init__.py,sha256=pg4iLtmIr5HtyEW_j0fMFoIdzqi_w9xH8-grQaXLB28,318
82
82
  fmtr/tools/version_tools/version_tools.py,sha256=Hcc6yferZS1hHbugRTdiHhSNmXEEG0hjCiTTXKna-YY,1127
83
- fmtr_tools-1.3.29.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
84
- fmtr_tools-1.3.29.dist-info/METADATA,sha256=6HSn_2iCjQC37aDMtMZ_Ebm8c9Bw1WrEaDUODBRpfn0,15938
85
- fmtr_tools-1.3.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
86
- fmtr_tools-1.3.29.dist-info/entry_points.txt,sha256=h-r__Xh5njtFqreMLg6cGuTFS4Qh-QqJPU1HB-_BS-Q,357
87
- fmtr_tools-1.3.29.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
88
- fmtr_tools-1.3.29.dist-info/RECORD,,
83
+ fmtr_tools-1.3.30.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
84
+ fmtr_tools-1.3.30.dist-info/METADATA,sha256=3Y6GKGZBoESk3d08CtLk00Z81uweyiQK30uB-6lmfBY,15938
85
+ fmtr_tools-1.3.30.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
86
+ fmtr_tools-1.3.30.dist-info/entry_points.txt,sha256=h-r__Xh5njtFqreMLg6cGuTFS4Qh-QqJPU1HB-_BS-Q,357
87
+ fmtr_tools-1.3.30.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
88
+ fmtr_tools-1.3.30.dist-info/RECORD,,