fxn 0.0.38__tar.gz → 0.0.39__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 (49) hide show
  1. {fxn-0.0.38 → fxn-0.0.39}/PKG-INFO +1 -1
  2. {fxn-0.0.38 → fxn-0.0.39}/fxn/services/prediction.py +9 -14
  3. {fxn-0.0.38 → fxn-0.0.39}/fxn/version.py +1 -1
  4. {fxn-0.0.38 → fxn-0.0.39}/fxn.egg-info/PKG-INFO +1 -1
  5. {fxn-0.0.38 → fxn-0.0.39}/LICENSE +0 -0
  6. {fxn-0.0.38 → fxn-0.0.39}/README.md +0 -0
  7. {fxn-0.0.38 → fxn-0.0.39}/fxn/__init__.py +0 -0
  8. {fxn-0.0.38 → fxn-0.0.39}/fxn/api/__init__.py +0 -0
  9. {fxn-0.0.38 → fxn-0.0.39}/fxn/api/client.py +0 -0
  10. {fxn-0.0.38 → fxn-0.0.39}/fxn/c/__init__.py +0 -0
  11. {fxn-0.0.38 → fxn-0.0.39}/fxn/c/configuration.py +0 -0
  12. {fxn-0.0.38 → fxn-0.0.39}/fxn/c/dtype.py +0 -0
  13. {fxn-0.0.38 → fxn-0.0.39}/fxn/c/fxnc.py +0 -0
  14. {fxn-0.0.38 → fxn-0.0.39}/fxn/c/map.py +0 -0
  15. {fxn-0.0.38 → fxn-0.0.39}/fxn/c/prediction.py +0 -0
  16. {fxn-0.0.38 → fxn-0.0.39}/fxn/c/predictor.py +0 -0
  17. {fxn-0.0.38 → fxn-0.0.39}/fxn/c/status.py +0 -0
  18. {fxn-0.0.38 → fxn-0.0.39}/fxn/c/stream.py +0 -0
  19. {fxn-0.0.38 → fxn-0.0.39}/fxn/c/value.py +0 -0
  20. {fxn-0.0.38 → fxn-0.0.39}/fxn/c/version.py +0 -0
  21. {fxn-0.0.38 → fxn-0.0.39}/fxn/cli/__init__.py +0 -0
  22. {fxn-0.0.38 → fxn-0.0.39}/fxn/cli/auth.py +0 -0
  23. {fxn-0.0.38 → fxn-0.0.39}/fxn/cli/env.py +0 -0
  24. {fxn-0.0.38 → fxn-0.0.39}/fxn/cli/misc.py +0 -0
  25. {fxn-0.0.38 → fxn-0.0.39}/fxn/cli/predict.py +0 -0
  26. {fxn-0.0.38 → fxn-0.0.39}/fxn/cli/predictors.py +0 -0
  27. {fxn-0.0.38 → fxn-0.0.39}/fxn/function.py +0 -0
  28. {fxn-0.0.38 → fxn-0.0.39}/fxn/lib/__init__.py +0 -0
  29. {fxn-0.0.38 → fxn-0.0.39}/fxn/lib/linux/arm64/libFunction.so +0 -0
  30. {fxn-0.0.38 → fxn-0.0.39}/fxn/lib/linux/x86_64/libFunction.so +0 -0
  31. {fxn-0.0.38 → fxn-0.0.39}/fxn/lib/macos/arm64/Function.dylib +0 -0
  32. {fxn-0.0.38 → fxn-0.0.39}/fxn/lib/macos/x86_64/Function.dylib +0 -0
  33. {fxn-0.0.38 → fxn-0.0.39}/fxn/lib/windows/arm64/Function.dll +0 -0
  34. {fxn-0.0.38 → fxn-0.0.39}/fxn/lib/windows/x86_64/Function.dll +0 -0
  35. {fxn-0.0.38 → fxn-0.0.39}/fxn/services/__init__.py +0 -0
  36. {fxn-0.0.38 → fxn-0.0.39}/fxn/services/predictor.py +0 -0
  37. {fxn-0.0.38 → fxn-0.0.39}/fxn/services/user.py +0 -0
  38. {fxn-0.0.38 → fxn-0.0.39}/fxn/types/__init__.py +0 -0
  39. {fxn-0.0.38 → fxn-0.0.39}/fxn/types/dtype.py +0 -0
  40. {fxn-0.0.38 → fxn-0.0.39}/fxn/types/prediction.py +0 -0
  41. {fxn-0.0.38 → fxn-0.0.39}/fxn/types/predictor.py +0 -0
  42. {fxn-0.0.38 → fxn-0.0.39}/fxn/types/user.py +0 -0
  43. {fxn-0.0.38 → fxn-0.0.39}/fxn.egg-info/SOURCES.txt +0 -0
  44. {fxn-0.0.38 → fxn-0.0.39}/fxn.egg-info/dependency_links.txt +0 -0
  45. {fxn-0.0.38 → fxn-0.0.39}/fxn.egg-info/entry_points.txt +0 -0
  46. {fxn-0.0.38 → fxn-0.0.39}/fxn.egg-info/requires.txt +0 -0
  47. {fxn-0.0.38 → fxn-0.0.39}/fxn.egg-info/top_level.txt +0 -0
  48. {fxn-0.0.38 → fxn-0.0.39}/pyproject.toml +0 -0
  49. {fxn-0.0.38 → fxn-0.0.39}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fxn
