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

@@ -3,5 +3,6 @@ from fmtr.tools.import_tools import MissingExtraMockModule
3
3
  try:
4
4
  from fmtr.tools.interface_tools.interface_tools import Interface, update, progress
5
5
  from fmtr.tools.interface_tools import controls
6
+ from fmtr.tools.interface_tools.context import Context
6
7
  except ImportError as exception:
7
8
  Interface = update = progress = controls = MissingExtraMockModule('interface', exception)
@@ -0,0 +1,13 @@
1
+ from dataclasses import dataclass
2
+
3
+ from flet.core.page import Page
4
+
5
+
6
+ @dataclass
7
+ class Context:
8
+ """
9
+
10
+ Base context class
11
+
12
+ """
13
+ page: Page
@@ -1,12 +1,13 @@
1
- from functools import cached_property
2
-
3
1
  import flet as ft
4
2
  from flet.core.types import AppView
5
3
  from flet.core.view import View
4
+ from functools import cached_property
5
+ from typing import TypeVar, Generic, Type
6
6
 
7
7
  from fmtr.tools import environment_tools
8
8
  from fmtr.tools.constants import Constants
9
9
  from fmtr.tools.function_tools import MethodDecorator
10
+ from fmtr.tools.interface_tools.context import Context
10
11
  from fmtr.tools.logging_tools import logger
11
12
 
12
13
 
@@ -55,9 +56,10 @@ class progress(update):
55
56
  super().stop(instance)
56
57
 
57
58
 
59
+ T = TypeVar('T', bound=Context)
58
60
 
59
61
 
60
- class Interface(ft.Column):
62
+ class Interface(Generic[T], ft.Column):
61
63
  """
62
64
 
63
65
  Simple interface base class.
@@ -72,12 +74,15 @@ class Interface(ft.Column):
72
74
  ROUTE_ROOT = '/'
73
75
  SCROLL = ft.ScrollMode.AUTO
74
76
 
75
- def __init__(self, *args, **kwargs):
77
+ TypeContext: Type[T] = Context
78
+
79
+ def __init__(self, context: T, *args, **kwargs):
76
80
  """
77
81
 
78
82
  Instantiate and apply interface config
79
83
 
80
84
  """
85
+ self.context = context
81
86
  super().__init__(*args, **kwargs, scroll=self.SCROLL)
82
87
 
83
88
  @classmethod
@@ -88,9 +93,11 @@ class Interface(ft.Column):
88
93
 
89
94
  """
90
95
  if not page.on_route_change:
96
+ page.title = cls.TITLE
91
97
  page.theme = cls.get_theme()
92
98
  page.views.clear()
93
- self = cls()
99
+ context = cls.TypeContext(page=page)
100
+ self = cls(context)
94
101
  view = self.view
95
102
  if not view:
96
103
  view = self
@@ -156,17 +163,20 @@ class Interface(ft.Column):
156
163
  )
157
164
  return theme
158
165
 
159
- class Test(Interface):
166
+
167
+ class Test(Interface[Context]):
160
168
  """
161
169
 
162
- Simple test interface.
170
+ Simple test interface, showing typing example.
163
171
 
164
172
  """
173
+ TypeContext: Type[Context] = Context
174
+
165
175
  TITLE = 'Test Interface'
166
176
 
167
- def __init__(self):
177
+ def __init__(self, context: Context):
168
178
  controls = [ft.Text(self.TITLE)]
169
- super().__init__(controls=controls)
179
+ super().__init__(context=context, controls=controls)
170
180
 
171
181
  if __name__ == "__main__":
172
182
  Test.launch()
fmtr/tools/version CHANGED
@@ -1 +1 @@
1
- 1.3.39
1
+ 1.3.41
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmtr.tools
3
- Version: 1.3.39
3
+ Version: 1.3.41
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
@@ -86,7 +86,6 @@ Provides-Extra: interface
86
86
  Requires-Dist: flet[all]; extra == "interface"
