fmtr.tools 1.3.28__tar.gz → 1.3.30__tar.gz

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.

Files changed (97) hide show
  1. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/PKG-INFO +43 -43
  2. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/constants.py +2 -0
  3. fmtr_tools-1.3.30/fmtr/tools/context_tools.py +23 -0
  4. fmtr_tools-1.3.30/fmtr/tools/function_tools.py +91 -0
  5. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/interface_tools/__init__.py +2 -2
  6. fmtr_tools-1.3.30/fmtr/tools/interface_tools/controls.py +13 -0
  7. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/interface_tools/interface_tools.py +44 -7
  8. fmtr_tools-1.3.30/fmtr/tools/version +1 -0
  9. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr.tools.egg-info/PKG-INFO +43 -43
  10. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr.tools.egg-info/SOURCES.txt +2 -0
  11. fmtr_tools-1.3.28/fmtr/tools/function_tools.py +0 -33
  12. fmtr_tools-1.3.28/fmtr/tools/interface_tools/controls.py +0 -137
  13. fmtr_tools-1.3.28/fmtr/tools/version +0 -1
  14. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/LICENSE +0 -0
  15. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/README.md +0 -0
  16. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/__init__.py +0 -0
  17. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/ai_tools/__init__.py +0 -0
  18. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/ai_tools/agentic_tools.py +0 -0
  19. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/ai_tools/inference_tools.py +0 -0
  20. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/api_tools.py +0 -0
  21. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/async_tools.py +0 -0
  22. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/augmentation_tools.py +0 -0
  23. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/caching_tools.py +0 -0
  24. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/data_modelling_tools.py +0 -0
  25. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/dataclass_tools.py +0 -0
  26. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/datatype_tools.py +0 -0
  27. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/debugging_tools.py +0 -0
  28. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/dns_tools/__init__.py +0 -0
  29. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/dns_tools/client.py +0 -0
  30. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/dns_tools/dm.py +0 -0
  31. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/dns_tools/proxy.py +0 -0
  32. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/dns_tools/server.py +0 -0
  33. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/docker_tools.py +0 -0
  34. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/entrypoints/__init__.py +0 -0
  35. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/entrypoints/cache_hfh.py +0 -0
  36. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/entrypoints/ep_test.py +0 -0
  37. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/entrypoints/install_yamlscript.py +0 -0
  38. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/entrypoints/remote_debug_test.py +0 -0
  39. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/entrypoints/shell_debug.py +0 -0
  40. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/environment_tools.py +0 -0
  41. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/google_api_tools.py +0 -0
  42. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/hash_tools.py +0 -0
  43. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/hfh_tools.py +0 -0
  44. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/html_tools.py +0 -0
  45. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/http_tools.py +0 -0
  46. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/import_tools.py +0 -0
  47. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/inherit_tools.py +0 -0
  48. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/inspection_tools.py +0 -0
  49. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/iterator_tools.py +0 -0
  50. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/json_fix_tools.py +0 -0
  51. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/json_tools.py +0 -0
  52. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/logging_tools.py +0 -0
  53. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/merging_tools.py +0 -0
  54. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/metric_tools.py +0 -0
  55. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/name_tools.py +0 -0
  56. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/netrc_tools.py +0 -0
  57. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/openai_tools.py +0 -0
  58. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/packaging_tools.py +0 -0
  59. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/parallel_tools.py +0 -0
  60. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/path_tools/__init__.py +0 -0
  61. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/path_tools/app_path_tools.py +0 -0
  62. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/path_tools/path_tools.py +0 -0
  63. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/path_tools/type_path_tools.py +0 -0
  64. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/pattern_tools.py +0 -0
  65. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/pdf_tools.py +0 -0
  66. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/platform_tools.py +0 -0
  67. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/process_tools.py +0 -0
  68. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/profiling_tools.py +0 -0
  69. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/random_tools.py +0 -0
  70. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/semantic_tools.py +0 -0
  71. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/settings_tools.py +0 -0
  72. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/setup_tools/__init__.py +0 -0
  73. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/setup_tools/setup_tools.py +0 -0
  74. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/spaces_tools.py +0 -0
  75. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/string_tools.py +0 -0
  76. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/tabular_tools.py +0 -0
  77. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/tests/__init__.py +0 -0
  78. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/tests/conftest.py +0 -0
  79. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/tests/helpers.py +0 -0
  80. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/tests/test_datatype.py +0 -0
  81. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/tests/test_environment.py +0 -0
  82. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/tests/test_json.py +0 -0
  83. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/tests/test_path.py +0 -0
  84. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/tests/test_yaml.py +0 -0
  85. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/tokenization_tools.py +0 -0
  86. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/tools.py +0 -0
  87. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/unicode_tools.py +0 -0
  88. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/version_tools/__init__.py +0 -0
  89. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/version_tools/version_tools.py +0 -0
  90. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr/tools/yaml_tools.py +0 -0
  91. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr.tools.egg-info/dependency_links.txt +0 -0
  92. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr.tools.egg-info/entry_points.txt +0 -0
  93. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr.tools.egg-info/requires.txt +42 -42
  94. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/fmtr.tools.egg-info/top_level.txt +0 -0
  95. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/pyproject.toml +0 -0
  96. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/setup.cfg +0 -0
  97. {fmtr_tools-1.3.28 → fmtr_tools-1.3.30}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmtr.tools