3
- Version: 0.0.38
3
+ Version: 0.0.39
4
4
  Summary: Run prediction functions locally in Python. Register at https://fxn.ai.
5
5
  Author-email: "NatML Inc." <hi@fxn.ai>
6
6
  License: Apache License
@@ -31,6 +31,8 @@ class PredictionService:
31
31
  self.client = client
32
32
  self.__fxnc = PredictionService.__load_fxnc()
33
33
  self.__cache = { }
34
+ self.__cache_dir = self.__class__.__get_resource_dir() / ".fxn" / "cache"
35
+ self.__cache_dir.mkdir(exist_ok=True)
34
36
 
35
37
  def create (
36
38
  self,
@@ -89,7 +91,7 @@ class PredictionService:
89
91
  self,
90
92
  tag: str,
91
93
  *,
92
- inputs: Dict[str, Union[float, int, str, bool, NDArray, List[Any], Dict[str, Any], Path, Image.Image]] = {},
94
+ inputs: Dict[str, float | int | str | bool | NDArray | List[Any] | Dict[str, Any] | Path | Image.Image] = {},
93
95
  acceleration: Acceleration=Acceleration.Default,
94
96
  client_id: str=None,
95
97
  configuration_id: str=None
@@ -127,12 +129,12 @@ class PredictionService:
127
129
  yield prediction
128
130
 
129
131
  @classmethod
130
- def __load_fxnc (self) -> Optional[CDLL]:
132
+ def __load_fxnc (cls) -> Optional[CDLL]:
131
133
  os = system().lower()
132
134
  os = "macos" if os == "darwin" else os
133
- arch = machine()
135
+ arch = machine().lower()
134
136
  arch = "arm64" if arch == "aarch64" else arch
135
- arch = "x86_64" if arch == "x64" else arch
137
+ arch = "x86_64" if arch in ["x64", "amd64"] else arch
136
138
  package = f"fxn.lib.{os}.{arch}"
137
139
  resource = "libFunction.so"
138
140
  resource = "Function.dylib" if os == "macos" else resource
@@ -141,11 +143,6 @@ class PredictionService:
141
143
  return load_fxnc(fxnc_path)
142
144
 
143
145
  def __get_client_id (self) -> str:
144
- # Fallback if fxnc failed to load
145
- if not self.__fxnc:
146
- os = system().lower()
147
- os = "macos" if os == "darwin" else os
148
- return f"{os}-{machine()}"
149
146
  # Get
150
147
  buffer = create_string_buffer(64)
151
148
  status = self.__fxnc.FXNConfigurationGetClientID(buffer, len(buffer))
@@ -278,7 +275,7 @@ class PredictionService:
278
275
 
279
276
  def __to_value (
280
277
  self,
281
- value: Union[float, int, bool, str, NDArray, List[Any], Dict[str, Any], Image.Image, bytes, bytearray, memoryview, BytesIO, None]
278
+ value: float | int | bool | str | NDArray | List[Any] | Dict[str, Any] | Image.Image | bytes | bytearray | memoryview | BytesIO | None
282
279
  ) -> type[FXNValueRef]:
283
280
  value = PredictionService.__try_ensure_serializable(value)
284
281
  fxnc = self.__fxnc
@@ -336,7 +333,7 @@ class PredictionService:
336
333
  def __to_object (
337
334
  self,
338
335
  value: type[FXNValueRef]
339
- ) -> Union[float, int, bool, str, NDArray, List[Any], Dict[str, Any], Image.Image, BytesIO, None]:
336
+ ) -> float | int | bool | str | NDArray | List[Any] | Dict[str, Any] | Image.Image | BytesIO | None:
340
337
  # Type
341
338
  fxnc = self.__fxnc
342
339
  dtype = FXNDtype()
@@ -376,10 +373,8 @@ class PredictionService:
376
373
  raise RuntimeError(f"Failed to convert Function value to Python value because Function value has unsupported type: {dtype}")
377
374
 
378
375
  def __get_resource_path (self, resource: PredictionResource) -> Path:
379
- cache_dir = self.__class__.__get_resource_dir() / ".fxn" / "cache"
380
- cache_dir.mkdir(exist_ok=True)
381
376
  res_name = Path(urlparse(resource.url).path).name
382
- res_path = cache_dir / res_name
377
+ res_path = self.__cache_dir / res_name
383
378
  if res_path.exists():
384
379
  return res_path
385
380
  req = get(resource.url)
@@ -3,4 +3,4 @@
3
3
  # Copyright © 2024 NatML Inc. All Rights Reserved.
4
4
  #
5
5
 
6
- __version__ = "0.0.38"
6
+ __version__ = "0.0.39"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fxn
3
- Version: 0.0.38
3
+ Version: 0.0.39
4
4
  Summary: Run prediction functions locally in Python. Register at https://fxn.ai.
5
5
  Author-email: "NatML Inc." <hi@fxn.ai>
6
6
  License: Apache License
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