fred-oss 0.47.0__tar.gz → 0.49.0__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.
Files changed (100) hide show
  1. {fred_oss-0.47.0/src/main/fred_oss.egg-info → fred_oss-0.49.0}/PKG-INFO +2 -1
  2. {fred_oss-0.47.0 → fred_oss-0.49.0}/requirements.txt +2 -0
  3. fred_oss-0.49.0/src/main/fred/utils/imops.py +73 -0
  4. fred_oss-0.49.0/src/main/fred/utils/imout/_filesystem.py +11 -0
  5. fred_oss-0.49.0/src/main/fred/utils/imout/_string.py +10 -0
  6. fred_oss-0.49.0/src/main/fred/utils/imout/catalog.py +18 -0
  7. fred_oss-0.49.0/src/main/fred/utils/imout/interface.py +37 -0
  8. fred_oss-0.49.0/src/main/fred/version +1 -0
  9. fred_oss-0.49.0/src/main/fred/worker/runner/rest/routers/__init__.py +0 -0
  10. {fred_oss-0.47.0 → fred_oss-0.49.0/src/main/fred_oss.egg-info}/PKG-INFO +2 -1
  11. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred_oss.egg-info/SOURCES.txt +6 -0
  12. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred_oss.egg-info/requires.txt +1 -0
  13. fred_oss-0.47.0/src/main/fred/version +0 -1
  14. {fred_oss-0.47.0 → fred_oss-0.49.0}/MANIFEST.in +0 -0
  15. {fred_oss-0.47.0 → fred_oss-0.49.0}/NOTICE.txt +0 -0
  16. {fred_oss-0.47.0 → fred_oss-0.49.0}/README.md +0 -0
  17. {fred_oss-0.47.0 → fred_oss-0.49.0}/setup.cfg +0 -0
  18. {fred_oss-0.47.0 → fred_oss-0.49.0}/setup.py +0 -0
  19. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/cli/__init__.py +0 -0
  20. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/cli/__main__.py +0 -0
  21. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/cli/interface.py +0 -0
  22. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/cli/main.py +0 -0
  23. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/dao/__init__.py +0 -0
  24. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/dao/comp/__init__.py +0 -0
  25. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/dao/comp/_keyval.py +0 -0
  26. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/dao/comp/_pubsub.py +0 -0
  27. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/dao/comp/_queue.py +0 -0
  28. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/dao/comp/catalog.py +0 -0
  29. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/dao/comp/interface.py +0 -0
  30. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/dao/service/__init__.py +0 -0
  31. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/dao/service/_redis.py +0 -0
  32. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/dao/service/_stdlib.py +0 -0
  33. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/dao/service/catalog.py +0 -0
  34. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/dao/service/interface.py +0 -0
  35. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/dao/service/utils.py +0 -0
  36. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/future/__init__.py +0 -0
  37. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/future/callback/__init__.py +0 -0
  38. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/future/callback/_function.py +0 -0
  39. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/future/callback/catalog.py +0 -0
  40. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/future/callback/interface.py +0 -0
  41. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/future/impl.py +0 -0
  42. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/future/result.py +0 -0
  43. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/future/settings.py +0 -0
  44. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/future/utils.py +0 -0
  45. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/integrations/databricks/__init__.py +0 -0
  46. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/integrations/databricks/cli_ext.py +0 -0
  47. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/integrations/databricks/runtime.py +0 -0
  48. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/integrations/databricks/runtimes/__init__.py +0 -0
  49. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/integrations/databricks/runtimes/scanner.py +0 -0
  50. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/integrations/databricks/runtimes/sync.py +0 -0
  51. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/integrations/databricks/wrappers/__init__.py +0 -0
  52. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py +0 -0
  53. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/integrations/runpod/__init__.py +0 -0
  54. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/integrations/runpod/cli_ext.py +0 -0
  55. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/integrations/runpod/helper.py +0 -0
  56. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/maturity.py +0 -0
  57. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/monad/__init__.py +0 -0
  58. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/monad/_either.py +0 -0
  59. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/monad/catalog.py +0 -0
  60. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/monad/interface.py +0 -0
  61. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/settings.py +0 -0
  62. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/utils/__init__.py +0 -0
  63. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/utils/dateops.py +0 -0
  64. {fred_oss-0.47.0/src/main/fred/worker/runner/model → fred_oss-0.49.0/src/main/fred/utils/imout}/__init__.py +0 -0
  65. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/utils/runtime.py +0 -0
  66. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/version.py +0 -0
  67. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/__init__.py +0 -0
  68. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/interface.py +0 -0
  69. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/__init__.py +0 -0
  70. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/backend.py +0 -0
  71. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/client.py +0 -0
  72. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/handler.py +0 -0
  73. {fred_oss-0.47.0/src/main/fred/worker/runner/plugins → fred_oss-0.49.0/src/main/fred/worker/runner/model}/__init__.py +0 -0
  74. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/model/_handler.py +0 -0
  75. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/model/_item.py +0 -0
  76. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/model/_request.py +0 -0
  77. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/model/_runner_spec.py +0 -0
  78. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/model/catalog.py +0 -0
  79. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/model/interface.py +0 -0
  80. {fred_oss-0.47.0/src/main/fred/worker/runner/rest → fred_oss-0.49.0/src/main/fred/worker/runner/plugins}/__init__.py +0 -0
  81. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/plugins/_local.py +0 -0
  82. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/plugins/_runpod.py +0 -0
  83. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/plugins/catalog.py +0 -0
  84. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/plugins/interface.py +0 -0
  85. {fred_oss-0.47.0/src/main/fred/worker/runner/rest/routers → fred_oss-0.49.0/src/main/fred/worker/runner/rest}/__init__.py +0 -0
  86. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/rest/auth.py +0 -0
  87. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/rest/cli_ext.py +0 -0
  88. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/rest/routers/_runner.py +0 -0
  89. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/rest/routers/catalog.py +0 -0
  90. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/rest/routers/interface.py +0 -0
  91. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/rest/server.py +0 -0
  92. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/rest/settings.py +0 -0
  93. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/settings.py +0 -0
  94. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/signal.py +0 -0
  95. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/status.py +0 -0
  96. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/runner/utils.py +0 -0
  97. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred/worker/settings.py +0 -0
  98. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred_oss.egg-info/dependency_links.txt +0 -0
  99. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred_oss.egg-info/entry_points.txt +0 -0
  100. {fred_oss-0.47.0 → fred_oss-0.49.0}/src/main/fred_oss.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fred-oss