87
87
  Requires-Dist: flet-video; extra == "interface"
88
88
  Requires-Dist: flet-webview; extra == "interface"
89
- Requires-Dist: pydantic; extra == "interface"
90
89
  Provides-Extra: google-api
91
90
  Requires-Dist: google-auth; extra == "google-api"
92
91
  Requires-Dist: google-auth-oauthlib; extra == "google-api"
@@ -133,62 +132,62 @@ Requires-Dist: logfire[httpx]; extra == "webhook"
133
132
  Provides-Extra: browsers
134
133
  Requires-Dist: playwright; extra == "browsers"
135
134
  Provides-Extra: all
136
- Requires-Dist: Unidecode; extra == "all"
137
- Requires-Dist: tabulate; extra == "all"
138
- Requires-Dist: tokenizers; extra == "all"
139
- Requires-Dist: bokeh; extra == "all"
140
- Requires-Dist: google-auth; extra == "all"
141
- Requires-Dist: flet-video; extra == "all"
142
- Requires-Dist: appdirs; extra == "all"
143
- Requires-Dist: logfire[fastapi]; extra == "all"
144
- Requires-Dist: contexttimer; extra == "all"
145
- Requires-Dist: json_repair; extra == "all"
146
- Requires-Dist: httpx_retries; extra == "all"
147
- Requires-Dist: html2text; extra == "all"
148
- Requires-Dist: deepmerge; extra == "all"
149
- Requires-Dist: openpyxl; extra == "all"
150
- Requires-Dist: pandas; extra == "all"
151
- Requires-Dist: dnspython[doh]; extra == "all"
152
- Requires-Dist: docker; extra == "all"
153
- Requires-Dist: pymupdf; extra == "all"
135
+ Requires-Dist: dask[bag]; extra == "all"
154
136
  Requires-Dist: google-auth-httplib2; extra == "all"
155
- Requires-Dist: pymupdf4llm; extra == "all"
156
- Requires-Dist: distributed; extra == "all"
157
- Requires-Dist: cachetools; extra == "all"
137
+ Requires-Dist: pymupdf; extra == "all"
138
+ Requires-Dist: httpx_retries; extra == "all"
139
+ Requires-Dist: contexttimer; extra == "all"
140
+ Requires-Dist: sre_yield; extra == "all"
158
141
  Requires-Dist: peft; extra == "all"
159
- Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
160
- Requires-Dist: faker; extra == "all"
161
- Requires-Dist: filetype; extra == "all"
142
+ Requires-Dist: diskcache; extra == "all"
143
+ Requires-Dist: fastapi; extra == "all"
144
+ Requires-Dist: json_repair; extra == "all"
145
+ Requires-Dist: pydantic; extra == "all"
146
+ Requires-Dist: bokeh; extra == "all"
162
147
  Requires-Dist: sentence_transformers; extra == "all"
148
+ Requires-Dist: cachetools; extra == "all"
149
+ Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
150
+ Requires-Dist: transformers[sentencepiece]; extra == "all"
163
151
  Requires-Dist: setuptools; extra == "all"
164
152
  Requires-Dist: yamlscript; extra == "all"
165
- Requires-Dist: dask[bag]; extra == "all"
166
- Requires-Dist: logfire[httpx]; extra == "all"
167
- Requires-Dist: flet[all]; extra == "all"
168
- Requires-Dist: pydantic; extra == "all"
169
- Requires-Dist: regex; extra == "all"
170
- Requires-Dist: google-api-python-client; extra == "all"
153
+ Requires-Dist: pandas; extra == "all"
171
154
  Requires-Dist: huggingface_hub; extra == "all"
172
- Requires-Dist: pydantic-settings; extra == "all"
173
- Requires-Dist: tinynetrc; extra == "all"
174
- Requires-Dist: transformers[sentencepiece]; extra == "all"
175
- Requires-Dist: ollama; extra == "all"
155
+ Requires-Dist: semver; extra == "all"
156
+ Requires-Dist: openpyxl; extra == "all"
157
+ Requires-Dist: docker; extra == "all"
158
+ Requires-Dist: logfire[fastapi]; extra == "all"
159
+ Requires-Dist: appdirs; extra == "all"
176
160
  Requires-Dist: google-auth-oauthlib; extra == "all"
