fmtr.tools 1.1.9__tar.gz → 1.1.11__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.
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/PKG-INFO +42 -38
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/README.md +2 -1
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/__init__.py +2 -1
- fmtr_tools-1.1.11/fmtr/tools/packaging_tools.py +14 -0
- fmtr_tools-1.1.11/fmtr/tools/path_tools/__init__.py +7 -0
- fmtr_tools-1.1.11/fmtr/tools/path_tools/app.py +40 -0
- fmtr_tools-1.1.9/fmtr/tools/path_tools.py → fmtr_tools-1.1.11/fmtr/tools/path_tools/base.py +12 -2
- fmtr_tools-1.1.11/fmtr/tools/version +1 -0
- fmtr_tools-1.1.11/fmtr/tools/yaml_tools.py +69 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr.tools.egg-info/PKG-INFO +42 -38
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr.tools.egg-info/SOURCES.txt +4 -1
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr.tools.egg-info/requires.txt +40 -36
- fmtr_tools-1.1.11/fmtr.tools.egg-info/top_level.txt +1 -0
- fmtr_tools-1.1.9/fmtr/tools/version +0 -1
- fmtr_tools-1.1.9/fmtr/tools/yaml_tools.py +0 -23
- fmtr_tools-1.1.9/fmtr.tools.egg-info/top_level.txt +0 -2
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/LICENSE +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/ai_tools/__init__.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/ai_tools/agentic_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/ai_tools/inference_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/api_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/async_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/augmentation_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/caching_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/console_script_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/constants.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/data_modelling_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/dataclass_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/datatype_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/debugging_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/docker_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/environment_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/function_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/google_api_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/hash_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/hfh_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/html_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/import_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/inspection_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/interface_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/iterator_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/json_fix_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/json_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/logging_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/merging_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/metric_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/name_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/netrc_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/openai_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/parallel_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/pdf_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/platform_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/process_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/profiling_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/random_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/semantic_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/settings_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/spaces_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/string_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/tabular_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/tests/__init__.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/tests/conftest.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/tests/helpers.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/tests/test_datatype.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/tests/test_environment.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/tests/test_json.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/tests/test_path.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/tests/test_yaml.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/tokenization_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/unicode_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr/tools/version_tools.py +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr.tools.egg-info/dependency_links.txt +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/fmtr.tools.egg-info/entry_points.txt +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/setup.cfg +0 -0
- {fmtr_tools-1.1.9 → fmtr_tools-1.1.11}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fmtr.tools
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.11
|
|
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,53 +9,54 @@ 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:
|
|
13
|
-
Requires-Dist: pydantic-ai[logfire,openai]; extra == "test"
|
|
14
|
-
Requires-Dist: pytest-cov; extra == "test"
|
|
15
|
-
Requires-Dist: openai; extra == "test"
|
|
16
|
-
Requires-Dist: tabulate; extra == "test"
|
|
17
|
-
Requires-Dist: google-auth-httplib2; extra == "test"
|
|
18
|
-
Requires-Dist: openpyxl; extra == "test"
|
|
12
|
+
Requires-Dist: flet-webview; extra == "test"
|
|
19
13
|
Requires-Dist: fastapi; extra == "test"
|
|
14
|
+
Requires-Dist: pymupdf4llm; extra == "test"
|
|
20
15
|
Requires-Dist: Unidecode; extra == "test"
|
|
21
|
-
Requires-Dist: flet[all]; extra == "test"
|
|
22
|
-
Requires-Dist: dask[bag]; extra == "test"
|
|
23
|
-
Requires-Dist: uvicorn[standard]; extra == "test"
|
|
24
|
-
Requires-Dist: pydevd-pycharm; extra == "test"
|
|
25
|
-
Requires-Dist: huggingface_hub; extra == "test"
|
|
26
|
-
Requires-Dist: logfire; extra == "test"
|
|
27
|
-
Requires-Dist: pyyaml; extra == "test"
|
|
28
|
-
Requires-Dist: sre_yield; extra == "test"
|
|
29
|
-
Requires-Dist: docker; extra == "test"
|
|
30
|
-
Requires-Dist: flet-webview; extra == "test"
|
|
31
|
-
Requires-Dist: logfire[fastapi]; extra == "test"
|
|
32
|
-
Requires-Dist: bokeh; extra == "test"
|
|
33
|
-
Requires-Dist: pydantic; extra == "test"
|
|
34
|
-
Requires-Dist: pandas; extra == "test"
|
|
35
16
|
Requires-Dist: semver; extra == "test"
|
|
36
|
-
Requires-Dist: faker; extra == "test"
|
|
37
|
-
Requires-Dist: contexttimer; extra == "test"
|
|
38
|
-
Requires-Dist: pymupdf4llm; extra == "test"
|
|
39
17
|
Requires-Dist: pydantic-settings; extra == "test"
|
|
40
|
-
Requires-Dist:
|
|
41
|
-
Requires-Dist:
|
|
42
|
-
Requires-Dist: google-auth; extra == "test"
|
|
43
|
-
Requires-Dist: flet-video; extra == "test"
|
|
44
|
-
Requires-Dist: tinynetrc; extra == "test"
|
|
45
|
-
Requires-Dist: torchvision; extra == "test"
|
|
18
|
+
Requires-Dist: google-auth-httplib2; extra == "test"
|
|
19
|
+
Requires-Dist: pandas; extra == "test"
|
|
46
20
|
Requires-Dist: google-auth-oauthlib; extra == "test"
|
|
47
|
-
Requires-Dist:
|
|
48
|
-
Requires-Dist:
|
|
21
|
+
Requires-Dist: openai; extra == "test"
|
|
22
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
49
23
|
Requires-Dist: transformers[sentencepiece]; extra == "test"
|
|
50
|
-
Requires-Dist:
|
|
24
|
+
Requires-Dist: logfire; extra == "test"
|
|
25
|
+
Requires-Dist: pydantic; extra == "test"
|
|
26
|
+
Requires-Dist: deepmerge; extra == "test"
|
|
51
27
|
Requires-Dist: pymupdf; extra == "test"
|
|
52
|
-
Requires-Dist: html2text; extra == "test"
|
|
53
28
|
Requires-Dist: sentence_transformers; extra == "test"
|
|
54
|
-
Requires-Dist:
|
|
29
|
+
Requires-Dist: html2text; extra == "test"
|
|
30
|
+
Requires-Dist: sre_yield; extra == "test"
|
|
31
|
+
Requires-Dist: flet[all]; extra == "test"
|
|
32
|
+
Requires-Dist: peft; extra == "test"
|
|
33
|
+
Requires-Dist: pydantic-ai[logfire,openai]; extra == "test"
|
|
34
|
+
Requires-Dist: appdirs; extra == "test"
|
|
55
35
|
Requires-Dist: google-api-python-client; extra == "test"
|
|
36
|
+
Requires-Dist: json_repair; extra == "test"
|
|
37
|
+
Requires-Dist: dask[bag]; extra == "test"
|
|
38
|
+
Requires-Dist: torchaudio; extra == "test"
|
|
39
|
+
Requires-Dist: google-auth; extra == "test"
|
|
40
|
+
Requires-Dist: tabulate; extra == "test"
|
|
41
|
+
Requires-Dist: tokenizers; extra == "test"
|
|
42
|
+
Requires-Dist: ollama; extra == "test"
|
|
43
|
+
Requires-Dist: torchvision; extra == "test"
|
|
44
|
+
Requires-Dist: yamlscript; extra == "test"
|
|
45
|
+
Requires-Dist: faker; extra == "test"
|
|
46
|
+
Requires-Dist: bokeh; extra == "test"
|
|
47
|
+
Requires-Dist: docker; extra == "test"
|
|
48
|
+
Requires-Dist: tinynetrc; extra == "test"
|
|
49
|
+
Requires-Dist: uvicorn[standard]; extra == "test"
|
|
50
|
+
Requires-Dist: openpyxl; extra == "test"
|
|
56
51
|
Requires-Dist: diskcache; extra == "test"
|
|
52
|
+
Requires-Dist: pydevd-pycharm; extra == "test"
|
|
53
|
+
Requires-Dist: logfire[fastapi]; extra == "test"
|
|
54
|
+
Requires-Dist: contexttimer; extra == "test"
|
|
55
|
+
Requires-Dist: distributed; extra == "test"
|
|
56
|
+
Requires-Dist: flet-video; extra == "test"
|
|
57
|
+
Requires-Dist: huggingface_hub; extra == "test"
|
|
57
58
|
Provides-Extra: yaml
|
|
58
|
-
Requires-Dist:
|
|
59
|
+
Requires-Dist: yamlscript; extra == "yaml"
|
|
59
60
|
Provides-Extra: logging
|
|
60
61
|
Requires-Dist: logfire; extra == "logging"
|
|
61
62
|
Requires-Dist: semver; extra == "logging"
|
|
@@ -149,6 +150,8 @@ Requires-Dist: pydevd-pycharm; extra == "debug"
|
|
|
149
150
|
Provides-Extra: sets
|
|
150
151
|
Requires-Dist: pydantic-settings; extra == "sets"
|
|
151
152
|
Requires-Dist: pydantic; extra == "sets"
|
|
153
|
+
Provides-Extra: path-app
|
|
154
|
+
Requires-Dist: appdirs; extra == "path-app"
|
|
152
155
|
Dynamic: author
|
|
153
156
|
Dynamic: author-email
|
|
154
157
|
Dynamic: description
|
|
@@ -283,9 +286,10 @@ The included modules, plus any extra requirements, are as follows:
|
|
|
283
286
|
- `tools.Path`: Enhanced
|
|
284
287
|
`pathlib.Path` object with additional functionality for Windows-to-Unix path conversion in WSL environments, reading/writing JSON and YAML files with proper encoding.
|
|
285
288
|
- Extras: None
|
|
286
|
-
-
|
|
287
289
|
`tools.PackagePaths` class for managing canonical package paths, like settings files, artifact directories, version files.
|
|
288
290
|
- Extras: None
|
|
291
|
+
`tools.AppPaths` Wrapper around `appdirs` for application paths.
|
|
292
|
+
- Extras: `paths.app`
|
|
289
293
|
- `tools.platform`: Detecting if host is WSL, Docker etc.
|
|
290
294
|
- Extras: None
|
|
291
295
|
- `tools.ContextProcess`: Manages a function running in a separate process using a context manager. Provides methods to start, stop, and restart the process, with configurable restart delays. Useful for ensuring clean process management and automatic stopping when the context manager exits.
|
|
@@ -122,9 +122,10 @@ The included modules, plus any extra requirements, are as follows:
|
|
|
122
122
|
- `tools.Path`: Enhanced
|
|
123
123
|
`pathlib.Path` object with additional functionality for Windows-to-Unix path conversion in WSL environments, reading/writing JSON and YAML files with proper encoding.
|
|
124
124
|
- Extras: None
|
|
125
|
-
-
|
|
126
125
|
`tools.PackagePaths` class for managing canonical package paths, like settings files, artifact directories, version files.
|
|
127
126
|
- Extras: None
|
|
127
|
+
`tools.AppPaths` Wrapper around `appdirs` for application paths.
|
|
128
|
+
- Extras: `paths.app`
|
|
128
129
|
- `tools.platform`: Detecting if host is WSL, Docker etc.
|
|
129
130
|
- Extras: None
|
|
130
131
|
- `tools.ContextProcess`: Manages a function running in a separate process using a context manager. Provides methods to start, stop, and restart the process, with configurable restart delays. Useful for ensuring clean process management and automatic stopping when the context manager exits.
|
|
@@ -19,10 +19,11 @@ import fmtr.tools.string_tools as string
|
|
|
19
19
|
import fmtr.tools.name_tools as name
|
|
20
20
|
import fmtr.tools.logging_tools as logging
|
|
21
21
|
import fmtr.tools.async_tools as asyncio
|
|
22
|
+
import fmtr.tools.packaging_tools as packaging
|
|
22
23
|
from fmtr.tools.logging_tools import logger
|
|
23
24
|
|
|
24
25
|
from fmtr.tools.import_tools import MissingExtraMockModule
|
|
25
|
-
from fmtr.tools.path_tools import Path, PackagePaths
|
|
26
|
+
from fmtr.tools.path_tools import Path, PackagePaths, AppPaths
|
|
26
27
|
from fmtr.tools.constants import Constants
|
|
27
28
|
|
|
28
29
|
try:
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from fmtr.tools.import_tools import MissingExtraMockModule
|
|
2
|
+
from fmtr.tools.path_tools.base import Path, PackagePaths
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
from fmtr.tools.path_tools.app import AppPaths
|
|
6
|
+
except ImportError as exception:
|
|
7
|
+
AppPaths = MissingExtraMockModule('path.app', exception)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import appdirs
|
|
2
|
+
|
|
3
|
+
from fmtr.tools.path_tools import Path
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AppPaths:
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
Wrap appdirs to return Path objects
|
|
10
|
+
|
|
11
|
+
"""
|
|
12
|
+
PathType = Path
|
|
13
|
+
|
|
14
|
+
def user_data_dir(self, appname=None, appauthor=None, version=None, roaming=False):
|
|
15
|
+
path_str = appdirs.user_data_dir(appname=appname, appauthor=appauthor, version=version, roaming=roaming)
|
|
16
|
+
return self.PathType(path_str)
|
|
17
|
+
|
|
18
|
+
def user_config_dir(self, appname=None, appauthor=None, version=None, roaming=False):
|
|
19
|
+
path_str = appdirs.user_config_dir(appname=appname, appauthor=appauthor, version=version, roaming=roaming)
|
|
20
|
+
return self.PathType(path_str)
|
|
21
|
+
|
|
22
|
+
def site_config_dir(self, appname=None, appauthor=None, version=None):
|
|
23
|
+
path_str = appdirs.site_config_dir(appname=appname, appauthor=appauthor, version=version, multipath=False)
|
|
24
|
+
return self.PathType(path_str)
|
|
25
|
+
|
|
26
|
+
def site_data_dir(self, appname=None, appauthor=None, version=None):
|
|
27
|
+
path_str = appdirs.site_data_dir(appname=appname, appauthor=appauthor, version=version, multipath=False)
|
|
28
|
+
return self.PathType(path_str)
|
|
29
|
+
|
|
30
|
+
def user_cache_dir(self, appname=None, appauthor=None, version=None):
|
|
31
|
+
path_str = appdirs.user_cache_dir(appname=appname, appauthor=appauthor, version=version)
|
|
32
|
+
return self.PathType(path_str)
|
|
33
|
+
|
|
34
|
+
def user_state_dir(self, appname=None, appauthor=None, version=None):
|
|
35
|
+
path_str = appdirs.user_state_dir(appname=appname, appauthor=appauthor, version=version)
|
|
36
|
+
return self.PathType(path_str)
|
|
37
|
+
|
|
38
|
+
def user_log_dir(self, appname=None, appauthor=None, version=None):
|
|
39
|
+
path_str = appdirs.user_log_dir(appname=appname, appauthor=appauthor, version=version)
|
|
40
|
+
return self.PathType(path_str)
|
|
@@ -154,6 +154,15 @@ class Path(type(Path())):
|
|
|
154
154
|
"""
|
|
155
155
|
return super().exists()
|
|
156
156
|
|
|
157
|
+
@classmethod
|
|
158
|
+
def app(cls):
|
|
159
|
+
"""
|
|
160
|
+
|
|
161
|
+
Convenience method for getting application paths
|
|
162
|
+
|
|
163
|
+
"""
|
|
164
|
+
from fmtr.tools import path
|
|
165
|
+
return path.AppPaths()
|
|
157
166
|
|
|
158
167
|
class PackagePaths:
|
|
159
168
|
"""
|
|
@@ -315,5 +324,6 @@ class PackagePaths:
|
|
|
315
324
|
|
|
316
325
|
|
|
317
326
|
if __name__ == "__main__":
|
|
318
|
-
|
|
319
|
-
|
|
327
|
+
path = Path()
|
|
328
|
+
path.app.user_log_dir()
|
|
329
|
+
path
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.1.11
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
from functools import lru_cache
|
|
2
|
+
from typing import Any
|
|
3
|
+
from yaml import CDumper as Dumper
|
|
4
|
+
from yaml import dump
|
|
5
|
+
|
|
6
|
+
from fmtr.tools import environment_tools as env
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def install():
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
Installs the YAML Script runtime binary of the specified version.
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
import subprocess
|
|
16
|
+
from fmtr.tools import logger, packaging
|
|
17
|
+
|
|
18
|
+
version = packaging.get_version('yamlscript')
|
|
19
|
+
logger.warning(f"Installing YAML Script runtime binary version {version}...")
|
|
20
|
+
result = subprocess.run(f"curl https://yamlscript.org/install | VERSION={version} LIB=1 bash", shell=True, check=True)
|
|
21
|
+
return result
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@lru_cache
|
|
25
|
+
def get_module(is_auto=env.IS_DEBUG):
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
Get the YAML Script runtime module, installing the runtime if specified
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
try:
|
|
32
|
+
import yamlscript
|
|
33
|
+
except Exception as exception:
|
|
34
|
+
if not is_auto:
|
|
35
|
+
raise ImportError(f'YAML Script runtime missing and {is_auto=}. Set to {True} to install.') from exception
|
|
36
|
+
install()
|
|
37
|
+
import yamlscript
|
|
38
|
+
return yamlscript
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@lru_cache
|
|
42
|
+
def get_interpreter():
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
Fetches and returns a cached instance of the YAMLScript interpreter.
|
|
46
|
+
|
|
47
|
+
"""
|
|
48
|
+
module = get_module()
|
|
49
|
+
interpreter = module.YAMLScript()
|
|
50
|
+
return interpreter
|
|
51
|
+
|
|
52
|
+
def to_yaml(obj: Any) -> str:
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
Serialize to YAML
|
|
56
|
+
|
|
57
|
+
"""
|
|
58
|
+
yaml_str = dump(obj, allow_unicode=True, Dumper=Dumper)
|
|
59
|
+
return yaml_str
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def from_yaml(yaml_str: str) -> Any:
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
Deserialize from YAML
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
obj = get_interpreter().load(yaml_str)
|
|
69
|
+
return obj
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fmtr.tools
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.11
|
|
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,53 +9,54 @@ 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:
|
|
13
|
-
Requires-Dist: pydantic-ai[logfire,openai]; extra == "test"
|
|
14
|
-
Requires-Dist: pytest-cov; extra == "test"
|
|
15
|
-
Requires-Dist: openai; extra == "test"
|
|
16
|
-
Requires-Dist: tabulate; extra == "test"
|
|
17
|
-
Requires-Dist: google-auth-httplib2; extra == "test"
|
|
18
|
-
Requires-Dist: openpyxl; extra == "test"
|
|
12
|
+
Requires-Dist: flet-webview; extra == "test"
|
|
19
13
|
Requires-Dist: fastapi; extra == "test"
|
|
14
|
+
Requires-Dist: pymupdf4llm; extra == "test"
|
|
20
15
|
Requires-Dist: Unidecode; extra == "test"
|
|
21
|
-
Requires-Dist: flet[all]; extra == "test"
|
|
22
|
-
Requires-Dist: dask[bag]; extra == "test"
|
|
23
|
-
Requires-Dist: uvicorn[standard]; extra == "test"
|
|
24
|
-
Requires-Dist: pydevd-pycharm; extra == "test"
|
|
25
|
-
Requires-Dist: huggingface_hub; extra == "test"
|
|
26
|
-
Requires-Dist: logfire; extra == "test"
|
|
27
|
-
Requires-Dist: pyyaml; extra == "test"
|
|
28
|
-
Requires-Dist: sre_yield; extra == "test"
|
|
29
|
-
Requires-Dist: docker; extra == "test"
|
|
30
|
-
Requires-Dist: flet-webview; extra == "test"
|
|
31
|
-
Requires-Dist: logfire[fastapi]; extra == "test"
|
|
32
|
-
Requires-Dist: bokeh; extra == "test"
|
|
33
|
-
Requires-Dist: pydantic; extra == "test"
|
|
34
|
-
Requires-Dist: pandas; extra == "test"
|
|
35
16
|
Requires-Dist: semver; extra == "test"
|
|
36
|
-
Requires-Dist: faker; extra == "test"
|
|
37
|
-
Requires-Dist: contexttimer; extra == "test"
|
|
38
|
-
Requires-Dist: pymupdf4llm; extra == "test"
|
|
39
17
|
Requires-Dist: pydantic-settings; extra == "test"
|
|
40
|
-
Requires-Dist:
|
|
41
|
-
Requires-Dist:
|
|
42
|
-
Requires-Dist: google-auth; extra == "test"
|
|
43
|
-
Requires-Dist: flet-video; extra == "test"
|
|
44
|
-
Requires-Dist: tinynetrc; extra == "test"
|
|
45
|
-
Requires-Dist: torchvision; extra == "test"
|
|
18
|
+
Requires-Dist: google-auth-httplib2; extra == "test"
|
|
19
|
+
Requires-Dist: pandas; extra == "test"
|
|
46
20
|
Requires-Dist: google-auth-oauthlib; extra == "test"
|
|
47
|
-
Requires-Dist:
|
|
48
|
-
Requires-Dist:
|
|
21
|
+
Requires-Dist: openai; extra == "test"
|
|
22
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
49
23
|
Requires-Dist: transformers[sentencepiece]; extra == "test"
|
|
50
|
-
Requires-Dist:
|
|
24
|
+
Requires-Dist: logfire; extra == "test"
|
|
25
|
+
Requires-Dist: pydantic; extra == "test"
|
|
26
|
+
Requires-Dist: deepmerge; extra == "test"
|
|
51
27
|
Requires-Dist: pymupdf; extra == "test"
|
|
52
|
-
Requires-Dist: html2text; extra == "test"
|
|
53
28
|
Requires-Dist: sentence_transformers; extra == "test"
|
|
54
|
-
Requires-Dist:
|
|
29
|
+
Requires-Dist: html2text; extra == "test"
|
|
30
|
+
Requires-Dist: sre_yield; extra == "test"
|
|
31
|
+
Requires-Dist: flet[all]; extra == "test"
|
|
32
|
+
Requires-Dist: peft; extra == "test"
|
|
33
|
+
Requires-Dist: pydantic-ai[logfire,openai]; extra == "test"
|
|
34
|
+
Requires-Dist: appdirs; extra == "test"
|
|
55
35
|
Requires-Dist: google-api-python-client; extra == "test"
|
|
36
|
+
Requires-Dist: json_repair; extra == "test"
|
|
37
|
+
Requires-Dist: dask[bag]; extra == "test"
|
|
38
|
+
Requires-Dist: torchaudio; extra == "test"
|
|
39
|
+
Requires-Dist: google-auth; extra == "test"
|
|
40
|
+
Requires-Dist: tabulate; extra == "test"
|
|
41
|
+
Requires-Dist: tokenizers; extra == "test"
|
|
42
|
+
Requires-Dist: ollama; extra == "test"
|
|
43
|
+
Requires-Dist: torchvision; extra == "test"
|
|
44
|
+
Requires-Dist: yamlscript; extra == "test"
|
|
45
|
+
Requires-Dist: faker; extra == "test"
|
|
46
|
+
Requires-Dist: bokeh; extra == "test"
|
|
47
|
+
Requires-Dist: docker; extra == "test"
|
|
48
|
+
Requires-Dist: tinynetrc; extra == "test"
|
|
49
|
+
Requires-Dist: uvicorn[standard]; extra == "test"
|
|
50
|
+
Requires-Dist: openpyxl; extra == "test"
|
|
56
51
|
Requires-Dist: diskcache; extra == "test"
|
|
52
|
+
Requires-Dist: pydevd-pycharm; extra == "test"
|
|
53
|
+
Requires-Dist: logfire[fastapi]; extra == "test"
|
|
54
|
+
Requires-Dist: contexttimer; extra == "test"
|
|
55
|
+
Requires-Dist: distributed; extra == "test"
|
|
56
|
+
Requires-Dist: flet-video; extra == "test"
|
|
57
|
+
Requires-Dist: huggingface_hub; extra == "test"
|
|
57
58
|
Provides-Extra: yaml
|
|
58
|
-
Requires-Dist:
|
|
59
|
+
Requires-Dist: yamlscript; extra == "yaml"
|
|
59
60
|
Provides-Extra: logging
|
|
60
61
|
Requires-Dist: logfire; extra == "logging"
|
|
61
62
|
Requires-Dist: semver; extra == "logging"
|
|
@@ -149,6 +150,8 @@ Requires-Dist: pydevd-pycharm; extra == "debug"
|
|
|
149
150
|
Provides-Extra: sets
|
|
150
151
|
Requires-Dist: pydantic-settings; extra == "sets"
|
|
151
152
|
Requires-Dist: pydantic; extra == "sets"
|
|
153
|
+
Provides-Extra: path-app
|
|
154
|
+
Requires-Dist: appdirs; extra == "path-app"
|
|
152
155
|
Dynamic: author
|
|
153
156
|
Dynamic: author-email
|
|
154
157
|
Dynamic: description
|
|
@@ -283,9 +286,10 @@ The included modules, plus any extra requirements, are as follows:
|
|
|
283
286
|
- `tools.Path`: Enhanced
|
|
284
287
|
`pathlib.Path` object with additional functionality for Windows-to-Unix path conversion in WSL environments, reading/writing JSON and YAML files with proper encoding.
|
|
285
288
|
- Extras: None
|
|
286
|
-
-
|
|
287
289
|
`tools.PackagePaths` class for managing canonical package paths, like settings files, artifact directories, version files.
|
|
288
290
|
- Extras: None
|
|
291
|
+
`tools.AppPaths` Wrapper around `appdirs` for application paths.
|
|
292
|
+
- Extras: `paths.app`
|
|
289
293
|
- `tools.platform`: Detecting if host is WSL, Docker etc.
|
|
290
294
|
- Extras: None
|
|
291
295
|
- `tools.ContextProcess`: Manages a function running in a separate process using a context manager. Provides methods to start, stop, and restart the process, with configurable restart delays. Useful for ensuring clean process management and automatic stopping when the context manager exits.
|
|
@@ -31,8 +31,8 @@ setup.py
|
|
|
31
31
|
./fmtr/tools/name_tools.py
|
|
32
32
|
./fmtr/tools/netrc_tools.py
|
|
33
33
|
./fmtr/tools/openai_tools.py
|
|
34
|
+
./fmtr/tools/packaging_tools.py
|
|
34
35
|
./fmtr/tools/parallel_tools.py
|
|
35
|
-
./fmtr/tools/path_tools.py
|
|
36
36
|
./fmtr/tools/pdf_tools.py
|
|
37
37
|
./fmtr/tools/platform_tools.py
|
|
38
38
|
./fmtr/tools/process_tools.py
|
|
@@ -52,6 +52,9 @@ setup.py
|
|
|
52
52
|
./fmtr/tools/ai_tools/__init__.py
|
|
53
53
|
./fmtr/tools/ai_tools/agentic_tools.py
|
|
54
54
|
./fmtr/tools/ai_tools/inference_tools.py
|
|
55
|
+
./fmtr/tools/path_tools/__init__.py
|
|
56
|
+
./fmtr/tools/path_tools/app.py
|
|
57
|
+
./fmtr/tools/path_tools/base.py
|
|
55
58
|
./fmtr/tools/tests/__init__.py
|
|
56
59
|
./fmtr/tools/tests/conftest.py
|
|
57
60
|
./fmtr/tools/tests/helpers.py
|
|
@@ -82,6 +82,9 @@ dask[bag]
|
|
|
82
82
|
distributed
|
|
83
83
|
bokeh
|
|
84
84
|
|
|
85
|
+
[path.app]
|
|
86
|
+
appdirs
|
|
87
|
+
|
|
85
88
|
[pdf]
|
|
86
89
|
pymupdf
|
|
87
90
|
pydantic
|
|
@@ -113,51 +116,52 @@ tabulate
|
|
|
113
116
|
openpyxl
|
|
114
117
|
|
|
115
118
|
[test]
|
|
116
|
-
|
|
117
|
-
pydantic-ai[logfire,openai]
|
|
118
|
-
pytest-cov
|
|
119
|
-
openai
|
|
120
|
-
tabulate
|
|
121
|
-
google-auth-httplib2
|
|
122
|
-
openpyxl
|
|
119
|
+
flet-webview
|
|
123
120
|
fastapi
|
|
121
|
+
pymupdf4llm
|
|
124
122
|
Unidecode
|
|
125
|
-
flet[all]
|
|
126
|
-
dask[bag]
|
|
127
|
-
uvicorn[standard]
|
|
128
|
-
pydevd-pycharm
|
|
129
|
-
huggingface_hub
|
|
130
|
-
logfire
|
|
131
|
-
pyyaml
|
|
132
|
-
sre_yield
|
|
133
|
-
docker
|
|
134
|
-
flet-webview
|
|
135
|
-
logfire[fastapi]
|
|
136
|
-
bokeh
|
|
137
|
-
pydantic
|
|
138
|
-
pandas
|
|
139
123
|
semver
|
|
140
|
-
faker
|
|
141
|
-
contexttimer
|
|
142
|
-
pymupdf4llm
|
|
143
124
|
pydantic-settings
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
google-auth
|
|
147
|
-
flet-video
|
|
148
|
-
tinynetrc
|
|
149
|
-
torchvision
|
|
125
|
+
google-auth-httplib2
|
|
126
|
+
pandas
|
|
150
127
|
google-auth-oauthlib
|
|
151
|
-
|
|
152
|
-
|
|
128
|
+
openai
|
|
129
|
+
pytest-cov
|
|
153
130
|
transformers[sentencepiece]
|
|
154
|
-
|
|
131
|
+
logfire
|
|
132
|
+
pydantic
|
|
133
|
+
deepmerge
|
|
155
134
|
pymupdf
|
|
156
|
-
html2text
|
|
157
135
|
sentence_transformers
|
|
158
|
-
|
|
136
|
+
html2text
|
|
137
|
+
sre_yield
|
|
138
|
+
flet[all]
|
|
139
|
+
peft
|
|
140
|
+
pydantic-ai[logfire,openai]
|
|
141
|
+
appdirs
|
|
159
142
|
google-api-python-client
|
|
143
|
+
json_repair
|
|
144
|
+
dask[bag]
|
|
145
|
+
torchaudio
|
|
146
|
+
google-auth
|
|
147
|
+
tabulate
|
|
148
|
+
tokenizers
|
|
149
|
+
ollama
|
|
150
|
+
torchvision
|
|
151
|
+
yamlscript
|
|
152
|
+
faker
|
|
153
|
+
bokeh
|
|
154
|
+
docker
|
|
155
|
+
tinynetrc
|
|
156
|
+
uvicorn[standard]
|
|
157
|
+
openpyxl
|
|
160
158
|
diskcache
|
|
159
|
+
pydevd-pycharm
|
|
160
|
+
logfire[fastapi]
|
|
161
|
+
contexttimer
|
|
162
|
+
distributed
|
|
163
|
+
flet-video
|
|
164
|
+
huggingface_hub
|
|
161
165
|
|
|
162
166
|
[tokenization]
|
|
163
167
|
tokenizers
|
|
@@ -169,4 +173,4 @@ Unidecode
|
|
|
169
173
|
semver
|
|
170
174
|
|
|
171
175
|
[yaml]
|
|
172
|
-
|
|
176
|
+
yamlscript
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fmtr
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.1.9
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
from typing import Any
|
|
2
|
-
from yaml import CLoader as Loader, CDumper as Dumper
|
|
3
|
-
from yaml import load, dump
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def to_yaml(obj: Any) -> str:
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"""
|
|
12
|
-
yaml_str = dump(obj, allow_unicode=True, Dumper=Dumper)
|
|
13
|
-
return yaml_str
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def from_yaml(yaml_str: str) -> Any:
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"""
|
|
22
|
-
obj = load(yaml_str, Loader=Loader)
|
|
23
|
-
return obj
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|