3
- Version: 1.3.28
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: regex; extra == "all"
130
- Requires-Dist: pandas; extra == "all"
131
- Requires-Dist: httpx; extra == "all"
132
- Requires-Dist: google-auth; extra == "all"
133
- Requires-Dist: torchvision; extra == "all"
134
- Requires-Dist: flet[all]; extra == "all"
135
- Requires-Dist: openpyxl; extra == "all"
136
- Requires-Dist: google-auth-oauthlib; extra == "all"
137
- Requires-Dist: cachetools; extra == "all"
129
+ Requires-Dist: sre_yield; extra == "all"
138
130
  Requires-Dist: filetype; extra == "all"
139
- Requires-Dist: setuptools; extra == "all"
140
- Requires-Dist: sentence_transformers; extra == "all"
141
- Requires-Dist: pydantic-settings; extra == "all"
142
- Requires-Dist: bokeh; extra == "all"
143
- Requires-Dist: peft; extra == "all"
144
- Requires-Dist: flet-webview; extra == "all"
145
- Requires-Dist: openai; extra == "all"
146
- Requires-Dist: torchaudio; extra == "all"
147
- Requires-Dist: google-api-python-client; extra == "all"
148
- Requires-Dist: deepmerge; extra == "all"
149
- Requires-Dist: diskcache; extra == "all"
150
131
  Requires-Dist: huggingface_hub; extra == "all"
151
- Requires-Dist: logfire[fastapi]; extra == "all"
152
- Requires-Dist: google-auth-httplib2; extra == "all"
153
- Requires-Dist: Unidecode; extra == "all"
154
- Requires-Dist: ollama; extra == "all"
155
- Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
156
- Requires-Dist: dnspython[doh]; extra == "all"
157
- Requires-Dist: flet-video; extra == "all"
158
- Requires-Dist: httpx_retries; extra == "all"
159
- Requires-Dist: json_repair; extra == "all"
160
- Requires-Dist: pymupdf4llm; extra == "all"
132
+ Requires-Dist: faker; extra == "all"
161
133
  Requires-Dist: pytest-cov; extra == "all"
162
- Requires-Dist: sre_yield; extra == "all"
134
+ Requires-Dist: logfire[fastapi]; extra == "all"
163
135
  Requires-Dist: contexttimer; extra == "all"
164
- Requires-Dist: semver; extra == "all"
165
- Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
166
- Requires-Dist: fastapi; extra == "all"
136
+ Requires-Dist: sentence_transformers; extra == "all"
137
+ Requires-Dist: httpx; extra == "all"
167
138
  Requires-Dist: tokenizers; extra == "all"
139
+ Requires-Dist: distributed; extra == "all"
140
+ Requires-Dist: peft; extra == "all"
141
+ Requires-Dist: transformers[sentencepiece]; extra == "all"
142
+ Requires-Dist: tinynetrc; extra == "all"
143
+ Requires-Dist: json_repair; extra == "all"
144
+ Requires-Dist: httpx_retries; extra == "all"
168
145
  Requires-Dist: logfire[httpx]; extra == "all"
146
+ Requires-Dist: fastapi; extra == "all"
169
147
  Requires-Dist: pymupdf; extra == "all"
170
- Requires-Dist: html2text; extra == "all"
148
+ Requires-Dist: bokeh; extra == "all"
149
+ Requires-Dist: semver; extra == "all"
150
+ Requires-Dist: google-api-python-client; extra == "all"
151
+ Requires-Dist: deepmerge; extra == "all"
152
+ Requires-Dist: flet-webview; extra == "all"
171
153
  Requires-Dist: pydantic; extra == "all"