177
- Requires-Dist: pytest-cov; extra == "all"
178
- Requires-Dist: torchaudio; extra == "all"
179
161
  Requires-Dist: httpx; extra == "all"
162
+ Requires-Dist: filetype; extra == "all"
163
+ Requires-Dist: tinynetrc; extra == "all"
164
+ Requires-Dist: html2text; extra == "all"
165
+ Requires-Dist: deepmerge; extra == "all"
166
+ Requires-Dist: Unidecode; extra == "all"
167
+ Requires-Dist: distributed; extra == "all"
180
168
  Requires-Dist: uvicorn[standard]; extra == "all"
181
- Requires-Dist: diskcache; extra == "all"
182
- Requires-Dist: playwright; extra == "all"
183
- Requires-Dist: logfire; extra == "all"
184
- Requires-Dist: fastapi; extra == "all"
185
- Requires-Dist: sre_yield; extra == "all"
186
- Requires-Dist: openai; extra == "all"
187
- Requires-Dist: semver; extra == "all"
188
- Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
169
+ Requires-Dist: pymupdf4llm; extra == "all"
189
170
  Requires-Dist: torchvision; extra == "all"
171
+ Requires-Dist: torchaudio; extra == "all"
172
+ Requires-Dist: tabulate; extra == "all"
173
+ Requires-Dist: flet[all]; extra == "all"
190
174
  Requires-Dist: pyyaml; extra == "all"
175
+ Requires-Dist: openai; extra == "all"
176
+ Requires-Dist: google-api-python-client; extra == "all"
177
+ Requires-Dist: logfire; extra == "all"
178
+ Requires-Dist: dnspython[doh]; extra == "all"
179
+ Requires-Dist: playwright; extra == "all"
180
+ Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
181
+ Requires-Dist: logfire[httpx]; extra == "all"
182
+ Requires-Dist: regex; extra == "all"
183
+ Requires-Dist: pydantic-settings; extra == "all"
184
+ Requires-Dist: flet-video; extra == "all"
185
+ Requires-Dist: tokenizers; extra == "all"
191
186
  Requires-Dist: flet-webview; extra == "all"
187
+ Requires-Dist: ollama; extra == "all"
188
+ Requires-Dist: pytest-cov; extra == "all"
189
+ Requires-Dist: google-auth; extra == "all"
190
+ Requires-Dist: faker; extra == "all"
192
191
  Dynamic: author
193
192
  Dynamic: author-email
194
193
  Dynamic: description
@@ -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=X0h-7BeauKqNJDa25REZFacQpPeKRTGCByBGn_deWBk,6
48
+ fmtr/tools/version,sha256=VMQ_oU5ocbskwTgCV5usCCHqsCQ7N1mpu0Huh2zHuvk,6
49
49
  fmtr/tools/webhook_tools.py,sha256=q3pVJ1NCem2SrMuFcLxiWd7DibFs7Q-uGtojfXd3Qcg,380
50
50
  fmtr/tools/yaml_tools.py,sha256=Bhhyd6GQVKO72Lp8ky7bAUjIB_65Hdh0Q45SKIEe6S8,1901
51
51
  fmtr/tools/ai_tools/__init__.py,sha256=JZrLuOFNV1A3wvJgonxOgz_4WS-7MfCuowGWA5uYCjs,372
@@ -62,9 +62,10 @@ fmtr/tools/entrypoints/ep_test.py,sha256=B8HfWISfSgw_xVX475CbJGh_QnpOe9MH65H8qGj
62
62
  fmtr/tools/entrypoints/install_yamlscript.py,sha256=D9-QET4uPkwMvOBQJAgzn1fYb7Z7VAgZzFdHSAXc3Qc,116