3
- Version: 0.47.0
3
+ Version: 0.49.0
4
4
  Summary: FREDOSS
5
5
  Home-page: https://fred.fahera.mx
6
6
  Author: Fahera Research, Education, and Development
@@ -14,6 +14,7 @@ Requires-Dist: redis==6.4.0
14
14
  Requires-Dist: requests==2.32.5
15
15
  Requires-Dist: fastapi==0.116.2
16
16
  Requires-Dist: uvicorn[standard]==0.35.0
17
+ Requires-Dist: pillow==11.3.0
17
18
  Dynamic: author
18
19
  Dynamic: author-email
19
20
  Dynamic: description
@@ -7,4 +7,6 @@ redis==6.4.0
7
7
  requests==2.32.5
8
8
  fastapi==0.116.2
9
9
  uvicorn[standard]==0.35.0
10
+ # Fred Utils
11
+ pillow==11.3.0
10
12
  # Databricks Runtime: 16.4 LTS (Python 3.12.3)
@@ -0,0 +1,73 @@
1
+ import io
2
+ import base64
3
+ from typing import Optional
4
+
5
+ from PIL.Image import Image
6
+
7
+ from fred.settings import logger_manager
8
+
9
+ logger = logger_manager.get_logger(__name__)
10
+
11
+
12
+ def save_image_to_path(image: Image, path: str) -> None:
13
+ """
14
+ Save a PIL Image to the specified file path.
15
+
16
+ Args:
17
+ image (Image): The PIL Image to save.
18
+ path (str): The file path where the image will be saved.
19
+ """
20
+ image.save(path)
21
+
22
+
23
+ def image_to_b64(image: Image, format: Optional[str] = None) -> str:
24
+ """
25
+ Convert a PIL Image to a base64-encoded string.
26
+ Args:
27
+ image (Image): The PIL Image to convert.
28
+ format (Optional[str]): The format to use for encoding (e.g., "PNG", "JPEG"). Defaults to "PNG" if None.
29
+ Returns:
30
+ str: The base64-encoded image string.
31
+ """
32
+ # Convert the image to a base64 string
33
+ buffer = io.BytesIO()
34
+ image.save(buffer, format=format or "PNG")
35
+ return base64.b64encode(buffer.getvalue()).decode("utf-8")
36
+
37
+
38
+ def get_image_from_b64(image_b64: str) -> Image:
39
+ """Load an image from a base64-encoded string.
40
+ Args:
41
+ image_b64 (str): The base64-encoded image string.
42
+ Returns:
43
+ Image: The loaded PIL Image.
44
+ """
45
+ import PIL.Image
46
+ # Decode the base64 string to bytes
47
+ image_data = base64.b64decode(image_b64)
48
+ # Open the image using PIL
49
+ return PIL.Image.open(io.BytesIO(image_data))
50
+
51
+
52
+ def get_image_from_path(path: str) -> Image:
53
+ """
54
+ Load an image from the specified file path.
55
+ Args:
56
+ path (str): The file path to load the image from.
57
+ Returns:
58
+ Image: The loaded PIL Image.
59
+ """
60
+ import PIL.Image
61
+ # Open the image using PIL
62
+ return PIL.Image.open(path)
63
+
64
+
65
+ def display_image_from_b64(image_b64: str) -> None:
66
+ """
67
+ Display a base64-encoded image.
68
+
69
+ Args:
70
+ image_b64 (str): The base64-encoded image string.
71
+ """
72
+ image = get_image_from_b64(image_b64=image_b64)
73
+ image.show()
@@ -0,0 +1,11 @@
1
+ from fred.utils.imout.interface import ImageOutputInterface
2
+
3
+
4
+ class OutputFilesystem(ImageOutputInterface):
5
+ """Filesystem output handler for images."""
6
+
7
+ def out(self, path: str) -> str:
8
+ from fred.utils.imops import save_image_to_path
9
+
10
+ save_image_to_path(image=self.image, path=path)
11
+ return path
@@ -0,0 +1,10 @@
1
+ from fred.utils.imout.interface import ImageOutputInterface
2
+
3
+
4
+ class OutputString(ImageOutputInterface):
5
+ """String output handler for images."""
6
+
7
+ def out(self) -> str:
8
+ from fred.utils.imops import image_to_b64
9
+
10
+ return image_to_b64(self.image)
@@ -0,0 +1,18 @@
1
+ import enum
2
+
3
+ from PIL.Image import Image
4
+
5
+ from fred.utils.imout.interface import ImageOutputInterface
6
+ from fred.utils.imout._filesystem import OutputFilesystem
7
+ from fred.utils.imout._string import OutputString
8
+
9
+
10
+ class ImageOutputCatalog(enum.Enum):
11
+ B64 = OutputString
12
+ STRING = OutputString
13
+ FILESYSTEM = OutputFilesystem
14
+
15
+ def __call__(self, image: Image, **kwargs) -> ImageOutputInterface:
16
+ if getattr(self.value, "auto", None):
17
+ return self.value.auto(image=image, **kwargs)
18
+ return self.value(image=image, **kwargs)
@@ -0,0 +1,37 @@
1
+ from dataclasses import dataclass
2
+ from typing import Any, Optional
3
+
4
+ from PIL.Image import Image
5
+
6
+
7
+ class ImageOutputBackendInterface:
8
+ metadata: dict = {}
9
+ client: Optional[Any] = None # Placeholder for clients like MinIO, S3, etc.
10
+
11
+ @classmethod
12
+ def set_shared_client(cls, client: Any) -> None:
13
+ cls.client = client
14
+
15
+
16
+ @dataclass(frozen=True, slots=True)
17
+ class ImageOutputInterface(ImageOutputBackendInterface):
18
+ """Interface for image output handling."""
19
+ image: Image
20
+
21
+ @classmethod
22
+ def from_path(cls, path: str) -> "ImageOutputInterface":
23
+ from fred.utils.imops import get_image_from_path
24
+
25
+ image = get_image_from_path(path=path)
26
+ return cls(image=image)
27
+
28
+ def save(self, path: str, format: str = "PNG"):
29
+ """Save the image to a file."""
30
+ self.image.save(path, format=format)
31
+
32
+ def show(self):
33
+ """Display the image."""
34
+ self.image.show()
35
+
36
+ def out(self, **kwargs) -> str:
37
+ raise NotImplementedError("Subclasses must implement out method.")
@@ -0,0 +1 @@
1
+ 0.49.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fred-oss
3
- Version: 0.47.0
3
+ Version: 0.49.0
4
4
  Summary: FREDOSS