154
+ Requires-Dist: html2text; extra == "all"
155
+ Requires-Dist: regex; extra == "all"
156
+ Requires-Dist: google-auth-oauthlib; extra == "all"
157
+ Requires-Dist: Unidecode; extra == "all"
158
+ Requires-Dist: pymupdf4llm; extra == "all"
172
159
  Requires-Dist: yamlscript; extra == "all"
173
- Requires-Dist: uvicorn[standard]; extra == "all"
174
- Requires-Dist: distributed; extra == "all"
175
- Requires-Dist: faker; extra == "all"
176
- Requires-Dist: docker; extra == "all"
177
160
  Requires-Dist: logfire; extra == "all"
161
+ Requires-Dist: docker; extra == "all"
162
+ Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
163
+ Requires-Dist: openpyxl; extra == "all"
164
+ Requires-Dist: torchaudio; extra == "all"
165
+ Requires-Dist: pandas; extra == "all"
166
+ Requires-Dist: google-auth; extra == "all"
167
+ Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
168
+ Requires-Dist: diskcache; extra == "all"
169
+ Requires-Dist: flet[all]; extra == "all"
170
+ Requires-Dist: ollama; extra == "all"
178
171
  Requires-Dist: appdirs; extra == "all"
179
- Requires-Dist: pyyaml; extra == "all"
172
+ Requires-Dist: google-auth-httplib2; extra == "all"
173
+ Requires-Dist: flet-video; extra == "all"
174
+ Requires-Dist: openai; extra == "all"
180
175
  Requires-Dist: dask[bag]; extra == "all"
181
- Requires-Dist: transformers[sentencepiece]; extra == "all"
176
+ Requires-Dist: torchvision; extra == "all"
177
+ Requires-Dist: setuptools; extra == "all"
178
+ Requires-Dist: cachetools; extra == "all"
179
+ Requires-Dist: pyyaml; extra == "all"
180
+ Requires-Dist: pydantic-settings; extra == "all"
181
+ Requires-Dist: uvicorn[standard]; extra == "all"
182
182
  Requires-Dist: tabulate; extra == "all"
183
- Requires-Dist: tinynetrc; extra == "all"
183
+ Requires-Dist: dnspython[doh]; extra == "all"
184
184
  Dynamic: author
185
185
  Dynamic: author-email
186
186
  Dynamic: description