63
63
  fmtr/tools/entrypoints/remote_debug_test.py,sha256=wmKg9o2pQq7eqeHmaO8oviujNgtnsCVEXOdXLIcQWs4,123
64
64
  fmtr/tools/entrypoints/shell_debug.py,sha256=0No3tAg9Ri4_vvSlQCUtAY-11HR0nE45i0VVtiAViwY,106
65
- fmtr/tools/interface_tools/__init__.py,sha256=nODVT7v657onpmak7qbW4P8NoW2HQqyeEDUSx5pZAFg,331
65
+ fmtr/tools/interface_tools/__init__.py,sha256=hgierRDkJDXrYkPM4z-m44aL7OMS8DKNKJzaXayBmw4,390
66
+ fmtr/tools/interface_tools/context.py,sha256=VpoR_ZCndDbwS0AzIPKi1hB2QckwJU5dJqAJavF3mqk,151
66
67
  fmtr/tools/interface_tools/controls.py,sha256=oOl0_sZB8fkvYB-9A5yjArfQmFQLMCsVGgRNrJAFJm4,332
67
- fmtr/tools/interface_tools/interface_tools.py,sha256=a7WRwf8TKek8ML08ANfkncLfoMHWk5b_929bFf3Y6cQ,3577
68
+ fmtr/tools/interface_tools/interface_tools.py,sha256=6cNHBIYNGtLAK16pk3KMrl_ru39OZ_emH7yXtSkvgFE,3998
68
69
  fmtr/tools/path_tools/__init__.py,sha256=v5CpmzXq5Ii90FtcmxAJKiLxmguZMrPnQ_HdT872Np0,443
69
70
  fmtr/tools/path_tools/app_path_tools.py,sha256=JrJvtTDd_gkCKcZtBCDTMktsM77PZwGV_hzQX0g5GU8,1722
70
71
  fmtr/tools/path_tools/path_tools.py,sha256=eh30PpmH0wopy0wNWuPT84cmXY1EvqsTSDT7AV_GPOY,8034
@@ -81,9 +82,9 @@ fmtr/tools/tests/test_path.py,sha256=AkZQa6_8BQ-VaCyL_J-iKmdf2ZaM-xFYR37Kun3k4_g
81
82
  fmtr/tools/tests/test_yaml.py,sha256=jc0TwwKu9eC0LvFGNMERdgBue591xwLxYXFbtsRwXVM,287
82
83
  fmtr/tools/version_tools/__init__.py,sha256=pg4iLtmIr5HtyEW_j0fMFoIdzqi_w9xH8-grQaXLB28,318
83
84
  fmtr/tools/version_tools/version_tools.py,sha256=Hcc6yferZS1hHbugRTdiHhSNmXEEG0hjCiTTXKna-YY,1127
84
- fmtr_tools-1.3.39.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
85
- fmtr_tools-1.3.39.dist-info/METADATA,sha256=LioB91BL767fAM6aTZjf73CDtwZD39UnOw6XnrMcSuk,16259
86
- fmtr_tools-1.3.39.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
87
- fmtr_tools-1.3.39.dist-info/entry_points.txt,sha256=h-r__Xh5njtFqreMLg6cGuTFS4Qh-QqJPU1HB-_BS-Q,357
88
- fmtr_tools-1.3.39.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
89
- fmtr_tools-1.3.39.dist-info/RECORD,,
85
+ fmtr_tools-1.3.41.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
86
+ fmtr_tools-1.3.41.dist-info/METADATA,sha256=Bce-ZD6t_bBudCLzRm0aYFUPW_9vpkFfoTn41B02vXY,16213
87
+ fmtr_tools-1.3.41.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
88
+ fmtr_tools-1.3.41.dist-info/entry_points.txt,sha256=h-r__Xh5njtFqreMLg6cGuTFS4Qh-QqJPU1HB-_BS-Q,357
89
+ fmtr_tools-1.3.41.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
90
+ fmtr_tools-1.3.41.dist-info/RECORD,,