fred-oss 0.16.0__tar.gz → 0.18.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 (65) hide show
  1. {fred_oss-0.16.0/src/main/fred_oss.egg-info → fred_oss-0.18.0}/PKG-INFO +1 -1
  2. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/dao/comp/_keyval.py +7 -3
  3. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/dao/comp/catalog.py +19 -6
  4. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/dao/comp/interface.py +16 -6
  5. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/dao/service/catalog.py +6 -3
  6. fred_oss-0.18.0/src/main/fred/version +1 -0
  7. {fred_oss-0.16.0 → fred_oss-0.18.0/src/main/fred_oss.egg-info}/PKG-INFO +1 -1
  8. fred_oss-0.16.0/src/main/fred/version +0 -1
  9. {fred_oss-0.16.0 → fred_oss-0.18.0}/MANIFEST.in +0 -0
  10. {fred_oss-0.16.0 → fred_oss-0.18.0}/NOTICE.txt +0 -0
  11. {fred_oss-0.16.0 → fred_oss-0.18.0}/README.md +0 -0
  12. {fred_oss-0.16.0 → fred_oss-0.18.0}/requirements.txt +0 -0
  13. {fred_oss-0.16.0 → fred_oss-0.18.0}/setup.cfg +0 -0
  14. {fred_oss-0.16.0 → fred_oss-0.18.0}/setup.py +0 -0
  15. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/cli/__init__.py +0 -0
  16. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/cli/__main__.py +0 -0
  17. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/cli/interface.py +0 -0
  18. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/cli/main.py +0 -0
  19. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/dao/__init__.py +0 -0
  20. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/dao/comp/__init__.py +0 -0
  21. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/dao/comp/_queue.py +0 -0
  22. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/dao/service/__init__.py +0 -0
  23. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/dao/service/_redis.py +0 -0
  24. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/dao/service/interface.py +0 -0
  25. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/dao/service/utils.py +0 -0
  26. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/integrations/databricks/__init__.py +0 -0
  27. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/integrations/databricks/cli_ext.py +0 -0
  28. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/integrations/databricks/runtime.py +0 -0
  29. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/integrations/databricks/runtimes/__init__.py +0 -0
  30. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/integrations/databricks/runtimes/scanner.py +0 -0
  31. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/integrations/databricks/runtimes/sync.py +0 -0
  32. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/integrations/databricks/wrappers/__init__.py +0 -0
  33. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py +0 -0
  34. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/integrations/runpod/__init__.py +0 -0
  35. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/integrations/runpod/cli_ext.py +0 -0
  36. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/integrations/runpod/helper.py +0 -0
  37. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/maturity.py +0 -0
  38. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/settings.py +0 -0
  39. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/utils/__init__.py +0 -0
  40. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/utils/dateops.py +0 -0
  41. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/utils/runtime.py +0 -0
  42. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/version.py +0 -0
  43. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/__init__.py +0 -0
  44. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/interface.py +0 -0
  45. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/__init__.py +0 -0
  46. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/client.py +0 -0
  47. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/handler.py +0 -0
  48. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/info.py +0 -0
  49. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/plugins/__init__.py +0 -0
  50. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/plugins/_local.py +0 -0
  51. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/plugins/catalog.py +0 -0
  52. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/plugins/interface.py +0 -0
  53. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/rest/__init__.py +0 -0
  54. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/rest/cli_ext.py +0 -0
  55. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/rest/routers/__init__.py +0 -0
  56. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/rest/routers/_runner.py +0 -0
  57. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/rest/routers/catalog.py +0 -0
  58. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/rest/routers/interface.py +0 -0
  59. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/rest/server.py +0 -0
  60. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred/worker/runner/utils.py +0 -0
  61. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred_oss.egg-info/SOURCES.txt +0 -0
  62. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred_oss.egg-info/dependency_links.txt +0 -0
  63. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred_oss.egg-info/entry_points.txt +0 -0
  64. {fred_oss-0.16.0 → fred_oss-0.18.0}/src/main/fred_oss.egg-info/requires.txt +0 -0
  65. {fred_oss-0.16.0 → fred_oss-0.18.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.16.0
3
+ Version: 0.18.0
4
4
  Summary: FREDOSS
5
5
  Home-page: https://fred.fahera.mx
6
6
  Author: Fahera Research, Education, and Development
@@ -12,8 +12,9 @@ class FredKeyVal(ComponentInterface):
12
12
  getting, and deleting key-value pairs. The actual implementation of these methods
13
13
  depends on the underlying service being used (e.g., Redis).
14
14
  """
15
+ key: str
15
16
 
16
- def set(self, key: str, value: str, **kwargs) -> None:
17
+ def set(self, value: str, key: Optional[str] = None, **kwargs) -> None:
17
18
  """Sets a key-value pair in the store.
18
19
  The implementation of this method depends on the underlying service.
19
20
  For example, if the service is Redis, it uses the SET command to store the
@@ -26,6 +27,7 @@ class FredKeyVal(ComponentInterface):
26
27
  Raises:
27
28
  NotImplementedError: If the method is not implemented for the current service.
28
29
  """
30
+ key = key or self.key
29
31
  match self._cat:
30
32
  case ServiceCatalog.REDIS:
31
33
  self._srv.client.set(key, value)
@@ -35,7 +37,7 @@ class FredKeyVal(ComponentInterface):
35
37
  case _:
36
38
  raise NotImplementedError(f"Set method not implemented for service {self._nme}")
37
39
 
38
- def get(self, key: str, fail: bool = False) -> Optional[str]:
40
+ def get(self, key: Optional[str] = None, fail: bool = False) -> Optional[str]:
39
41
  """Gets the value associated with a key from the store.
40
42
  The implementation of this method depends on the underlying service.
41
43
  For example, if the service is Redis, it uses the GET command to retrieve the
@@ -50,6 +52,7 @@ class FredKeyVal(ComponentInterface):
50
52
  KeyError: If the key is not found and fail is True.
51
53
  NotImplementedError: If the method is not implemented for the current service.
52
54
  """
55
+ key = key or self.key
53
56
  match self._cat:
54
57
  case ServiceCatalog.REDIS:
55
58
  result = self._srv.client.get(key)
@@ -59,7 +62,7 @@ class FredKeyVal(ComponentInterface):
59
62
  case _:
60
63
  raise NotImplementedError(f"Get method not implemented for service {self._nme}")
61
64
 
62
- def delete(self, key: str) -> None:
65
+ def delete(self, key: Optional[str] = None) -> None:
63
66
  """Deletes a key-value pair from the store.
64
67
  The implementation of this method depends on the underlying service.
65
68
  For example, if the service is Redis, it uses the DEL command to remove the
@@ -69,6 +72,7 @@ class FredKeyVal(ComponentInterface):
69
72
  Raises:
70
73
  NotImplementedError: If the method is not implemented for the current service.
71
74
  """
75
+ key = key or self.key
72
76
  match self._cat:
73
77
  case ServiceCatalog.REDIS:
74
78
  self._srv.client.delete(key)
@@ -2,7 +2,7 @@ import enum
2
2
  from functools import lru_cache
3
3
  from typing import Optional
4
4
 
5
- from fred.dao.comp.interface import ComponentInterface
5
+ from fred.dao.comp.interface import ComponentInterface, SRV_REF_TYPE
6
6
  from fred.dao.comp._queue import FredQueue
7
7
  from fred.dao.comp._keyval import FredKeyVal
8
8
 
@@ -52,7 +52,7 @@ class CompCatalog(enum.Enum):
52
52
 
53
53
  @classmethod
54
54
  @lru_cache(maxsize=None) # TODO: Consider cache invalidation strategy if needed
55
- def preconf(cls, srv_name: str, **kwargs) -> enum.Enum:
55
+ def preconf(cls, srv_ref: SRV_REF_TYPE, **kwargs) -> enum.Enum:
56
56
  """Create a new Enum with preconfigured components for a specific service name.
57
57
  Args:
58
58
  srv_name (str): The service name to preconfigure the components with.
@@ -60,9 +60,21 @@ class CompCatalog(enum.Enum):
60
60
  Returns:
61
61
  enum.Enum: A new Enum class with preconfigured components.
62
62
  """
63
+ from fred.dao.service.interface import ServiceInterface
64
+ from fred.dao.service.catalog import ServiceCatalog
65
+ srv_name = ""
66
+ match srv_ref:
67
+ case str() as name:
68
+ srv_name = name.title()
69
+ case ServiceCatalog() as cat:
70
+ srv_name = cat.name.title()
71
+ case ServiceInterface() as instance:
72
+ srv_name = ServiceCatalog.from_classname(instance.__class__.__name__).name.title()
73
+ case _:
74
+ raise ValueError(f"Invalid service '{srv_ref}' type: {type(srv_ref)}")
63
75
  return enum.Enum(
64
76
  f"{srv_name.title()}{cls.__name__}",
65
- {item.name: item.value.mount(srv_name=srv_name, **kwargs) for item in cls},
77
+ {item.name: item.value.mount(srv_ref=srv_ref, **kwargs) for item in cls},
66
78
  type=_PreconfCatalogMixin,
67
79
  )
68
80
 
@@ -73,12 +85,12 @@ class CompCatalog(enum.Enum):
73
85
  """
74
86
  return self.value
75
87
 
76
- def auto(self, srv_name: Optional[str] = None, **kwargs) -> ComponentInterface:
88
+ def auto(self, srv_ref: Optional[SRV_REF_TYPE] = None, **kwargs) -> ComponentInterface:
77
89
  """Automatically creates an instance of the component, mounting it to a service.
78
90
  This method is a convenience wrapper that first mounts the component to a service
79
91
  and then creates an instance of the component.
80
92
  Args:
81
- srv_name (Optional[str]): The name of the service to mount. Defaults to None.
93
+ srv_ref (Optional[SRV_REF_TYPE]): The service reference to mount the component to.
82
94
  **kwargs: Additional keyword arguments for both mounting the service and
83
95
  creating the component instance. If there are specific arguments
84
96
  for the service, they should be passed under the key `srv_kwargs`
@@ -86,4 +98,5 @@ class CompCatalog(enum.Enum):
86
98
  Returns:
87
99
  ComponentInterface: An instance of the component.
88
100
  """
89
- return self.value.auto(srv_name=srv_name, **kwargs)
101
+ srv_ref = srv_ref or kwargs.pop("srv_name", None) # Backward compatibility
102
+ return self.value.auto(srv_ref=srv_ref, **kwargs)
@@ -2,12 +2,14 @@ from typing import Optional
2
2
  from fred.dao.service.interface import ServiceInterface
3
3
  from fred.dao.service.catalog import ServiceCatalog
4
4
 
5
+ SRV_REF_TYPE = str | ServiceInterface | ServiceCatalog
6
+
5
7
 
6
8
  class SrvCompanionMixin:
7
9
  _srv: ServiceInterface
8
10
 
9
11
  @classmethod
10
- def _set_srv(cls, name: Optional[str] = None, **kwargs):
12
+ def _set_srv(cls, srv_ref: Optional[SRV_REF_TYPE] = None, **kwargs):
11
13
  """Sets the service instance for the component class.
12
14
  This method initializes the `_srv` class variable with an instance
13
15
  of the service specified by `name` and any additional parameters passed via `kwargs`.
@@ -15,7 +17,15 @@ class SrvCompanionMixin:
15
17
  name (Optional[str]): The name of the service to set. Defaults to "REDIS".
16
18
  **kwargs: Additional keyword arguments to configure the service instance.
17
19
  """
18
- cls._srv = ServiceCatalog[(name or "REDIS").upper()].auto(**kwargs)
20
+ match (srv_ref or "REDIS"):
21
+ case str() as name:
22
+ cls._srv = ServiceCatalog[name.upper()].auto(**kwargs)
23
+ case ServiceCatalog() as cat:
24
+ cls._srv = cat.auto(**kwargs)
25
+ case ServiceInterface() as instance:
26
+ cls._srv = instance
27
+ case _:
28
+ raise ValueError(f"Invalid service '{srv_ref}' type: {type(srv_ref)}")
19
29
 
20
30
  @property
21
31
  def _nme(self) -> str:
@@ -31,7 +41,7 @@ class SrvCompanionMixin:
31
41
  class ComponentInterface(SrvCompanionMixin):
32
42
 
33
43
  @classmethod
34
- def mount(cls, srv_name: Optional[str] = None, **kwargs) -> type["ComponentInterface"]:
44
+ def mount(cls, srv_ref: Optional[SRV_REF_TYPE] = None, **kwargs) -> type["ComponentInterface"]:
35
45
  """Mounts the component to a specific service instance.
36
46
  This method configures the component to use a service instance
37
47
  identified by `srv_name` and any additional parameters passed via `kwargs`.
@@ -40,11 +50,11 @@ class ComponentInterface(SrvCompanionMixin):
40
50
  srv_name (Optional[str]): The name of the service to mount. Defaults to "REDIS".
41
51
  **kwargs: Additional keyword arguments to configure the service instance.
42
52
  """
43
- cls._set_srv(name=srv_name, **kwargs)
53
+ cls._set_srv(srv_ref=srv_ref, **kwargs)
44
54
  return cls
45
55
 
46
56
  @classmethod
47
- def auto(cls, srv_name: Optional[str] = None, **kwargs) -> "ComponentInterface":
57
+ def auto(cls, srv_ref: Optional[SRV_REF_TYPE] = None, **kwargs) -> "ComponentInterface":
48
58
  """Automatically creates an instance of the component, mounting it to a service.
49
59
  This method is a convenience wrapper that first mounts the component to a service
50
60
  and then creates an instance of the component.
@@ -56,4 +66,4 @@ class ComponentInterface(SrvCompanionMixin):
56
66
  as a dictionary.
57
67
  """
58
68
  srv_kwargs = kwargs.pop("srv_kwargs", {})
59
- return cls.mount(srv_name=srv_name, **srv_kwargs)(**kwargs)
69
+ return cls.mount(srv_ref=srv_ref, **srv_kwargs)(**kwargs)
@@ -1,9 +1,12 @@
1
1
  import enum
2
2
  from functools import lru_cache
3
+ from typing import TypeVar, Optional
3
4
 
4
5
  from fred.dao.service.interface import ServiceInterface
5
6
  from fred.dao.service._redis import RedisService
6
7
 
8
+ T = TypeVar("T")
9
+
7
10
 
8
11
  class ServiceCatalog(enum.Enum):
9
12
  REDIS = RedisService
@@ -16,7 +19,7 @@ class ServiceCatalog(enum.Enum):
16
19
  raise ValueError(f"No service found for classname: {classname}")
17
20
 
18
21
  @lru_cache(maxsize=None) # TODO: Consider cache invalidation strategy if needed
19
- def component_catalog(self, **kwargs) -> enum.Enum:
22
+ def component_catalog(self, srv_ref: Optional[str | ServiceInterface] = None, **kwargs) -> enum.Enum:
20
23
  """Get a preconfigured component catalog for this (self) service.
21
24
  This method returns a new Enum with preconfigured components for the
22
25
  service represented by this enum member.
@@ -27,10 +30,10 @@ class ServiceCatalog(enum.Enum):
27
30
  """
28
31
  from fred.dao.comp.catalog import CompCatalog # Avoid circular import
29
32
 
30
- return CompCatalog.preconf(srv_name=self.name, **kwargs)
33
+ return CompCatalog.preconf(srv_ref=srv_ref or self.name, **kwargs)
31
34
 
32
35
  def service_cls(self) -> type[ServiceInterface]:
33
36
  return self.value
34
37
 
35
- def auto(self, **kwargs) -> ServiceInterface:
38
+ def auto(self, **kwargs) -> ServiceInterface[T]:
36
39
  return self.value.auto(**kwargs)
@@ -0,0 +1 @@
1
+ 0.18.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fred-oss
3
- Version: 0.16.0
3
+ Version: 0.18.0
4
4
  Summary: FREDOSS
5
5
  Home-page: https://fred.fahera.mx
6
6
  Author: Fahera Research, Education, and Development
@@ -1 +0,0 @@
1
- 0.16.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes