fmtr.tools 1.1.21__py3-none-any.whl → 1.1.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/__init__.py CHANGED
@@ -23,9 +23,16 @@ import fmtr.tools.packaging_tools as packaging
23
23
  from fmtr.tools.logging_tools import logger
24
24
 
25
25
  from fmtr.tools.import_tools import MissingExtraMockModule
26
- from fmtr.tools.path_tools import Path, PackagePaths, AppPaths
26
+
27
27
  from fmtr.tools.constants import Constants
28
28
 
29
+ # Submodules
30
+ from fmtr.tools.path_tools import Path, PackagePaths, AppPaths
31
+ from fmtr.tools import ai_tools as ai
32
+
33
+ import fmtr.tools.setup_tools as setup
34
+ from fmtr.tools.setup_tools import Setup, SetupPaths, Dependencies
35
+
29
36
  try:
30
37
  from fmtr.tools import augmentation_tools as augmentation
31
38
  except ImportError as exception:
@@ -95,11 +102,6 @@ try:
95
102
  except ImportError as exception:
96
103
  api = MissingExtraMockModule('api', exception)
97
104
 
98
- try:
99
- from fmtr.tools import ai_tools as ai
100
- except ImportError as exception:
101
- ai = MissingExtraMockModule('ai', exception)
102
-
103
105
  try:
104
106
  from fmtr.tools import data_modelling_tools as dm
105
107
  except ImportError as exception:
@@ -174,9 +176,3 @@ try:
174
176
  from fmtr.tools import dns_tools as dns
175
177
  except ImportError as exception:
176
178
  dns = MissingExtraMockModule('dns', exception)
177
-
178
- try:
179
- from fmtr.tools import setup_tools as setup
180
- from fmtr.tools.setup_tools import Setup, SetupPaths, Dependencies
181
- except ImportError as exception:
182
- setup = Setup = SetupPaths = Dependencies = MissingExtraMockModule('setup', exception)
@@ -0,0 +1,8 @@
1
+ from fmtr.tools.import_tools import MissingExtraMockModule
2
+
3
+ from fmtr.tools.setup_tools.setup_tools import Setup, SetupPaths, Dependencies
4
+
5
+ try:
6
+ from setuptools import find_namespace_packages, find_packages, setup as setup_setuptools
7
+ except ImportError as exception:
8
+ find_namespace_packages = find_packages = setup_setuptools = MissingExtraMockModule('setup', exception)
@@ -1,11 +1,10 @@
1
+ import sys
1
2
  from datetime import datetime
2
3
  from fnmatch import fnmatch
3
4
  from functools import cached_property
4
5
  from itertools import chain
5
6
  from typing import List, Dict
6
7
 
7
- from setuptools import find_namespace_packages, find_packages, setup
8
-
9
8
  from fmtr.tools.constants import Constants
10
9
  from fmtr.tools.path_tools import Path
11
10
  from fmtr.tools.path_tools.path_tools import FromCallerMixin
@@ -14,7 +13,7 @@ from fmtr.tools.path_tools.path_tools import FromCallerMixin
14
13
  class SetupPaths(FromCallerMixin):
15
14
  """
16
15
 
17
- Canonical paths for a package.
16
+ Canonical paths for a repo.
18
17
 
19
18
  """
20
19
 
@@ -89,6 +88,9 @@ class Setup(FromCallerMixin):
89
88
  AUTHOR = 'Frontmatter'
90
89
  AUTHOR_EMAIL = 'innovative.fowler@mask.pro.fmtr.dev'
91
90
 
91
+ REQUIREMENTS_ARG = 'requirements'
92
+
93
+
92
94
  def __init__(self, dependencies, paths=None, console_scripts=None, client=None, do_setup=True, **kwargs):
93
95
 
94
96
  self.kwargs = kwargs
@@ -97,6 +99,12 @@ class Setup(FromCallerMixin):
97
99
  dependencies = Dependencies(**dependencies)
98
100
  self.dependencies = dependencies
99
101
 
102
+ requirements_extras = self.get_requirements_extras()
103
+
104
+ if requirements_extras:
105
+ self.print_requirements()
106
+ return
107
+
100
108
  if not paths:
