fmtr.tools 1.3.21__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.
- fmtr/tools/api_tools.py +5 -3
- fmtr/tools/interface_tools.py +41 -16
- fmtr/tools/version +1 -1
- {fmtr_tools-1.3.21.dist-info → fmtr_tools-1.3.23.dist-info}/METADATA +45 -45
- {fmtr_tools-1.3.21.dist-info → fmtr_tools-1.3.23.dist-info}/RECORD +9 -9
- {fmtr_tools-1.3.21.dist-info → fmtr_tools-1.3.23.dist-info}/WHEEL +0 -0
- {fmtr_tools-1.3.21.dist-info → fmtr_tools-1.3.23.dist-info}/entry_points.txt +0 -0
- {fmtr_tools-1.3.21.dist-info → fmtr_tools-1.3.23.dist-info}/licenses/LICENSE +0 -0
- {fmtr_tools-1.3.21.dist-info → fmtr_tools-1.3.23.dist-info}/top_level.txt +0 -0
fmtr/tools/api_tools.py
CHANGED
|
@@ -24,7 +24,7 @@ class Endpoint:
|
|
|
24
24
|
self.tags = enlist(self.tags)
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
class
|
|
27
|
+
class Base:
|
|
28
28
|
"""
|
|
29
29
|
|
|
30
30
|
Simple API base class, generalising endpoint-as-method config.
|
|
@@ -33,6 +33,8 @@ class ApiBase:
|
|
|
33
33
|
TITLE = 'Base API'
|
|
34
34
|
HOST = '0.0.0.0'
|
|
35
35
|
PORT = 8080
|
|
36
|
+
SWAGGER_PARAMS = dict(tryItOutEnabled=True)
|
|
37
|
+
URL_DOCS = '/docs'
|
|
36
38
|
|
|
37
39
|
def add_endpoint(self, endpoint: Endpoint):
|
|
38
40
|
"""
|
|
@@ -51,7 +53,7 @@ class ApiBase:
|
|
|
51
53
|
)(endpoint.method)
|
|
52
54
|
|
|
53
55
|
def __init__(self):
|
|
54
|
-
self.app = FastAPI(title=self.TITLE)
|
|
56
|
+
self.app = FastAPI(title=self.TITLE, swagger_ui_parameters=self.SWAGGER_PARAMS, docs_url=self.URL_DOCS)
|
|
55
57
|
logger.instrument_fastapi(self.app)
|
|
56
58
|
|
|
57
59
|
for endpoint in self.get_endpoints():
|
|
@@ -95,4 +97,4 @@ class ApiBase:
|
|
|
95
97
|
|
|
96
98
|
|
|
97
99
|
if __name__ == '__main__':
|
|
98
|
-
|
|
100
|
+
Base.launch()
|
fmtr/tools/interface_tools.py
CHANGED
|
@@ -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
|
-
|
|
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.
|
|
31
|
-
page.
|
|
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(
|
|
39
|
+
page.go(cls.ROUTE_ROOT)
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
@classmethod
|
|
42
|
+
def route(cls, event: ft.RouteChangeEvent):
|
|
36
43
|
"""
|
|
37
44
|
|
|
38
45
|
Overridable router.
|
|
39
46
|
|
|
40
47
|
"""
|
|
41
|
-
|
|
48
|
+
logger.debug(f'Route change: {event=}')
|
|
42
49
|
|
|
43
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
1
|
+
1.3.23
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fmtr.tools
|
|
3
|
-
Version: 1.3.
|
|
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:
|
|
130
|
-
Requires-Dist:
|
|
131
|
-
Requires-Dist: tokenizers; extra == "all"
|
|
132
|
-
Requires-Dist: pandas; extra == "all"
|
|
133
|
-
Requires-Dist: httpx; extra == "all"
|
|
134
|
-
Requires-Dist: setuptools; extra == "all"
|
|
135
|
-
Requires-Dist: Unidecode; extra == "all"
|
|
136
|
-
Requires-Dist: html2text; extra == "all"
|
|
137
|
-
Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
|
|
138
|
-
Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
|
|
139
|
-
Requires-Dist: httpx_retries; extra == "all"
|
|
140
|
-
Requires-Dist: filetype; extra == "all"
|
|
141
|
-
Requires-Dist: dask[bag]; extra == "all"
|
|
142
|
-
Requires-Dist: pydantic; extra == "all"
|
|
143
|
-
Requires-Dist: pymupdf4llm; extra == "all"
|
|
129
|
+
Requires-Dist: tabulate; extra == "all"
|
|
130
|
+
Requires-Dist: yamlscript; extra == "all"
|
|
144
131
|
Requires-Dist: docker; extra == "all"
|
|
145
|
-
Requires-Dist:
|
|
146
|
-
Requires-Dist:
|
|
147
|
-
Requires-Dist:
|
|
148
|
-
Requires-Dist: openai; extra == "all"
|
|
149
|
-
Requires-Dist: logfire[fastapi]; extra == "all"
|
|
132
|
+
Requires-Dist: tinynetrc; extra == "all"
|
|
133
|
+
Requires-Dist: cachetools; extra == "all"
|
|
134
|
+
Requires-Dist: distributed; extra == "all"
|
|
150
135
|
Requires-Dist: bokeh; extra == "all"
|
|
151
|
-
Requires-Dist:
|
|
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"
|
|
152
144
|
Requires-Dist: pyyaml; extra == "all"
|
|
153
|
-
Requires-Dist:
|
|
154
|
-
Requires-Dist:
|
|
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"
|
|
150
|
+
Requires-Dist: pandas; extra == "all"
|
|
151
|
+
Requires-Dist: pydantic-settings; extra == "all"
|
|
152
|
+
Requires-Dist: logfire; extra == "all"
|
|
155
153
|
Requires-Dist: json_repair; extra == "all"
|
|
154
|
+
Requires-Dist: google-auth-oauthlib; extra == "all"
|
|
155
|
+
Requires-Dist: pytest-cov; extra == "all"
|
|
156
156
|
Requires-Dist: sentence_transformers; extra == "all"
|
|
157
|
+
Requires-Dist: contexttimer; extra == "all"
|
|
158
|
+
Requires-Dist: regex; extra == "all"
|
|
159
|
+
Requires-Dist: logfire[fastapi]; extra == "all"
|
|
160
|
+
Requires-Dist: flet-webview; extra == "all"
|
|
161
|
+
Requires-Dist: torchaudio; extra == "all"
|
|
157
162
|
Requires-Dist: peft; extra == "all"
|
|
158
|
-
Requires-Dist:
|
|
159
|
-
Requires-Dist:
|
|
160
|
-
Requires-Dist:
|
|
163
|
+
Requires-Dist: openpyxl; extra == "all"
|
|
164
|
+
Requires-Dist: logfire[httpx]; extra == "all"
|
|
165
|
+
Requires-Dist: Unidecode; extra == "all"
|
|
166
|
+
Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
|
|
167
|
+
Requires-Dist: openai; extra == "all"
|
|
161
168
|
Requires-Dist: faker; extra == "all"
|
|
162
|
-
Requires-Dist:
|
|
163
|
-
Requires-Dist:
|
|
164
|
-
Requires-Dist: pytest-cov; extra == "all"
|
|
165
|
-
Requires-Dist: google-auth; extra == "all"
|
|
166
|
-
Requires-Dist: appdirs; extra == "all"
|
|
167
|
-
Requires-Dist: pydantic-settings; extra == "all"
|
|
168
|
-
Requires-Dist: regex; extra == "all"
|
|
169
|
+
Requires-Dist: uvicorn[standard]; extra == "all"
|
|
170
|
+
Requires-Dist: google-api-python-client; extra == "all"
|
|
169
171
|
Requires-Dist: torchvision; extra == "all"
|
|
170
|
-
Requires-Dist: distributed; extra == "all"
|
|
171
|
-
Requires-Dist: torchaudio; extra == "all"
|
|
172
|
-
Requires-Dist: deepmerge; extra == "all"
|
|
173
|
-
Requires-Dist: fastapi; extra == "all"
|
|
174
|
-
Requires-Dist: flet[all]; extra == "all"
|
|
175
|
-
Requires-Dist: huggingface_hub; extra == "all"
|
|
176
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"
|
|
177
176
|
Requires-Dist: ollama; extra == "all"
|
|
178
|
-
Requires-Dist: contexttimer; extra == "all"
|
|
179
|
-
Requires-Dist: semver; extra == "all"
|
|
180
|
-
Requires-Dist: flet-video; extra == "all"
|
|
181
|
-
Requires-Dist: logfire[httpx]; extra == "all"
|
|
182
|
-
Requires-Dist: tinynetrc; extra == "all"
|
|
183
177
|
Requires-Dist: transformers[sentencepiece]; extra == "all"
|
|
178
|
+
Requires-Dist: appdirs; extra == "all"
|
|
179
|
+
Requires-Dist: dask[bag]; extra == "all"
|
|
180
|
+
Requires-Dist: flet[all]; extra == "all"
|
|
181
|
+
Requires-Dist: pydantic; 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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
fmtr/tools/__init__.py,sha256=sjXo4eRDOPp20zlLpJqaB48h7RQXKJd_RwR3fwD6oGk,5731
|
|
2
|
-
fmtr/tools/api_tools.py,sha256=
|
|
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
|
|
@@ -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=
|
|
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=
|
|
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.
|
|
80
|
-
fmtr_tools-1.3.
|
|
81
|
-
fmtr_tools-1.3.
|
|
82
|
-
fmtr_tools-1.3.
|
|
83
|
-
fmtr_tools-1.3.
|
|
84
|
-
fmtr_tools-1.3.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|