@@ -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'
@@ -0,0 +1,23 @@
1
+ from contextlib import contextmanager, ExitStack
2
+
3
+
4
+ @contextmanager
5
+ def null():
6
+ """
7
+
8
+ Null context manager.
9
+
10
+ """
11
+ yield
12
+
13
+
14
+ @contextmanager
15
+ def contexts(*contexts):
16
+ """
17
+
18
+ Tee context managers.
19
+
20
+ """
21
+ with ExitStack() as stack:
22
+ resources = [stack.enter_context(context) for context in contexts]
23
+ yield resources
@@ -0,0 +1,91 @@
1
+ import functools
2
+ import inspect
3
+ from typing import Tuple
4
+
5
+ from fmtr.tools import context_tools
6
+
7
+
8
+ def combine_args_kwargs(args: dict=None, kwargs: dict=None) -> dict:
9
+ """
10
+
11
+ Combines arguments and keyword arguments into a single dictionary.
12
+
13
+ """
14
+ args = args or []
15
+ kwargs = kwargs or {}
16
+ args = {i: arg for i, arg in enumerate(args)}
17
+ args.update(kwargs)
18
+ if all(isinstance(key, int) for key in args.keys()):
19
+ args = list(args.values())
20
+ return args
21
+
22
+
23
+ def split_args_kwargs(args_kwargs: dict) -> Tuple[list, dict]:
24
+ """
25
+
26
+ Splits arguments and keyword arguments into a list and a dictionary.
27
+
28
+ """
29
+ if isinstance(args_kwargs, list):
30
+ args, kwargs = args_kwargs, {}
31
+ else:
32
+ args = [arg for key, arg in args_kwargs.items() if isinstance(key, int)]
33
+ kwargs = {key: arg for key, arg in args_kwargs.items() if not isinstance(key, int)}
34
+
35
+ return args, kwargs
36
+
37
+
38
+ class BoundDecorator:
39
+ """
40
+
41
+ Bound method decorator with overridable start/stop and context manager
42
+
43
+ """
44
+
45
+ def __init__(self, func):
46
+ self.func = func
47
+ self.context_null = context_tools.null()
48
+ functools.update_wrapper(self, func)
49
+
50
+ def get_context(self, instance):
51
+ """
52
+
53
+ By default use a null context.
54
+
55
+ """
56
+ return self.context_null
57
+
58
+ def __get__(self, instance, owner):
59
+ """
60
+
61
+ Wrap at runtime, call start/stop within context.
62
+
63
+ """
64
+ if instance is None:
65
+ return self.func
66
+
67
+ if inspect.iscoroutinefunction(self.func):
68
+ async def async_wrapper(*args, **kwargs):
69
+ with self.get_context(instance):
70
+ self.start(instance)
71
+ result = await self.func(instance, *args, **kwargs)
72
+ self.stop(instance)
73
+ return result
74
+
75
+ return functools.update_wrapper(async_wrapper, self.func)
76
+
77
+ else:
78
+ def sync_wrapper(*args, **kwargs):
79
+ with self.get_context(instance):
80
+ self.start(instance)
81
+ result = self.func(instance, *args, **kwargs)
82
+ self.stop(instance)
83
+ return result
84
+
85
+ return functools.update_wrapper(sync_wrapper, self.func)
86
+
87
+ def start(self, instance):
88
+ pass
89
+
90
+ def stop(self, instance):
91
+ pass
@@ -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)
@@ -0,0 +1,13 @@
1
+ import flet as ft
2
+
3
+ class SliderSteps(ft.Slider):
4
+ """
5
+
6
+ Slider control using step instead of divisions
7
+
8
+ """
9
+
10
+ def __init__(self, *args, min=10, max=100, step=10, **kwargs):
11
+ self.step = step
12
+ divisions = (max - min) // step
13
+ super().__init__(*args, min=min, max=max, divisions=divisions, **kwargs)
@@ -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 = '/'
@@ -0,0 +1 @@
1
+ 1.3.30
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmtr.tools
3
- Version: 1.3.28
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: regex; extra == "all"
130
- Requires-Dist: pandas; extra == "all"
131
- Requires-Dist: httpx; extra == "all"
132
- Requires-Dist: google-auth; extra == "all"
133
- Requires-Dist: torchvision; extra == "all"
134
- Requires-Dist: flet[all]; extra == "all"
135
- Requires-Dist: openpyxl; extra == "all"
136
- Requires-Dist: google-auth-oauthlib; extra == "all"
137
- Requires-Dist: cachetools; extra == "all"
129
+ Requires-Dist: sre_yield; extra == "all"
138
130
  Requires-Dist: filetype; extra == "all"
139
- Requires-Dist: setuptools; extra == "all"
140
- Requires-Dist: sentence_transformers; extra == "all"
141
- Requires-Dist: pydantic-settings; extra == "all"
142
- Requires-Dist: bokeh; extra == "all"
143
- Requires-Dist: peft; extra == "all"
144
- Requires-Dist: flet-webview; extra == "all"
145
- Requires-Dist: openai; extra == "all"
146
- Requires-Dist: torchaudio; extra == "all"
147
- Requires-Dist: google-api-python-client; extra == "all"
148
- Requires-Dist: deepmerge; extra == "all"
149
- Requires-Dist: diskcache; extra == "all"
150
131
  Requires-Dist: huggingface_hub; extra == "all"
151
- Requires-Dist: logfire[fastapi]; extra == "all"
152
- Requires-Dist: google-auth-httplib2; extra == "all"
153
- Requires-Dist: Unidecode; extra == "all"
154
- Requires-Dist: ollama; extra == "all"
155
- Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
156
- Requires-Dist: dnspython[doh]; extra == "all"
157
- Requires-Dist: flet-video; extra == "all"
158
- Requires-Dist: httpx_retries; extra == "all"
159
- Requires-Dist: json_repair; extra == "all"
160
- Requires-Dist: pymupdf4llm; extra == "all"
132
+ Requires-Dist: faker; extra == "all"
161
133
  Requires-Dist: pytest-cov; extra == "all"
162
- Requires-Dist: sre_yield; extra == "all"
134
+ Requires-Dist: logfire[fastapi]; extra == "all"
163
135
  Requires-Dist: contexttimer; extra == "all"
164
- Requires-Dist: semver; extra == "all"
165
- Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
166
- Requires-Dist: fastapi; extra == "all"
136
+ Requires-Dist: sentence_transformers; extra == "all"
137
+ Requires-Dist: httpx; extra == "all"
167
138
  Requires-Dist: tokenizers; extra == "all"
139
+ Requires-Dist: distributed; extra == "all"
140
+ Requires-Dist: peft; extra == "all"
141
+ Requires-Dist: transformers[sentencepiece]; extra == "all"
142
+ Requires-Dist: tinynetrc; extra == "all"
143
+ Requires-Dist: json_repair; extra == "all"
144
+ Requires-Dist: httpx_retries; extra == "all"
168
145
  Requires-Dist: logfire[httpx]; extra == "all"
146
+ Requires-Dist: fastapi; extra == "all"
169
147
  Requires-Dist: pymupdf; extra == "all"
170
- Requires-Dist: html2text; extra == "all"
148
+ Requires-Dist: bokeh; extra == "all"
149
+ Requires-Dist: semver; extra == "all"
150
+ Requires-Dist: google-api-python-client; extra == "all"
151
+ Requires-Dist: deepmerge; extra == "all"
152
+ Requires-Dist: flet-webview; extra == "all"
171
153
  Requires-Dist: pydantic; extra == "all"
154
+ Requires-Dist: html2text; extra == "all"
155
+ Requires-Dist: regex; extra == "all"
156
+ Requires-Dist: google-auth-oauthlib; extra == "all"
157
+ Requires-Dist: Unidecode; extra == "all"
158
+ Requires-Dist: pymupdf4llm; extra == "all"
172
159
  Requires-Dist: yamlscript; extra == "all"
173
- Requires-Dist: uvicorn[standard]; extra == "all"
174
- Requires-Dist: distributed; extra == "all"
175
- Requires-Dist: faker; extra == "all"
176
- Requires-Dist: docker; extra == "all"
177
160
  Requires-Dist: logfire; extra == "all"
161
+ Requires-Dist: docker; extra == "all"
162
+ Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
163
+ Requires-Dist: openpyxl; extra == "all"
164
+ Requires-Dist: torchaudio; extra == "all"
165
+ Requires-Dist: pandas; extra == "all"
166
+ Requires-Dist: google-auth; extra == "all"
167
+ Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
168
+ Requires-Dist: diskcache; extra == "all"
169
+ Requires-Dist: flet[all]; extra == "all"
170
+ Requires-Dist: ollama; extra == "all"
178
171
  Requires-Dist: appdirs; extra == "all"
179
- Requires-Dist: pyyaml; extra == "all"
172
+ Requires-Dist: google-auth-httplib2; extra == "all"
173
+ Requires-Dist: flet-video; extra == "all"
174
+ Requires-Dist: openai; extra == "all"
180
175
  Requires-Dist: dask[bag]; extra == "all"
181
- Requires-Dist: transformers[sentencepiece]; extra == "all"
176
+ Requires-Dist: torchvision; extra == "all"
177
+ Requires-Dist: setuptools; extra == "all"
178
+ Requires-Dist: cachetools; extra == "all"
179
+ Requires-Dist: pyyaml; extra == "all"
180
+ Requires-Dist: pydantic-settings; extra == "all"
181
+ Requires-Dist: uvicorn[standard]; extra == "all"
182
182
  Requires-Dist: tabulate; extra == "all"
183
- Requires-Dist: tinynetrc; extra == "all"
183
+ Requires-Dist: dnspython[doh]; extra == "all"
184
184
  Dynamic: author
185
185
  Dynamic: author-email
186
186
  Dynamic: description
@@ -8,6 +8,7 @@ setup.py
8
8
  ./fmtr/tools/augmentation_tools.py
9
9
  ./fmtr/tools/caching_tools.py
10
10
  ./fmtr/tools/constants.py
11
+ ./fmtr/tools/context_tools.py
11
12
  ./fmtr/tools/data_modelling_tools.py
12
13
  ./fmtr/tools/dataclass_tools.py
13
14
  ./fmtr/tools/datatype_tools.py
@@ -95,6 +96,7 @@ fmtr/tools/async_tools.py
95
96
  fmtr/tools/augmentation_tools.py
96
97
  fmtr/tools/caching_tools.py
97
98
  fmtr/tools/constants.py
99
+ fmtr/tools/context_tools.py
98
100
  fmtr/tools/data_modelling_tools.py
99
101
  fmtr/tools/dataclass_tools.py
100
102
  fmtr/tools/datatype_tools.py