101
109
  paths = SetupPaths(path=self.from_caller())
102
110
  self.paths = paths
@@ -107,6 +115,25 @@ class Setup(FromCallerMixin):
107
115
  if do_setup:
108
116
  self.setup()
109
117
 
118
+ def get_requirements_extras(self):
119
+ if self.REQUIREMENTS_ARG not in sys.argv:
120
+ return None
121
+
122
+ extras_str = sys.argv[-1]
123
+ extras = extras_str.split(',')
124
+ return extras
125
+
126
+ def print_requirements(self):
127
+ reqs = []
128
+ reqs += self.dependencies.install
129
+
130
+ for extra in sys.argv[-1].split(','):
131
+ reqs += self.dependencies.extras[extra]
132
+ reqs = '\n'.join(reqs)
133
+ print(reqs)
134
+
135
+
136
+
110
137
  def get_entrypoint_path(self, key, value):
111
138
  if value:
112
139
  return f'{self.name}.{value}:{key}'
@@ -150,14 +177,22 @@ class Setup(FromCallerMixin):
150
177
  return self.paths.version.read_text().strip()
151
178
 
152
179
  @property
153
- def packages(self):
180
+ def find(self):
154
181
 
155
- excludes = list(SetupPaths.SKIP_DIRS) + [f'{name}.*' for name in SetupPaths.SKIP_DIRS]
182
+ from fmtr.tools import setup
156
183
 
157
184
  if self.paths.is_namespace:
158
- return find_namespace_packages(where=str(self.paths.repo), exclude=excludes)
185
+ return setup.find_namespace_packages
159
186
  else:
160
- return find_packages(where=str(self.paths.repo), exclude=excludes)
187
+ return setup.find_packages
188
+
189
+ @property
190
+ def packages(self):
191
+
192
+ excludes = list(SetupPaths.SKIP_DIRS) + [f'{name}.*' for name in SetupPaths.SKIP_DIRS]
193
+
194
+ packages = self.find(where=str(self.paths.repo), exclude=excludes)
195
+ return packages
161
196
 
162
197
  @property
163
198
  def package_dir(self):
@@ -195,7 +230,9 @@ class Setup(FromCallerMixin):
195
230
 
196
231
  def setup(self):
197
232
 
198
- return setup(**self.data)
233
+ from fmtr.tools import setup
234
+
235
+ return setup.setup_setuptools(**self.data)
199
236
 
200
237
 
201
238
 
@@ -226,7 +263,7 @@ class Dependencies:
226
263
 
227
264
  return values_resolved
228
265
 
229
- @property
266
+ @cached_property
230
267
  def extras(self) -> Dict[str, List[str]]:
