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

@@ -266,6 +266,7 @@ class BulkInferenceManager:
266
266
  yield ids_output
267
267
 
268
268
  except RuntimeError as exception:
269
+ # Instability causes CUBLAS_STATUS in str(exception) too
269
270
  if "CUDA out of memory" in str(exception):
270
271
  logger.warning(f"Ran out of memory. Reducing batch size: {repr(exception)}")
271
272
  batcher.reduce()
@@ -412,5 +413,5 @@ def tst_tool():
412
413
 
413
414
 
414
415
  if __name__ == '__main__':
415
- texts = tst_tool()
416
+ texts = tst()
416
417
  texts
@@ -43,16 +43,23 @@ def get_logger(name, version=None, host=Constants.FMTR_OBS_HOST, key=None, org=C
43
43
  from fmtr.tools import version_tools
44
44
  version = version_tools.read()
45
45
 
46
+ # Rigmarole to translate native levels to logfire/otel ones.
47
+ lev_num_otel = logfire._internal.constants.LOGGING_TO_OTEL_LEVEL_NUMBERS[level]
48
+ lev_name_otel = logfire._internal.constants.NUMBER_TO_LEVEL[lev_num_otel]
49
+
50
+ console_opts = logfire.ConsoleOptions(
51
+ colors='always' if environment_tools.IS_DEBUG else 'auto',
52
+ min_log_level=lev_name_otel,
53
+ )
54
+
46
55
  logfire.configure(
47
56
  service_name=name,
48
57
  service_version=version,
49
58
  environment=environment,
50
59
  send_to_logfire=False,
51
- console=logfire.ConsoleOptions(colors='always' if environment_tools.IS_DEBUG else 'auto')
60
+ console=console_opts
52
61
  )
53
62
 
54
- logging.getLogger(name).setLevel(level)
55
-
56
63
  logger = logfire
57
64
  return logger
58
65
 
@@ -63,3 +70,4 @@ if __name__ == '__main__':
63
70
  logger.info('Hello World')
64
71
  logger.warning('test warning')
65
72
  logger.debug('Hello World')
73
+ logger
@@ -1,7 +1,12 @@
1
1
  from fmtr.tools.import_tools import MissingExtraMockModule
2
- from fmtr.tools.path_tools.base import Path, PackagePaths
2
+ from fmtr.tools.path_tools.path_tools import Path, PackagePaths
3
3
 
4
4
  try:
5
- from fmtr.tools.path_tools.app import AppPaths
5
+ from fmtr.tools.path_tools.app_path_tools import AppPaths
6
6
  except ImportError as exception:
7
7
  AppPaths = MissingExtraMockModule('path.app', exception)
8
+
9
+ try:
10
+ from fmtr.tools.path_tools.type_path_tools import guess
11
+ except ImportError as exception:
12
+ guess = MissingExtraMockModule('path.type', exception)
@@ -164,6 +164,19 @@ class Path(type(Path())):
164
164
  from fmtr.tools import path
165
165
  return path.AppPaths()
166
166
 
167
+ @property
168
+ def type(self):
169
+ """
170
+
171
+ Infer file type, extension, etc.
172
+
173
+ """
174
+ if not self.exists():
175
+ return None
176
+ from fmtr.tools import path
177
+ kind = path.guess(str(self.absolute()))
178
+ return kind
179
+
167
180
  class PackagePaths:
168
181
  """
169
182
 
@@ -324,6 +337,6 @@ class PackagePaths:
324
337
 
325
338
 
326
339
  if __name__ == "__main__":
327
- path = Path()
328
- path.app.user_log_dir()
329
- path
340
+ path = Path('/usr/bin/bash').absolute()
341
+ path.type
342
+ path
@@ -0,0 +1,3 @@
1
+ import filetype
2
+
3
+ guess = filetype.guess
fmtr/tools/version CHANGED
@@ -1 +1 @@
1
- 1.1.14
1
+ 1.1.16
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmtr.tools
3
- Version: 1.1.14
3
+ Version: 1.1.16
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,52 +9,53 @@ 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: json_repair; extra == "test"
13
- Requires-Dist: deepmerge; extra == "test"
14
- Requires-Dist: contexttimer; extra == "test"
15
- Requires-Dist: google-api-python-client; extra == "test"
16
- Requires-Dist: docker; extra == "test"
17
- Requires-Dist: pydantic; extra == "test"
18
- Requires-Dist: logfire; extra == "test"
19
- Requires-Dist: pyyaml; extra == "test"
20
- Requires-Dist: pydevd-pycharm; extra == "test"
21
- Requires-Dist: appdirs; extra == "test"
22
- Requires-Dist: dask[bag]; extra == "test"
23
- Requires-Dist: pymupdf4llm; extra == "test"
24
- Requires-Dist: pytest-cov; extra == "test"
25
- Requires-Dist: flet[all]; extra == "test"
26
- Requires-Dist: html2text; extra == "test"
27
12
  Requires-Dist: distributed; extra == "test"
28
- Requires-Dist: ollama; extra == "test"
29
- Requires-Dist: google-auth-oauthlib; extra == "test"
30
- Requires-Dist: pandas; extra == "test"
31
- Requires-Dist: tabulate; extra == "test"
32
- Requires-Dist: google-auth; extra == "test"
33
- Requires-Dist: sre_yield; extra == "test"
34
13
  Requires-Dist: uvicorn[standard]; extra == "test"
14
+ Requires-Dist: google-auth; extra == "test"
35
15
  Requires-Dist: tokenizers; extra == "test"
36
16
  Requires-Dist: torchaudio; extra == "test"
37
- Requires-Dist: fastapi; extra == "test"
17
+ Requires-Dist: pymupdf; extra == "test"
18
+ Requires-Dist: appdirs; extra == "test"
19
+ Requires-Dist: huggingface_hub; extra == "test"
20
+ Requires-Dist: tabulate; extra == "test"
21
+ Requires-Dist: pydantic; extra == "test"
22
+ Requires-Dist: html2text; extra == "test"
23
+ Requires-Dist: docker; extra == "test"
24
+ Requires-Dist: logfire[fastapi]; extra == "test"
25
+ Requires-Dist: filetype; extra == "test"
26
+ Requires-Dist: Unidecode; extra == "test"
38
27
  Requires-Dist: sentence_transformers; extra == "test"
39
- Requires-Dist: torchvision; extra == "test"
28
+ Requires-Dist: fastapi; extra == "test"
29
+ Requires-Dist: flet-webview; extra == "test"
30
+ Requires-Dist: pydantic-settings; extra == "test"
31
+ Requires-Dist: contexttimer; extra == "test"
40
32
  Requires-Dist: diskcache; extra == "test"
41
- Requires-Dist: peft; extra == "test"
33
+ Requires-Dist: ollama; extra == "test"
34
+ Requires-Dist: logfire; extra == "test"
42
35
  Requires-Dist: openai; extra == "test"
43
- Requires-Dist: bokeh; extra == "test"
36
+ Requires-Dist: pydevd-pycharm; extra == "test"
37
+ Requires-Dist: pandas; extra == "test"
44
38
  Requires-Dist: flet-video; extra == "test"
45
- Requires-Dist: google-auth-httplib2; extra == "test"
46
- Requires-Dist: tinynetrc; extra == "test"
47
- Requires-Dist: semver; extra == "test"
48
39
  Requires-Dist: yamlscript; extra == "test"
49
- Requires-Dist: pymupdf; extra == "test"
50
- Requires-Dist: logfire[fastapi]; extra == "test"
51
- Requires-Dist: huggingface_hub; extra == "test"
52
- Requires-Dist: pydantic-settings; extra == "test"
53
- Requires-Dist: openpyxl; extra == "test"
54
- Requires-Dist: Unidecode; extra == "test"
40
+ Requires-Dist: sre_yield; extra == "test"
41
+ Requires-Dist: google-auth-httplib2; extra == "test"
42
+ Requires-Dist: google-api-python-client; extra == "test"
43
+ Requires-Dist: dask[bag]; extra == "test"
55
44
  Requires-Dist: pydantic-ai[logfire,openai]; extra == "test"
45
+ Requires-Dist: torchvision; extra == "test"
46
+ Requires-Dist: openpyxl; extra == "test"
47
+ Requires-Dist: flet[all]; extra == "test"
48
+ Requires-Dist: bokeh; extra == "test"
49
+ Requires-Dist: pyyaml; extra == "test"
50
+ Requires-Dist: json_repair; extra == "test"
51
+ Requires-Dist: pymupdf4llm; extra == "test"
52
+ Requires-Dist: peft; extra == "test"
53
+ Requires-Dist: deepmerge; extra == "test"
54
+ Requires-Dist: pytest-cov; extra == "test"
56
55
  Requires-Dist: faker; extra == "test"
57
- Requires-Dist: flet-webview; extra == "test"
56
+ Requires-Dist: tinynetrc; extra == "test"
57
+ Requires-Dist: google-auth-oauthlib; extra == "test"
58
+ Requires-Dist: semver; extra == "test"
58
59
  Requires-Dist: transformers[sentencepiece]; extra == "test"
59
60
  Provides-Extra: yaml
60
61
  Requires-Dist: yamlscript; extra == "yaml"
@@ -154,6 +155,8 @@ Requires-Dist: pydantic-settings; extra == "sets"
154
155
  Requires-Dist: pydantic; extra == "sets"
155
156
  Provides-Extra: path-app
156
157
  Requires-Dist: appdirs; extra == "path-app"
158
+ Provides-Extra: path-type
159
+ Requires-Dist: filetype; extra == "path-type"
157
160
  Dynamic: author
158
161
  Dynamic: author-email
159
162
  Dynamic: description
@@ -288,9 +291,10 @@ The included modules, plus any extra requirements, are as follows:
288
291
  - `tools.Path`: Enhanced
289
292
  `pathlib.Path` object with additional functionality for Windows-to-Unix path conversion in WSL environments, reading/writing JSON and YAML files with proper encoding.
290
293
  - Extras: None
294
+ -
291
295
  `tools.PackagePaths` class for managing canonical package paths, like settings files, artifact directories, version files.
292
296
  - Extras: None
293
- `tools.AppPaths` Wrapper around `appdirs` for application paths.
297
+ - `tools.AppPaths` Wrapper around `appdirs` for application paths.
294
298
  - Extras: `paths.app`
295
299
  - `tools.platform`: Detecting if host is WSL, Docker etc.
296
300
  - Extras: None
@@ -22,7 +22,7 @@ fmtr/tools/interface_tools.py,sha256=JVYUV7wuMr24BORuUtNaBlTeBFt8VDGJ3HPRajd7Y_4
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
25
- fmtr/tools/logging_tools.py,sha256=EnpiUJh0tOgbR-45aI_EtZsqNW8XFfGwp1_1ULOcZ00,1875
25
+ fmtr/tools/logging_tools.py,sha256=s1c2I1aBMCNqsoGzmizj_ObwTMsH-JKKqDsxbdsntH0,2154
26
26
  fmtr/tools/merging_tools.py,sha256=KDxCEFJEQJEwGw1qGKAgR55uUE2X2S5NWLKcfHRmX_k,227
27
27
  fmtr/tools/metric_tools.py,sha256=Lvia5CGFRIfrDFA8s37btIfTU5zHbo04cPJdAMtbndQ,272
28
28
  fmtr/tools/name_tools.py,sha256=5CB_phqhHjl66iI8oLxOGPF2odC1apdul-M8Fv2xBhs,5514
@@ -43,15 +43,16 @@ fmtr/tools/tabular_tools.py,sha256=tpIpZzYku1HcJrHZJL6BC39LmN3WUWVhFbK2N7nDVmE,1
43
43
  fmtr/tools/tokenization_tools.py,sha256=me-IBzSLyNYejLybwjO9CNB6Mj2NYfKPaOVThXyaGNg,4268
44
44
  fmtr/tools/tools.py,sha256=CAsApa1YwVdNE6H66Vjivs_mXYvOas3rh7fPELAnTpk,795
45
45
  fmtr/tools/unicode_tools.py,sha256=yS_9wpu8ogNoiIL7s1G_8bETFFO_YQlo4LNPv1NLDeY,52
46
- fmtr/tools/version,sha256=b43M_awGD_F3rxCBjDp_ke3qydVkZFg_xsdd_m5UYg8,6
46
+ fmtr/tools/version,sha256=3kdblII7rNZ3CvrwSEy_Vc4wF2ESTjddQwbq7rY4s7o,6
47
47
  fmtr/tools/version_tools.py,sha256=yNs_CGqWpqE4jbK9wsPIi14peJVXYbhIcMqHAFOw3yE,1480
48
48
  fmtr/tools/yaml_tools.py,sha256=9kuYChqJelWQIjGlSnK4iDdOWWH06P0gp9jIcRrC3UI,1903
49
49
  fmtr/tools/ai_tools/__init__.py,sha256=JZrLuOFNV1A3wvJgonxOgz_4WS-7MfCuowGWA5uYCjs,372
50
50
  fmtr/tools/ai_tools/agentic_tools.py,sha256=YebH7R9ovVo3GzfWAZxY49e2fNt13APDMe290xx7zks,3720
51
- fmtr/tools/ai_tools/inference_tools.py,sha256=yF8Oxph0L8W2CnK_o-MVztBhWVwBpgOEkx9_m3uqQww,11840
52
- fmtr/tools/path_tools/__init__.py,sha256=HENHHpkyBwSm2VTWV0Fz8FP3WjgjjhnR0TYPNbSSpyQ,268
53
- fmtr/tools/path_tools/app.py,sha256=JrJvtTDd_gkCKcZtBCDTMktsM77PZwGV_hzQX0g5GU8,1722
54
- fmtr/tools/path_tools/base.py,sha256=DOWXky4DOLqkrbw7fGP8StaAFiqSJqe_oYW_qCKuPrU,7297
51
+ fmtr/tools/ai_tools/inference_tools.py,sha256=2UP2gXEyOJUjyyV6zmFIYmIxUsh1rXkRH0IbFvr2bRs,11908
52
+ fmtr/tools/path_tools/__init__.py,sha256=v5CpmzXq5Ii90FtcmxAJKiLxmguZMrPnQ_HdT872Np0,443
53
+ fmtr/tools/path_tools/app_path_tools.py,sha256=JrJvtTDd_gkCKcZtBCDTMktsM77PZwGV_hzQX0g5GU8,1722
54
+ fmtr/tools/path_tools/path_tools.py,sha256=qZ03Zv4OiWdkWtt3a14OYSztLlL5YG4y-ElSGOBZSeA,7568
55
+ fmtr/tools/path_tools/type_path_tools.py,sha256=Zgs-ek-GXRKDIlVDGdg3muB0PIxTg2ba0NeHw6y8FWQ,40
55
56
  fmtr/tools/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
57
  fmtr/tools/tests/conftest.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
58
  fmtr/tools/tests/helpers.py,sha256=N5sf9YoZV93a7tf_UxpLeyQ9vp6Ec0teNIimFDvc054,1091
@@ -60,9 +61,9 @@ fmtr/tools/tests/test_environment.py,sha256=iHaiMQfECYZPkPKwfuIZV9uHuWe3aE-p_dN_
60
61
  fmtr/tools/tests/test_json.py,sha256=IeSP4ziPvRcmS8kq7k9tHonC9rN5YYq9GSNT2ul6Msk,287
61
62
  fmtr/tools/tests/test_path.py,sha256=AkZQa6_8BQ-VaCyL_J-iKmdf2ZaM-xFYR37Kun3k4_g,2188
62
63
  fmtr/tools/tests/test_yaml.py,sha256=jc0TwwKu9eC0LvFGNMERdgBue591xwLxYXFbtsRwXVM,287
63
- fmtr_tools-1.1.14.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
64
- fmtr_tools-1.1.14.dist-info/METADATA,sha256=PTxMKw76LL1461lUFx2eYpeWVr-hjj9YEKadqq__tIY,14933
65
- fmtr_tools-1.1.14.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
66
- fmtr_tools-1.1.14.dist-info/entry_points.txt,sha256=e-eOW1Ml13tbxHC6Er1MnVOEDePeWw7DKwlE-l-gCY0,205
67
- fmtr_tools-1.1.14.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
68
- fmtr_tools-1.1.14.dist-info/RECORD,,
64
+ fmtr_tools-1.1.16.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
65
+ fmtr_tools-1.1.16.dist-info/METADATA,sha256=G-5Rho81M9C600Bq90dD49p7kwMQ724QMAHqu-AO430,15046
66
+ fmtr_tools-1.1.16.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
67
+ fmtr_tools-1.1.16.dist-info/entry_points.txt,sha256=e-eOW1Ml13tbxHC6Er1MnVOEDePeWw7DKwlE-l-gCY0,205
68
+ fmtr_tools-1.1.16.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
69
+ fmtr_tools-1.1.16.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.7.1)
2
+ Generator: setuptools (80.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
File without changes