@@ -1,33 +0,0 @@
1
- from typing import Tuple
2
-
3
-
4
- def combine_args_kwargs(args: dict=None, kwargs: dict=None) -> dict:
5
- """
6
-
7
- Combines arguments and keyword arguments into a single dictionary.
8
-
9
- """
10
- args = args or []
11
- kwargs = kwargs or {}
12
- args = {i: arg for i, arg in enumerate(args)}
13
- args.update(kwargs)
14
- if all(isinstance(key, int) for key in args.keys()):
15
- args = list(args.values())
16
- return args
17
-
18
-
19
- def split_args_kwargs(args_kwargs: dict) -> Tuple[list, dict]:
20
- """
21
-
22
- Splits arguments and keyword arguments into a list and a dictionary.
23
-
24
- """
25
- if isinstance(args_kwargs, list):
26
- args, kwargs = args_kwargs, {}
27
- else:
28
- args = [arg for key, arg in args_kwargs.items() if isinstance(key, int)]
29
- kwargs = {key: arg for key, arg in args_kwargs.items() if not isinstance(key, int)}
30
-
31
- return args, kwargs
32
-
33
-
@@ -1,137 +0,0 @@
1
- import inspect
2
-
3
- import flet as ft
4
-
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
- class SliderSteps(ft.Slider):
128
- """
129
-
130
- Slider control using step instead of divisions
131
-
132
- """
133
-
134
- def __init__(self, *args, min=10, max=100, step=10, **kwargs):
135
- self.step = step
136
- divisions = (max - min) // step
137
- super().__init__(*args, min=min, max=max, divisions=divisions, **kwargs)
@@ -1 +0,0 @@
1
- 1.3.28
File without changes
File without changes
@@ -14,61 +14,61 @@ pydantic-ai[logfire,openai]
14
14
  ollama
15
15
 
16
16
  [all]
17
- regex
18
- pandas
19
- httpx
20
- google-auth
21
- torchvision
22
- flet[all]
23
- openpyxl
24
- google-auth-oauthlib
25
- cachetools
17
+ sre_yield
26
18
  filetype
27
- setuptools
28
- sentence_transformers
29
- pydantic-settings
30
- bokeh
31
- peft
32
- flet-webview
33
- openai
34
- torchaudio
35
- google-api-python-client
36
- deepmerge
37
- diskcache
38
19
  huggingface_hub
39
- logfire[fastapi]
40
- google-auth-httplib2
41
- Unidecode
42
- ollama
43
- pydevd-pycharm~=251.25410.159
44
- dnspython[doh]
45
- flet-video
46
- httpx_retries
47
- json_repair
48
- pymupdf4llm
20
+ faker
49
21
  pytest-cov
50
- sre_yield
22
+ logfire[fastapi]
51
23
  contexttimer
52
- semver
53
- pydantic-ai[logfire,openai]
54
- fastapi
24
+ sentence_transformers
25
+ httpx
55
26
  tokenizers
27
+ distributed
28
+ peft
29
+ transformers[sentencepiece]
30
+ tinynetrc
31
+ json_repair
32
+ httpx_retries
56
33
  logfire[httpx]
34
+ fastapi
57
35
  pymupdf
58
- html2text
36
+ bokeh
37
+ semver
38
+ google-api-python-client
39
+ deepmerge
40
+ flet-webview
59
41
  pydantic
42
+ html2text
43
+ regex
44
+ google-auth-oauthlib
45
+ Unidecode
46
+ pymupdf4llm
60
47
  yamlscript
61
- uvicorn[standard]
62
- distributed
63
- faker
64
- docker
65
48
  logfire
49
+ docker
50
+ pydantic-ai[logfire,openai]
51
+ openpyxl
52
+ torchaudio
53
+ pandas
54
+ google-auth
55
+ pydevd-pycharm~=251.25410.159
56
+ diskcache
57
+ flet[all]
58
+ ollama
66
59
  appdirs
67
- pyyaml
60
+ google-auth-httplib2
61
+ flet-video
62
+ openai
68
63
  dask[bag]
69
- transformers[sentencepiece]
64
+ torchvision
65
+ setuptools
66
+ cachetools
67
+ pyyaml
68
+ pydantic-settings
69
+ uvicorn[standard]
70
70
  tabulate
71
- tinynetrc
71
+ dnspython[doh]
72
72
 
73
73
  [api]
74
74
  fastapi
File without changes
File without changes
File without changes