231
268
  """
232
269
 
@@ -238,7 +275,7 @@ class Dependencies:
238
275
  resolved[self.ALL] = list(set(chain.from_iterable(resolved.values())))
239
276
  return resolved
240
277
 
241
- @property
278
+ @cached_property
242
279
  def install(self):
243
280
  return self.resolve_values(self.INSTALL)
244
281
 
fmtr/tools/version CHANGED
@@ -1 +1 @@
1
- 1.1.21
1
+ 1.1.23
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmtr.tools
3
- Version: 1.1.21
3
+ Version: 1.1.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
@@ -9,60 +9,60 @@ License: Copyright © 2025 Frontmatter. All rights reserved.
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
11
  Provides-Extra: test
12
- Requires-Dist: tinynetrc; extra == "test"
12
+ Requires-Dist: pytest-cov; extra == "test"
13
+ Requires-Dist: yamlscript; extra == "test"
14
+ Requires-Dist: pandas; extra == "test"
15
+ Requires-Dist: regex; extra == "test"
16
+ Requires-Dist: docker; extra == "test"
17
+ Requires-Dist: json_repair; extra == "test"
18
+ Requires-Dist: uvicorn[standard]; extra == "test"
19
+ Requires-Dist: pymupdf; extra == "test"
20
+ Requires-Dist: logfire[fastapi]; extra == "test"
21
+ Requires-Dist: logfire[httpx]; extra == "test"
22
+ Requires-Dist: pymupdf4llm; extra == "test"
23
+ Requires-Dist: sentence_transformers; extra == "test"
24
+ Requires-Dist: dnspython[doh]; extra == "test"
13
25
  Requires-Dist: fastapi; extra == "test"
26
+ Requires-Dist: torchvision; extra == "test"
14
27
  Requires-Dist: httpx_retries; extra == "test"
15
- Requires-Dist: setuptools; extra == "test"
16
- Requires-Dist: filetype; extra == "test"
17
- Requires-Dist: faker; extra == "test"
18
- Requires-Dist: pydevd-pycharm; extra == "test"
19
- Requires-Dist: pyyaml; extra == "test"
20
- Requires-Dist: logfire[fastapi]; extra == "test"
21
- Requires-Dist: google-auth-httplib2; extra == "test"
22
- Requires-Dist: openai; extra == "test"
28
+ Requires-Dist: flet[all]; extra == "test"
29
+ Requires-Dist: pydantic-settings; extra == "test"
30
+ Requires-Dist: ollama; extra == "test"
23
31
  Requires-Dist: diskcache; extra == "test"
24
- Requires-Dist: bokeh; extra == "test"
25
- Requires-Dist: sentence_transformers; extra == "test"
26
- Requires-Dist: pymupdf4llm; extra == "test"
27
- Requires-Dist: distributed; extra == "test"
28
- Requires-Dist: huggingface_hub; extra == "test"
29
- Requires-Dist: deepmerge; extra == "test"
30
- Requires-Dist: transformers[sentencepiece]; extra == "test"
31
- Requires-Dist: google-auth-oauthlib; extra == "test"
32
- Requires-Dist: logfire[httpx]; extra == "test"
32
+ Requires-Dist: torchaudio; extra == "test"
33
+ Requires-Dist: pydantic-ai[logfire,openai]; extra == "test"
34
+ Requires-Dist: faker; extra == "test"
33
35
  Requires-Dist: pydantic; extra == "test"
36
+ Requires-Dist: distributed; extra == "test"
34
37
  Requires-Dist: dask[bag]; extra == "test"
35
- Requires-Dist: Unidecode; extra == "test"
36
- Requires-Dist: docker; extra == "test"
37
- Requires-Dist: google-auth; extra == "test"
38
+ Requires-Dist: sre_yield; extra == "test"
39
+ Requires-Dist: tabulate; extra == "test"
40
+ Requires-Dist: html2text; extra == "test"
41
+ Requires-Dist: tinynetrc; extra == "test"
42
+ Requires-Dist: setuptools; extra == "test"
43
+ Requires-Dist: pyyaml; extra == "test"
44
+ Requires-Dist: openpyxl; extra == "test"
45
+ Requires-Dist: flet-video; extra == "test"
46
+ Requires-Dist: openai; extra == "test"
47
+ Requires-Dist: flet-webview; extra == "test"
48
+ Requires-Dist: pydevd-pycharm; extra == "test"
38
49
  Requires-Dist: contexttimer; extra == "test"
39
- Requires-Dist: peft; extra == "test"
50
+ Requires-Dist: google-auth; extra == "test"
40
51
  Requires-Dist: semver; extra == "test"
41
- Requires-Dist: regex; extra == "test"
52
+ Requires-Dist: huggingface_hub; extra == "test"
53
+ Requires-Dist: tokenizers; extra == "test"
54
+ Requires-Dist: peft; extra == "test"
42
55
  Requires-Dist: logfire; extra == "test"
43
- Requires-Dist: pytest-cov; extra == "test"
44
- Requires-Dist: yamlscript; extra == "test"
45
- Requires-Dist: pandas; extra == "test"
46
- Requires-Dist: ollama; extra == "test"
47
- Requires-Dist: openpyxl; extra == "test"
48
- Requires-Dist: appdirs; extra == "test"
49
- Requires-Dist: html2text; extra == "test"
50
- Requires-Dist: flet-video; extra == "test"
51
- Requires-Dist: flet[all]; extra == "test"
56
+ Requires-Dist: google-auth-oauthlib; extra == "test"
57
+ Requires-Dist: filetype; extra == "test"
58
+ Requires-Dist: deepmerge; extra == "test"
52
59
  Requires-Dist: google-api-python-client; extra == "test"
53
- Requires-Dist: dnspython[doh]; extra == "test"
54
- Requires-Dist: pymupdf; extra == "test"
55
- Requires-Dist: sre_yield; extra == "test"
56
- Requires-Dist: pydantic-settings; extra == "test"
57
- Requires-Dist: tabulate; extra == "test"
58
- Requires-Dist: flet-webview; extra == "test"
60
+ Requires-Dist: bokeh; extra == "test"
59
61
  Requires-Dist: httpx; extra == "test"
60
- Requires-Dist: tokenizers; extra == "test"
61
- Requires-Dist: torchvision; extra == "test"
62
- Requires-Dist: json_repair; extra == "test"
63
- Requires-Dist: pydantic-ai[logfire,openai]; extra == "test"
64
- Requires-Dist: torchaudio; extra == "test"
65
- Requires-Dist: uvicorn[standard]; extra == "test"
62
+ Requires-Dist: google-auth-httplib2; extra == "test"
63
+ Requires-Dist: appdirs; extra == "test"
64
+ Requires-Dist: Unidecode; extra == "test"
65
+ Requires-Dist: transformers[sentencepiece]; extra == "test"
66
66
  Provides-Extra: yaml
67
67
  Requires-Dist: yamlscript; extra == "yaml"
68
68
  Requires-Dist: pyyaml; extra == "yaml"
@@ -1,4 +1,4 @@
1
- fmtr/tools/__init__.py,sha256=v4XtEHm35sT7Z7-kKdFdBPXw_yFtxF0GOCx4q4y5Qg4,5790
1
+ fmtr/tools/__init__.py,sha256=PeQKmb9q7xTaiDGy7TUa_5V2lh8k0rV0BJgjwf37udI,5571
2
2
  fmtr/tools/api_tools.py,sha256=w8Zrp_EwN5KlUghwLoTCXo4z1irg5tAsReCqDLjASfE,2133
3
3
  fmtr/tools/async_tools.py,sha256=ewz757WcveQJd-G5SVr2JDOQVbdLGecCgl-tsBGVZz4,284
4
4
  fmtr/tools/augmentation_tools.py,sha256=-6ESbO4CDlKqVOV1J1V6qBeoBMzbFIinkDHRHnCBej0,55
@@ -39,14 +39,13 @@ fmtr/tools/profiling_tools.py,sha256=jpXVjaNKPydTasEQVNXvxzGtMhXPit08AnJddkU8uIc
39
39
  fmtr/tools/random_tools.py,sha256=4VlQdk5THbR8ka4pZaLbk_ZO_4yy6PF_lHZes_rgenY,2223
40
40
  fmtr/tools/semantic_tools.py,sha256=cxY9NSAHWj4nEc6Oj4qA1omR3dWbl2OuH7_PkINc6_E,1386
41
41
  fmtr/tools/settings_tools.py,sha256=o11W3T60UZSvCTkh_eEQq1Mx74GycQ6JxUr0plBDbsk,2356
42
- fmtr/tools/setup_tools.py,sha256=uaT8Ejc2yBLATTHR_51vGIoU8yDOBgXLmFnxY5c23V4,7041
43
42
  fmtr/tools/spaces_tools.py,sha256=D_he3mve6DruB3OPS6QyzqD05ChHnRTb4buViKPe7To,1099
44
43
  fmtr/tools/string_tools.py,sha256=mjO7NSqhtYMtnX7fKb8eXZ7MO2lXWGMl0kXxnZznupM,3764
45
44
  fmtr/tools/tabular_tools.py,sha256=tpIpZzYku1HcJrHZJL6BC39LmN3WUWVhFbK2N7nDVmE,120
46
45
  fmtr/tools/tokenization_tools.py,sha256=me-IBzSLyNYejLybwjO9CNB6Mj2NYfKPaOVThXyaGNg,4268
47
46
  fmtr/tools/tools.py,sha256=CAsApa1YwVdNE6H66Vjivs_mXYvOas3rh7fPELAnTpk,795
48
47
  fmtr/tools/unicode_tools.py,sha256=yS_9wpu8ogNoiIL7s1G_8bETFFO_YQlo4LNPv1NLDeY,52
49
- fmtr/tools/version,sha256=Q9bVQ4J5J33dityoULiym-dEvZSY9uBJ10Hd83OP8yY,6
48
+ fmtr/tools/version,sha256=3LplPseqc2k-fqP6873j8m5kUAOUMVJ7Cpo-3h23Q3s,6
50
49
  fmtr/tools/version_tools.py,sha256=yNs_CGqWpqE4jbK9wsPIi14peJVXYbhIcMqHAFOw3yE,1480
51
50
  fmtr/tools/yaml_tools.py,sha256=9kuYChqJelWQIjGlSnK4iDdOWWH06P0gp9jIcRrC3UI,1903
52
51
  fmtr/tools/ai_tools/__init__.py,sha256=JZrLuOFNV1A3wvJgonxOgz_4WS-7MfCuowGWA5uYCjs,372
@@ -56,6 +55,8 @@ fmtr/tools/path_tools/__init__.py,sha256=v5CpmzXq5Ii90FtcmxAJKiLxmguZMrPnQ_HdT87
56
55
  fmtr/tools/path_tools/app_path_tools.py,sha256=JrJvtTDd_gkCKcZtBCDTMktsM77PZwGV_hzQX0g5GU8,1722
57
56
  fmtr/tools/path_tools/path_tools.py,sha256=8WBzNctpds5tVT1-FcizAORrBCGlkUbPcfOel-Js7ps,7878
58
57
  fmtr/tools/path_tools/type_path_tools.py,sha256=Zgs-ek-GXRKDIlVDGdg3muB0PIxTg2ba0NeHw6y8FWQ,40
58
+ fmtr/tools/setup_tools/__init__.py,sha256=8HX-GvGxeCK3nIHH5PHkvhkH0MIt89AK8a5l6Vua2dQ,379
59
+ fmtr/tools/setup_tools/setup_tools.py,sha256=1pbpQ70PeGfgkWpKQx1rQ8GoIYCArzw22uyuCT93Qas,7790
59
60
  fmtr/tools/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
61
  fmtr/tools/tests/conftest.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
62
  fmtr/tools/tests/helpers.py,sha256=N5sf9YoZV93a7tf_UxpLeyQ9vp6Ec0teNIimFDvc054,1091
@@ -64,9 +65,9 @@ fmtr/tools/tests/test_environment.py,sha256=iHaiMQfECYZPkPKwfuIZV9uHuWe3aE-p_dN_
64
65
  fmtr/tools/tests/test_json.py,sha256=IeSP4ziPvRcmS8kq7k9tHonC9rN5YYq9GSNT2ul6Msk,287
65
66
  fmtr/tools/tests/test_path.py,sha256=AkZQa6_8BQ-VaCyL_J-iKmdf2ZaM-xFYR37Kun3k4_g,2188
66
67
  fmtr/tools/tests/test_yaml.py,sha256=jc0TwwKu9eC0LvFGNMERdgBue591xwLxYXFbtsRwXVM,287
67
- fmtr_tools-1.1.21.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
68
- fmtr_tools-1.1.21.dist-info/METADATA,sha256=-dnzZwvyXt4n6SBqztBZt1MAO_qWBXrbBvU6EMxUZ3s,15735
69
- fmtr_tools-1.1.21.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
70
- fmtr_tools-1.1.21.dist-info/entry_points.txt,sha256=e-eOW1Ml13tbxHC6Er1MnVOEDePeWw7DKwlE-l-gCY0,205
71
- fmtr_tools-1.1.21.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
72
- fmtr_tools-1.1.21.dist-info/RECORD,,
68
+ fmtr_tools-1.1.23.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
69
+ fmtr_tools-1.1.23.dist-info/METADATA,sha256=ywC-2AZET6ohT0uWvxuHEAZ9IgcEiNjkUB7DDKHiCL4,15735
70
+ fmtr_tools-1.1.23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
71
+ fmtr_tools-1.1.23.dist-info/entry_points.txt,sha256=e-eOW1Ml13tbxHC6Er1MnVOEDePeWw7DKwlE-l-gCY0,205
72
+ fmtr_tools-1.1.23.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
73
+ fmtr_tools-1.1.23.dist-info/RECORD,,