5
5
  Home-page: https://fred.fahera.mx
6
6
  Author: Fahera Research, Education, and Development
@@ -14,6 +14,7 @@ Requires-Dist: redis==6.4.0
14
14
  Requires-Dist: requests==2.32.5
15
15
  Requires-Dist: fastapi==0.116.2
16
16
  Requires-Dist: uvicorn[standard]==0.35.0
17
+ Requires-Dist: pillow==11.3.0
17
18
  Dynamic: author
18
19
  Dynamic: author-email
19
20
  Dynamic: description
@@ -50,7 +50,13 @@ src/main/fred/monad/catalog.py
50
50
  src/main/fred/monad/interface.py
51
51
  src/main/fred/utils/__init__.py
52
52
  src/main/fred/utils/dateops.py
53
+ src/main/fred/utils/imops.py
53
54
  src/main/fred/utils/runtime.py
55
+ src/main/fred/utils/imout/__init__.py
56
+ src/main/fred/utils/imout/_filesystem.py
57
+ src/main/fred/utils/imout/_string.py
58
+ src/main/fred/utils/imout/catalog.py
59
+ src/main/fred/utils/imout/interface.py
54
60
  src/main/fred/worker/__init__.py
55
61
  src/main/fred/worker/interface.py
56
62
  src/main/fred/worker/settings.py
@@ -4,3 +4,4 @@ redis==6.4.0
4
4
  requests==2.32.5
5
5
  fastapi==0.116.2
6
6
  uvicorn[standard]==0.35.0
7
+ pillow==11.3.0
@@ -1 +0,0 @@
1
- 0.47.0
File without changes
File without changes
File without changes
File without changes
File without changes