fmtr.tools 1.3.22__py3-none-any.whl → 1.3.23__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.

@@ -1,12 +1,11 @@
1
1
  import flet as ft
2
- from flet.core.event import Event
3
2
  from flet.core.types import AppView
4
3
  from flet.core.view import View
5
4
 
6
5
  from fmtr.tools.logging_tools import logger
7
6
 
8
7
 
9
- class Interface:
8
+ class Interface(ft.Column):
10
9
  """
11
10
 
12
11
  Simple interface base class.
@@ -15,50 +14,76 @@ class Interface:
15
14
  TITLE = 'Base Interface'
16
15
  HOST = '0.0.0.0'
17
16
  PORT = 8080
17
+ URL = None
18
18
  APPVIEW = AppView.WEB_BROWSER
19
19
  PATH_ASSETS = None
20
20
  ROUTE_ROOT = '/'
21
21
 
22
- def render(self, page: ft.Page):
22
+ THEME = ft.Theme(color_scheme=ft.ColorScheme(primary=ft.Colors.PINK))
23
+
24
+ @classmethod
25
+ def render(cls, page: ft.Page):
23
26
  """
24
27
 
25
- Interface entry point.
28
+ Interface entry point. Set relevant callbacks, and add instantiated self to page views
26
29
 
27
30
  """
28
-
29
31
  if not page.on_route_change:
30
- page.on_route_change = lambda e, page=page: self.route(page, e)
31
- page.on_view_pop = lambda view, page=page: self.pop(page, view)
32
+ page.theme = cls.THEME
33
+ page.views.clear()
34
+ page.views.append(cls())
35
+
36
+ page.on_route_change = cls.route
37
+ page.on_view_pop = cls.pop
32
38
 
33
- page.go(self.ROUTE_ROOT)
39
+ page.go(cls.ROUTE_ROOT)
34
40
 
35
- def route(self, page: ft.Page, event: Event):
41
+ @classmethod
42
+ def route(cls, event: ft.RouteChangeEvent):
36
43
  """
37
44
 
38
45
  Overridable router.
39
46
 
40
47
  """
41
- raise NotImplementedError
48
+ logger.debug(f'Route change: {event=}')
42
49
 
43
- def pop(self, page: ft.Page, view: View):
50
+ @classmethod
51
+ def pop(cls, view: View, page: ft.Page):
44
52
  """
45
53
 
46
54
  Overridable view pop.
47
55
 
48
56
  """
49
- raise NotImplementedError
57
+ logger.debug(f'View popped: {page.route=} {len(page.views)=} {view=}')
50
58
 
51
59
  @classmethod
52
60
  def launch(cls):
53
61
  """
54
62
 
55
- Initialise self and launch.
63
+ Launch via render method
56
64
 
57
65
  """
58
- self = cls()
59
- logger.info(f"Launching {self.TITLE} at http://{self.HOST}:{self.PORT}")
60
- ft.app(self.render, view=self.APPVIEW, host=self.HOST, port=self.PORT, assets_dir=self.PATH_ASSETS)
61
66
 
67
+ if cls.URL:
68
+ url = cls.URL
69
+ else:
70
+ url = f'http://{cls.HOST}:{cls.PORT}'
71
+
72
+ logger.info(f"Launching {cls.TITLE} at {url}")
73
+ ft.app(cls.render, view=cls.APPVIEW, host=cls.HOST, port=cls.PORT, assets_dir=cls.PATH_ASSETS)
74
+
75
+
76
+ class Test(ft.Column):
77
+ """
78
+
79
+ Simple test interface.
80
+
81
+ """
82
+ TITLE = 'Test Interface'
83
+
84
+ def __init__(self):
85
+ controls = [ft.Text(self.TITLE)]
86
+ super().__init__(controls=controls)
62
87
 
63
88
  if __name__ == "__main__":
64
89
  Interface.launch()
fmtr/tools/version CHANGED
@@ -1 +1 @@
1
- 1.3.22
1
+ 1.3.23
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmtr.tools
3
- Version: 1.3.22
3
+ Version: 1.3.23
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: contexttimer; extra == "all"
130
- Requires-Dist: httpx; extra == "all"
131
- Requires-Dist: huggingface_hub; extra == "all"
129
+ Requires-Dist: tabulate; extra == "all"
130
+ Requires-Dist: yamlscript; extra == "all"
131
+ Requires-Dist: docker; extra == "all"
132
132
  Requires-Dist: tinynetrc; extra == "all"
133
- Requires-Dist: json_repair; extra == "all"
134
- Requires-Dist: google-auth-httplib2; extra == "all"
133
+ Requires-Dist: cachetools; extra == "all"
135
134
  Requires-Dist: distributed; extra == "all"
136
- Requires-Dist: yamlscript; extra == "all"
135
+ Requires-Dist: bokeh; extra == "all"
136
+ Requires-Dist: huggingface_hub; extra == "all"
137
+ Requires-Dist: diskcache; extra == "all"
138
+ Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
139
+ Requires-Dist: google-auth; extra == "all"
140
+ Requires-Dist: sre_yield; extra == "all"
141
+ Requires-Dist: html2text; extra == "all"
142
+ Requires-Dist: setuptools; extra == "all"
143
+ Requires-Dist: filetype; extra == "all"
144
+ Requires-Dist: pyyaml; extra == "all"
137
145
  Requires-Dist: flet-video; extra == "all"
146
+ Requires-Dist: semver; extra == "all"
147
+ Requires-Dist: httpx; extra == "all"
148
+ Requires-Dist: fastapi; extra == "all"
149
+ Requires-Dist: google-auth-httplib2; extra == "all"
138
150
  Requires-Dist: pandas; extra == "all"
139
- Requires-Dist: filetype; extra == "all"
151
+ Requires-Dist: pydantic-settings; extra == "all"
140
152
  Requires-Dist: logfire; extra == "all"
141
- Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
153
+ Requires-Dist: json_repair; extra == "all"
154
+ Requires-Dist: google-auth-oauthlib; extra == "all"
155
+ Requires-Dist: pytest-cov; extra == "all"
156
+ Requires-Dist: sentence_transformers; extra == "all"
157
+ Requires-Dist: contexttimer; extra == "all"
142
158
  Requires-Dist: regex; extra == "all"
143
- Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
144
159
  Requires-Dist: logfire[fastapi]; extra == "all"
145
- Requires-Dist: pydantic-settings; extra == "all"
146
- Requires-Dist: torchvision; extra == "all"
147
- Requires-Dist: openai; extra == "all"
148
- Requires-Dist: sre_yield; extra == "all"
160
+ Requires-Dist: flet-webview; extra == "all"
161
+ Requires-Dist: torchaudio; extra == "all"
162
+ Requires-Dist: peft; extra == "all"
163
+ Requires-Dist: openpyxl; extra == "all"
149
164
  Requires-Dist: logfire[httpx]; extra == "all"
150
- Requires-Dist: pymupdf4llm; extra == "all"
151
- Requires-Dist: pymupdf; extra == "all"
165
+ Requires-Dist: Unidecode; extra == "all"
166
+ Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
167
+ Requires-Dist: openai; extra == "all"
152
168
  Requires-Dist: faker; extra == "all"
153
169
  Requires-Dist: uvicorn[standard]; extra == "all"
154
- Requires-Dist: pytest-cov; extra == "all"
155
- Requires-Dist: google-auth; extra == "all"
156
- Requires-Dist: appdirs; extra == "all"
157
170
  Requires-Dist: google-api-python-client; extra == "all"
158
- Requires-Dist: docker; extra == "all"
171
+ Requires-Dist: torchvision; extra == "all"
159
172
  Requires-Dist: dnspython[doh]; extra == "all"
173
+ Requires-Dist: pymupdf; extra == "all"
174
+ Requires-Dist: tokenizers; extra == "all"
175
+ Requires-Dist: pymupdf4llm; extra == "all"
176
+ Requires-Dist: ollama; extra == "all"
160
177
  Requires-Dist: transformers[sentencepiece]; extra == "all"
178
+ Requires-Dist: appdirs; extra == "all"
161
179
  Requires-Dist: dask[bag]; extra == "all"
162
- Requires-Dist: flet-webview; extra == "all"
163
- Requires-Dist: diskcache; extra == "all"
164
- Requires-Dist: tokenizers; extra == "all"
165
- Requires-Dist: httpx_retries; extra == "all"
166
- Requires-Dist: Unidecode; extra == "all"
167
- Requires-Dist: cachetools; extra == "all"
168
- Requires-Dist: openpyxl; extra == "all"
169
- Requires-Dist: tabulate; extra == "all"
170
- Requires-Dist: peft; extra == "all"
171
- Requires-Dist: semver; extra == "all"
172
- Requires-Dist: deepmerge; extra == "all"
173
- Requires-Dist: fastapi; extra == "all"
174
180
  Requires-Dist: flet[all]; extra == "all"
175
- Requires-Dist: sentence_transformers; extra == "all"
176
- Requires-Dist: bokeh; extra == "all"
177
- Requires-Dist: torchaudio; extra == "all"
178
- Requires-Dist: pyyaml; extra == "all"
179
- Requires-Dist: setuptools; extra == "all"
180
181
  Requires-Dist: pydantic; extra == "all"
181
- Requires-Dist: html2text; extra == "all"
182
- Requires-Dist: ollama; extra == "all"
183
- Requires-Dist: google-auth-oauthlib; extra == "all"
182
+ Requires-Dist: httpx_retries; extra == "all"
183
+ Requires-Dist: deepmerge; extra == "all"
184
184
  Dynamic: author
185
185
  Dynamic: author-email
186
186
  Dynamic: description
@@ -18,7 +18,7 @@ fmtr/tools/html_tools.py,sha256=0nN8Nz5HtG9bXyApYfHSKEivLlxjsm3Gn6Mg2TK0brI,394
18
18
  fmtr/tools/http_tools.py,sha256=RVwGrBNMyjfbpgAPCSnxEkXfSzXXWARb3ayq981ONQE,464
19
19
  fmtr/tools/import_tools.py,sha256=XJmiWLukRncJAcaGReDn4jIz1_IpVBjfYCQHH1hIg7c,588
20
20
  fmtr/tools/inspection_tools.py,sha256=tLTRvzy9XVomQPi0dfnF_cgwc7KiDVZAr7gPTk4S_bQ,278
21
- fmtr/tools/interface_tools.py,sha256=JVYUV7wuMr24BORuUtNaBlTeBFt8VDGJ3HPRajd7Y_4,1341
21
+ fmtr/tools/interface_tools.py,sha256=jcuh__ahk_F5x0katwsSQsbsBHa90pxhb21i_d6ec-s,1877
22
22
  fmtr/tools/iterator_tools.py,sha256=xj5f0c7LgLK53dddRRRJxBoLaBzlZoQS3_GfmpDPMoo,1311
23
23
  fmtr/tools/json_fix_tools.py,sha256=vNSlswVQnujPmKEqDjFJcO901mjMyv59q3awsT7mlhs,477
24
24
  fmtr/tools/json_tools.py,sha256=WkFc5q7oqMtcFejhN1K5zQFULa9TdLOup83Fr0saDRY,348
@@ -44,7 +44,7 @@ fmtr/tools/tabular_tools.py,sha256=tpIpZzYku1HcJrHZJL6BC39LmN3WUWVhFbK2N7nDVmE,1
44
44
  fmtr/tools/tokenization_tools.py,sha256=me-IBzSLyNYejLybwjO9CNB6Mj2NYfKPaOVThXyaGNg,4268
45
45
  fmtr/tools/tools.py,sha256=CAsApa1YwVdNE6H66Vjivs_mXYvOas3rh7fPELAnTpk,795
46
46
  fmtr/tools/unicode_tools.py,sha256=yS_9wpu8ogNoiIL7s1G_8bETFFO_YQlo4LNPv1NLDeY,52
47
- fmtr/tools/version,sha256=1S8waPxV74wCdn2itKFyhvvnbb7aVuX28-VkRL33YZg,6
47
+ fmtr/tools/version,sha256=fyYacWqslyvbFGoOxwPoTbxyGmbIDUYy3MT7r0EJ6Xw,6
48
48
  fmtr/tools/yaml_tools.py,sha256=Bhhyd6GQVKO72Lp8ky7bAUjIB_65Hdh0Q45SKIEe6S8,1901
49
49
  fmtr/tools/ai_tools/__init__.py,sha256=JZrLuOFNV1A3wvJgonxOgz_4WS-7MfCuowGWA5uYCjs,372
50
50
  fmtr/tools/ai_tools/agentic_tools.py,sha256=acSEPFS-aguDXanWGs3fAAlRyJSYPZW7L-Kb2qDLm-I,4300
@@ -76,9 +76,9 @@ fmtr/tools/tests/test_path.py,sha256=AkZQa6_8BQ-VaCyL_J-iKmdf2ZaM-xFYR37Kun3k4_g
76
76
  fmtr/tools/tests/test_yaml.py,sha256=jc0TwwKu9eC0LvFGNMERdgBue591xwLxYXFbtsRwXVM,287
77
77
  fmtr/tools/version_tools/__init__.py,sha256=pg4iLtmIr5HtyEW_j0fMFoIdzqi_w9xH8-grQaXLB28,318
78
78
  fmtr/tools/version_tools/version_tools.py,sha256=Hcc6yferZS1hHbugRTdiHhSNmXEEG0hjCiTTXKna-YY,1127
79
- fmtr_tools-1.3.22.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
80
- fmtr_tools-1.3.22.dist-info/METADATA,sha256=yUEzCAR0OIWjGPaYvZVbZiGY52sHLyz2rPXQgMVlWxM,15938
81
- fmtr_tools-1.3.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
82
- fmtr_tools-1.3.22.dist-info/entry_points.txt,sha256=h-r__Xh5njtFqreMLg6cGuTFS4Qh-QqJPU1HB-_BS-Q,357
83
- fmtr_tools-1.3.22.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
84
- fmtr_tools-1.3.22.dist-info/RECORD,,
79
+ fmtr_tools-1.3.23.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
80
+ fmtr_tools-1.3.23.dist-info/METADATA,sha256=jAci6A-xdl04D7Bd6MXzy63MiZXyFudVV5sDy-32L3E,15938
81
+ fmtr_tools-1.3.23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
82
+ fmtr_tools-1.3.23.dist-info/entry_points.txt,sha256=h-r__Xh5njtFqreMLg6cGuTFS4Qh-QqJPU1HB-_BS-Q,357
83
+ fmtr_tools-1.3.23.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
84
+ fmtr_tools-1.3.23.dist-info/RECORD,,