fxn 0.0.39__py3-none-any.whl → 0.0.41__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.
fxn/services/predictor.py CHANGED
@@ -3,15 +3,12 @@
3
3
  # Copyright © 2024 NatML Inc. All Rights Reserved.
4
4
  #
5
5
 
6
- from typing import List
7
-
8
- from ..api import GraphClient
9
- from ..types import Predictor, PredictorStatus
10
- from .user import PROFILE_FIELDS
6
+ from ..client import FunctionClient, FunctionAPIError
7
+ from ..types import Predictor
11
8
 
12
9
  class PredictorService:
13
10
 
14
- def __init__ (self, client: GraphClient) -> None:
11
+ def __init__ (self, client: FunctionClient) -> None:
15
12
  self.client = client
16
13
 
17
14
  def retrieve (self, tag: str) -> Predictor:
@@ -24,183 +21,10 @@ class PredictorService:
24
21
  Returns:
25
22
  Predictor: Predictor.
26
23
  """
27
- # Query
28
- response = self.client.query(f"""
29
- query ($input: PredictorInput!) {{
30
- predictor (input: $input) {{
31
- {PREDICTOR_FIELDS}
32
- }}
33
- }}
34
- """,
35
- { "input": { "tag": tag } }
36
- )
37
- # Create predictor
38
- predictor = response["predictor"]
39
- predictor = Predictor(**predictor) if predictor else None
40
- # Return
41
- return predictor
42
-
43
- def list (
44
- self,
45
- owner: str=None,
46
- status: PredictorStatus=None,
47
- offset: int=None,
48
- count: int=None
49
- ) -> List[Predictor]:
50
- """
51
- List the current user's predictors.
52
-
53
- Parameters:
54
- owner (str): Predictor owner. This defaults to the current user.
55
- status (PredictorStatus): Predictor status. This defaults to `ACTIVE`.
56
- offset (int): Pagination offset.
57
- count (int): Pagination count.
58
-
59
- Returns:
60
- list: User predictors.
61
- """
62
- # Query
63
- response = self.client.query(f"""
64
- query ($user: UserInput, $predictors: UserPredictorsInput) {{
65
- user (input: $user) {{
66
- predictors (input: $predictors) {{
67
- {PREDICTOR_FIELDS}
68
- }}
69
- }}
70
- }}
71
- """,
72
- {
73
- "user": { "username": owner } if owner else None,
74
- "predictors": { "status": status, "offset": offset, "count": count }
75
- }
76
- )
77
- # Check
78
- user = response["user"]
79
- if not user:
80
- return None
81
- # Create predictors
82
- predictors = response["user"]["predictors"]
83
- predictors = [Predictor(**predictor) for predictor in predictors]
84
- # Return
85
- return predictors
86
-
87
- def search (
88
- self,
89
- query: str,
90
- offset: int=None,
91
- count: int=None
92
- ) -> List[Predictor]:
93
- """
94
- Search predictors.
95
-
96
- Parameters:
97
- q (str): Search query.
98
- offset (int): Pagination offset.
99
- count (int): Pagination count.
100
-
101
- Returns:
102
- list: Relevant predictors.
103
- """
104
- # Query
105
- response = self.client.query(f"""
106
- query ($input: PredictorsInput!) {{
107
- predictors (input: $input) {{
108
- {PREDICTOR_FIELDS}
109
- }}
110
- }}
111
- """,
112
- { "input": { "query": query, "offset": offset, "count": count } }
113
- )
114
- # Create predictors
115
- predictors = response["predictors"]
116
- predictors = [Predictor(**predictor) for predictor in predictors]
117
- # Return
118
- return predictors
119
-
120
- def delete (self, tag: str) -> bool:
121
- """
122
- Delete a predictor.
123
-
124
- Parameters:
125
- tag (str): Predictor tag.
126
-
127
- Returns:
128
- bool: Whether the predictor was successfully deleted.
129
- """
130
- # Query
131
- response = self.client.query(f"""
132
- mutation ($input: DeletePredictorInput!) {{
133
- deletePredictor (input: $input)
134
- }}
135
- """,
136
- { "input": { "tag": tag } }
137
- )
138
- # Return
139
- result = response["deletePredictor"]
140
- return result
141
-
142
- def archive (self, tag: str) -> Predictor:
143
- """
144
- Archive an active predictor.
145
-
146
- Parameters:
147
- tag (str): Predictor tag.
148
-
149
- Returns:
150
- Predictor: Archived predictor.
151
- """
152
- # Query
153
- response = self.client.query(f"""
154
- mutation ($input: ArchivePredictorInput!) {{
155
- archivePredictor (input: $input) {{
156
- {PREDICTOR_FIELDS}
157
- }}
158
- }}
159
- """,
160
- { "input": { "tag": tag } }
161
- )
162
- # Create predictor
163
- predictor = response["archivePredictor"]
164
- predictor = Predictor(**predictor) if predictor else None
165
- # Return
166
- return predictor
167
-
168
-
169
- PREDICTOR_FIELDS = f"""
170
- tag
171
- owner {{
172
- {PROFILE_FIELDS}
173
- }}
174
- name
175
- status
176
- access
177
- created
178
- description
179
- card
180
- media
181
- signature {{
182
- inputs {{
183
- name
184
- type
185
- description
186
- range
187
- optional
188
- enumeration {{
189
- name
190
- value
191
- }}
192
- default_value: defaultValue {{
193
- data
194
- type
195
- shape
196
- }}
197
- schema
198
- }}
199
- outputs {{
200
- name
201
- type
202
- description
203
- }}
204
- }}
205
- license
206
- """
24
+ try:
25
+ predictor = self.client.request(method="GET", path=f"/predictors/{tag}")
26
+ return Predictor(**predictor)
27
+ except FunctionAPIError as error:
28
+ if error.status_code == 404:
29
+ return None
30
+ raise
fxn/services/user.py CHANGED
@@ -3,54 +3,25 @@
3
3
  # Copyright © 2024 NatML Inc. All Rights Reserved.
4
4
  #
5
5
 
6
- from ..api import GraphClient
7
- from ..types import Profile
6
+ from ..client import FunctionClient, FunctionAPIError
7
+ from ..types import User
8
8
 
9
9
  class UserService:
10
10
 
11
- def __init__ (self, client: GraphClient) -> None:
11
+ def __init__ (self, client: FunctionClient) -> None:
12
12
  self.client = client
13
13
 
14
- def retrieve (self, username: str=None) -> Profile:
14
+ def retrieve (self) -> User:
15
15
  """
16
- Retrieve a user.
17
-
18
- Parameters:
19
- username (str): Username. If `None`, this will retrieve the currently authenticated user.
20
- access_key (str): Function access key.
16
+ Retrieve the current user.
21
17
 
22
18
  Returns:
23
19
  User: User.
24
20
  """
25
- # Query
26
- response = self.client.query(f"""
27
- query {"($input: UserInput)" if username else ""} {{
28
- user {"(input: $input)" if username else ""} {{
29
- {PROFILE_FIELDS}
30
- {USER_FIELDS if not username else ""}
31
- }}
32
- }}
33
- """,
34
- { "input": { "username": username } },
35
- )
36
- # Create user
37
- user = response["user"]
38
- user = Profile(**user) if user else None
39
- # Return
40
- return user
41
-
42
- PROFILE_FIELDS = f"""
43
- username
44
- created
45
- name
46
- avatar
47
- bio
48
- website
49
- github
50
- """
51
-
52
- USER_FIELDS = f"""
53
- ... on User {{
54
- email
55
- }}
56
- """
21
+ try:
22
+ user = self.client.request(method="GET", path="/users")
23
+ return User(**user)
24
+ except FunctionAPIError as error:
25
+ if error.status_code == 401:
26
+ return None
27
+ raise
fxn/types/__init__.py CHANGED
@@ -6,4 +6,4 @@
6
6
  from .dtype import Dtype
7
7
  from .prediction import Prediction, PredictionResource
8
8
  from .predictor import Acceleration, AccessMode, EnumerationMember, Parameter, Predictor, PredictorStatus, Signature
9
- from .user import Profile, User
9
+ from .user import User
fxn/types/prediction.py CHANGED
@@ -4,7 +4,7 @@
4
4
  #
5
5
 
6
6
  from pydantic import BaseModel, Field
7
- from typing import Any, List, Optional
7
+ from typing import Any
8
8
 
9
9
  class PredictionResource (BaseModel):
10
10
  """
@@ -17,7 +17,7 @@ class PredictionResource (BaseModel):
17
17
  """
18
18
  type: str = Field(description="Resource type.")
19
19
  url: str = Field(description="Resource URL.")
20
- name: Optional[str] = Field(default=None, description="Resource name.")
20
+ name: str | None = Field(default=None, description="Resource name.")
21
21
 
22
22
  class Prediction (BaseModel):
23
23
  """
@@ -36,10 +36,10 @@ class Prediction (BaseModel):
36
36
  """
37
37
  id: str = Field(description="Prediction identifier.")
38
38
  tag: str = Field(description="Predictor tag.")
39
- configuration: Optional[str] = Field(default=None, description="Prediction configuration token. This is only populated for `EDGE` predictions.")
40
- resources: Optional[List[PredictionResource]] = Field(default=None, description="Prediction resources. This is only populated for `EDGE` predictions.")
41
- results: Optional[List[Any]] = Field(default=None, description="Prediction results.")
42
- latency: Optional[float] = Field(default=None, description="Prediction latency in milliseconds.")
43
- error: Optional[str] = Field(default=None, description="Prediction error. This is `None` if the prediction completed successfully.")
44
- logs: Optional[str] = Field(default=None, description="Prediction logs.")
39
+ configuration: str | None = Field(default=None, description="Prediction configuration token. This is only populated for `EDGE` predictions.")
40
+ resources: list[PredictionResource] | None = Field(default=None, description="Prediction resources. This is only populated for `EDGE` predictions.")
41
+ results: list[Any] | None = Field(default=None, description="Prediction results.")
42
+ latency: float | None = Field(default=None, description="Prediction latency in milliseconds.")
43
+ error: str | None = Field(default=None, description="Prediction error. This is `None` if the prediction completed successfully.")
44
+ logs: str | None = Field(default=None, description="Prediction logs.")
45
45
  created: str = Field(description="Date created.")
fxn/types/predictor.py CHANGED
@@ -4,20 +4,17 @@
4
4
  #
5
5
 
6
6
  from enum import Enum, IntFlag
7
- from io import BytesIO
8
- from numpy.typing import NDArray
9
- from PIL import Image
10
7
  from pydantic import AliasChoices, BaseModel, ConfigDict, Field
11
- from typing import Any, Dict, List, Optional, Tuple
8
+ from typing import Any
12
9
 
13
10
  from .dtype import Dtype
14
- from .user import Profile
11
+ from .user import User
15
12
 
16
13
  class Acceleration (IntFlag):
17
14
  """
18
15
  Predictor acceleration.
19
16
  """
20
- Default = 0,
17
+ Auto = 0,
21
18
  CPU = 1 << 0,
22
19
  GPU = 1 << 1,
23
20
  NPU = 1 << 2
@@ -64,13 +61,13 @@ class Parameter (BaseModel):
64
61
  value_schema (dict): Parameter JSON schema. This is only populated for `list` and `dict` parameters.
65
62
  """
66
63
  name: str = Field(description="Parameter name.")
67
- type: Optional[Dtype] = Field(default=None, description="Parameter type. This is `None` if the type is unknown or unsupported by Function.")
68
- description: Optional[str] = Field(default=None, description="Parameter description.")
69
- optional: Optional[bool] = Field(default=None, description="Whether the parameter is optional.")
70
- range: Optional[Tuple[float, float]] = Field(default=None, description="Parameter value range for numeric parameters.")
71
- enumeration: Optional[List[EnumerationMember]] = Field(default=None, description="Parameter value choices for enumeration parameters.")
72
- default_value: Optional[str | float | int | bool | NDArray | List[Any] | Dict[str, Any] | Image.Image | BytesIO] = Field(default=None, description="Parameter default value.", serialization_alias="defaultValue", validation_alias=AliasChoices("default_value", "defaultValue"))
73
- value_schema: Optional[dict] = Field(default=None, description="Parameter JSON schema. This is only populated for `list` and `dict` parameters.", serialization_alias="schema", validation_alias=AliasChoices("schema", "value_schema"))
64
+ type: Dtype | None = Field(default=None, description="Parameter type. This is `None` if the type is unknown or unsupported by Function.")
65
+ description: str | None = Field(default=None, description="Parameter description.")
66
+ optional: bool | None = Field(default=None, description="Whether the parameter is optional.")
67
+ range: tuple[float, float] | None = Field(default=None, description="Parameter value range for numeric parameters.")
68
+ enumeration: list[EnumerationMember] | None = Field(default=None, description="Parameter value choices for enumeration parameters.")
69
+ default_value: str | float | int | bool | list[Any] | dict[str, Any] | None = Field(default=None, description="Parameter default value.", serialization_alias="defaultValue", validation_alias=AliasChoices("default_value", "defaultValue"))
70
+ value_schema: dict[str, Any] | None = Field(default=None, description="Parameter JSON schema. This is only populated for `list` and `dict` parameters.", serialization_alias="schema", validation_alias=AliasChoices("schema", "value_schema"))
74
71
  model_config = ConfigDict(arbitrary_types_allowed=True)
75
72
 
76
73
  class Signature (BaseModel):
@@ -81,8 +78,8 @@ class Signature (BaseModel):
81
78
  inputs (list): Input parameters.
82
79
  outputs (list): Output parameters.
83
80
  """
84
- inputs: List[Parameter] = Field(description="Input parameters.")
85
- outputs: List[Parameter] = Field(description="Output parameters.")
81
+ inputs: list[Parameter] = Field(description="Input parameters.")
82
+ outputs: list[Parameter] = Field(description="Output parameters.")
86
83
 
87
84
  class Predictor (BaseModel):
88
85
  """
@@ -90,7 +87,7 @@ class Predictor (BaseModel):
90
87
 
91
88
  Members:
92
89
  tag (str): Predictor tag.
93
- owner (Profile): Predictor owner.
90
+ owner (User): Predictor owner.
94
91
  name (str): Predictor name.
95
92
  status (PredictorStatus): Predictor status.
96
93
  access (AccessMode): Predictor access.
@@ -102,13 +99,13 @@ class Predictor (BaseModel):
102
99
  license (str): Predictor license URL.
103
100
  """
104
101
  tag: str = Field(description="Predictor tag.")
105
- owner: Profile = Field(description="Predictor owner.")
102
+ owner: User = Field(description="Predictor owner.")
106
103
  name: str = Field(description="Predictor name.")
107
104
  status: PredictorStatus = Field(description="Predictor status.")
108
105
  access: AccessMode = Field(description="Predictor access.")
109
106
  signature: Signature = Field(description="Predictor signature.")
110
107
  created: str = Field(description="Date created.")
111
- description: Optional[str] = Field(default=None, description="Predictor description.")
112
- card: Optional[str] = Field(default=None, description="Predictor card.")
113
- media: Optional[str] = Field(default=None, description="Predictor media URL.")
114
- license: Optional[str] = Field(default=None, description="Predictor license URL.")
108
+ description: str | None = Field(default=None, description="Predictor description.")
109
+ card: str | None = Field(default=None, description="Predictor card.")
110
+ media: str | None = Field(default=None, description="Predictor media URL.")
111
+ license: str | None = Field(default=None, description="Predictor license URL.")
fxn/types/user.py CHANGED
@@ -4,9 +4,8 @@
4
4
  #
5
5
 
6
6
  from pydantic import BaseModel, Field
7
- from typing import Optional
8
7
 
9
- class Profile (BaseModel):
8
+ class User (BaseModel):
10
9
  """
11
10
  Function user profile.
12
11
 
@@ -21,15 +20,10 @@ class Profile (BaseModel):
21
20
  github (str): User GitHub handle.
22
21
  """
23
22
  username: str = Field(description="Username.")
24
- email: Optional[str] = Field(default=None, description="User email address.")
25
- created: Optional[str] = Field(default=None, description="Date created.")
26
- name: Optional[str] = Field(default=None, description="User display name.")
27
- avatar: Optional[str] = Field(default=None, description="User avatar URL.")
28
- bio: Optional[str] = Field(default=None, description="User bio.")
29
- website: Optional[str] = Field(default=None, description="User website.")
30
- github: Optional[str] = Field(default=None, description="User GitHub handle.")
31
-
32
- class User (Profile):
33
- """
34
- User.
35
- """
23
+ email: str | None = Field(default=None, description="User email address.")
24
+ created: str | None = Field(default=None, description="Date created.")
25
+ name: str | None = Field(default=None, description="User display name.")
26
+ avatar: str | None = Field(default=None, description="User avatar URL.")
27
+ bio: str | None = Field(default=None, description="User bio.")
28
+ website: str | None = Field(default=None, description="User website.")
29
+ github: str | None = Field(default=None, description="User GitHub handle.")
fxn/version.py CHANGED
@@ -3,4 +3,4 @@
3
3
  # Copyright © 2024 NatML Inc. All Rights Reserved.
4
4
  #
5
5
 
6
- __version__ = "0.0.39"
6
+ __version__ = "0.0.41"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fxn
3
- Version: 0.0.39
3
+ Version: 0.0.41
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
@@ -227,9 +227,12 @@ Requires-Dist: typer
227
227
 
228
228
  ![function logo](https://raw.githubusercontent.com/fxnai/.github/main/logo_wide.png)
229
229
 
230
- [![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fdiscord.com%2Fapi%2Finvites%2Fy5vwgXkz2f%3Fwith_counts%3Dtrue&query=%24.approximate_member_count&logo=discord&logoColor=white&label=Function%20community)](https://fxn.ai/community)
230
+ [![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fdiscord.com%2Fapi%2Finvites%2Fy5vwgXkz2f%3Fwith_counts%3Dtrue&query=%24.approximate_member_count&logo=discord&logoColor=white&label=Function%20community)](https://discord.gg/fxn)
231
231
 
232
- Run prediction functions (a.k.a "predictors") locally in your Python apps, with full GPU acceleration and zero dependencies. In a few steps:
232
+ Run prediction functions (a.k.a "predictors") locally in your Python apps, with full GPU acceleration and zero dependencies.
233
+
234
+ > [!TIP]
235
+ > [Join our waitlist](https://fxn.ai/waitlist) to bring your custom Python functions and run them on-device across Android, iOS, macOS, Linux, web, and Windows.
233
236
 
234
237
  ## Installing Function
235
238
  Function is distributed on PyPi. This distribution contains both the Python client and the command line interface (CLI). To install, open a terminal and run the following command:
@@ -266,9 +269,6 @@ prediction = fxn.predictions.create(
266
269
  print(prediction.results[0])
267
270
  ```
268
271
 
269
- > [!TIP]
270
- > Explore public predictors [on Function](https://fxn.ai/explore) or [create your own](https://fxn.ai/waitlist).
271
-
272
272
  ## Using the Function CLI
273
273
  Open up a terminal and login to the Function CLI:
274
274
  ```sh
@@ -286,7 +286,7 @@ ___
286
286
 
287
287
  ## Useful Links
288
288
  - [Discover predictors to use in your apps](https://fxn.ai/explore).
289
- - [Join our Discord community](https://fxn.ai/community).
289
+ - [Join our Discord community](https://discord.gg/fxn).
290
290
  - [Check out our docs](https://docs.fxn.ai).
291
291
  - Learn more about us [on our blog](https://blog.fxn.ai).
292
292
  - Reach out to us at [hi@fxn.ai](mailto:hi@fxn.ai).
@@ -0,0 +1,40 @@
1
+ fxn/__init__.py,sha256=m-QwB7uabrzgfPnV4wBCeSUWjPvAm_BxnnX1G-c2sb8,147
2
+ fxn/client.py,sha256=iaYIOGp07BTU-W-FVU_Yb_4WIZsNw1QFgWSKECDcsGU,1374
3
+ fxn/function.py,sha256=WzzFLB_VqPm8_215I2v5ITPomf8q96livLp61Tmcg_4,1177
4
+ fxn/version.py,sha256=WQaOoMKgcYspjf5R487cSi99hblr_DHr8_ObYh6SkKE,95
5
+ fxn/c/__init__.py,sha256=PZHQUxfeSo3k718BhBntkak_Kqd3gIVp82XbfkfAyCg,313
6
+ fxn/c/configuration.py,sha256=pOoM4bR50Ga62AJxuDEy0nNEb-kXQ5-DpX0N0GxdZFg,4887
7
+ fxn/c/fxnc.py,sha256=i4wzDi2OhXIZpF4PZK16oknyym5-DQxlOWWA1a4Lo5E,1381
8
+ fxn/c/map.py,sha256=l2zXsiDJK_ThCPg80oAy2qMjiSylTpJL7OWN5Z9aIHA,2352
9
+ fxn/c/prediction.py,sha256=-o57ddDeTzffXDWLkD68ZQFO12pq7Z2I7Nn6ijWY47o,2696
10
+ fxn/c/predictor.py,sha256=c-0RkD5AQXVKVo3PS7rkhuGgVr6Gp5u4cgZcU_iOUPY,1988
11
+ fxn/c/stream.py,sha256=qoSK8BYkVH5ebaoYOdeKFHqh9OCGw6vAacZF9pDJmvU,1168
12
+ fxn/c/value.py,sha256=kPPN6B6eOv3ARtfEvK3dOL8Mz7-Ln-e-44Cwd0FBo9Q,7362
13
+ fxn/cli/__init__.py,sha256=kKM7DUUJ4T1mIz3TCqLdhF00nQgmF7S74IO5lmLvpVM,1519
14
+ fxn/cli/auth.py,sha256=tMjgNA6AQeom3I5AsgPvWvN62cM3nFGBcjjXB7x4s8U,1688
15
+ fxn/cli/env.py,sha256=shqoP4tUiXdOoil73oiUYpqGeVcR119HPYFKgnoF894,1553
16
+ fxn/cli/misc.py,sha256=6zYuuF1pm1LzYkHG4YaSnBxzs7h8CReI6YLk1ysGRso,843
17
+ fxn/cli/predictions.py,sha256=1upcbNg4MUcbKZQUmSGtYcoRgophaiLfkNWH4amYDV8,3084
18
+ fxn/cli/predictors.py,sha256=SSvxf5emr_upcU78vhdB2F9PM351YdP2a1bqf8FRaxE,2248
19
+ fxn/lib/__init__.py,sha256=c_q01PLV3Mi-qV0_HVbNRHOI2TIUr_cDIJHvCASsYZk,71
20
+ fxn/lib/linux/arm64/libFunction.so,sha256=HTbPAZQkexE5xkAyYkpobfOtaxlr_j1H1u-8meHvoRA,211760
21
+ fxn/lib/linux/x86_64/libFunction.so,sha256=XOAUea-akmA5_eQAwMicUqchJ1qMPfa_a4vUaFjGlKw,244488
22
+ fxn/lib/macos/arm64/Function.dylib,sha256=RZiYN9zGVYg2YM_GSGGXjk_RBEJXWHFktari3aE9HxM,263600
23
+ fxn/lib/macos/x86_64/Function.dylib,sha256=qDOvRpdRIY5erRVrMzIpW-a1OZ5kLOB6v96ropHQvMU,263616
24
+ fxn/lib/windows/arm64/Function.dll,sha256=-QJuUu1eDkBDf5C-iP0NGOuZ7TTQv1u7VvPFbti2qyw,413184
25
+ fxn/lib/windows/x86_64/Function.dll,sha256=Qk3avFZioyC9kuMtpgCP5JlUfBcffDpVhrkmeJPNq1Q,455168
26
+ fxn/services/__init__.py,sha256=xKmiDfpp9NLOYJj-KFUOKnJSH6kotJResuFpYZZF5Mo,190
27
+ fxn/services/prediction.py,sha256=MLU2tQJ5BHh59vkOhdzumhc-I-yK_oCrarqhq2HCzgA,10161
28
+ fxn/services/predictor.py,sha256=-WcJ9pcqRA8EzSvcfB9qssoEt7xhqAPatReaoP0Llns,751
29
+ fxn/services/user.py,sha256=xRJygOyyBnryl_M7yxO_Ef2vPPFTmVN5Q5JolPcWu4c,635
30
+ fxn/types/__init__.py,sha256=EyPLiH1OyLLuK4cTLZ2CMevxwriB8pOUH20ID-kqRYs,292
31
+ fxn/types/dtype.py,sha256=YpTnIG-yzrQwda27GzfGZcel-zF3gOMMoHhcWD915BY,617
32
+ fxn/types/prediction.py,sha256=Ev4Hdmm3p0JTvio93S2wBrJvkxNTh-zfnHtG3sRFaew,1991
33
+ fxn/types/predictor.py,sha256=MYjCDmQ-F2ym8IVdN98TsDn6V6_lrhFKSofyqRi3y9U,4535
34
+ fxn/types/user.py,sha256=AhsS_DSE--r78fwnLWXM-mcL71hvBWDZtkMblpzmEC0,1071
35
+ fxn-0.0.41.dist-info/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
36
+ fxn-0.0.41.dist-info/METADATA,sha256=1q3Nhhvolyw_76tSpgHLg17iJCXOXFAC--Nx8_j53oA,16089
37
+ fxn-0.0.41.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
38
+ fxn-0.0.41.dist-info/entry_points.txt,sha256=O_AwD5dYaeB-YT1F9hPAPuDYCkw_W0tdNGYbc5RVR2k,45
39
+ fxn-0.0.41.dist-info/top_level.txt,sha256=1ULIEGrnMlhId8nYAkjmRn9g3KEFuHKboq193SEKQkA,4
40
+ fxn-0.0.41.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.0.0)
2
+ Generator: setuptools (75.5.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
fxn/api/__init__.py DELETED
@@ -1,6 +0,0 @@
1
- #
2
- # Function
3
- # Copyright © 2024 NatML Inc. All Rights Reserved.
4
- #
5
-
6
- from .client import GraphClient
fxn/api/client.py DELETED
@@ -1,43 +0,0 @@
1
- #
2
- # Function
3
- # Copyright © 2024 NatML Inc. All Rights Reserved.
4
- #
5
-
6
- from requests import post
7
- from typing import Any, Dict
8
-
9
- class GraphClient:
10
- """
11
- Function graph API client.
12
- """
13
-
14
- def __init__(self, access_key: str, api_url: str) -> None:
15
- self.access_key = access_key
16
- self.api_url = api_url
17
-
18
- def query (self, query: str, variables: dict=None) -> Dict[str, Any]:
19
- """
20
- Query the Function graph API.
21
-
22
- Parameters:
23
- query (str): Graph query.
24
- variables (dict): Input variables.
25
-
26
- Returns:
27
- dict: Response dictionary.
28
- """
29
- # Request
30
- response = post(
31
- f"{self.api_url}/graph",
32
- json={ "query": query, "variables": variables },
33
- headers={ "Authorization": f"Bearer {self.access_key}" } if self.access_key else { }
34
- )
35
- payload = response.json()
36
- # Check error
37
- try:
38
- response.raise_for_status()
39
- except Exception as ex:
40
- error = payload["errors"][0]["message"] if "errors" in payload else str(ex)
41
- raise RuntimeError(error)
42
- # Return
43
- return payload["data"]
fxn/c/dtype.py DELETED
@@ -1,26 +0,0 @@
1
- #
2
- # Function
3
- # Copyright © 2024 NatML Inc. All Rights Reserved.
4
- #
5
-
6
- from ctypes import c_int
7
-
8
- class FXNDtype(c_int):
9
- NULL = 0
10
- FLOAT16 = 1
11
- FLOAT32 = 2
12
- FLOAT64 = 3
13
- INT8 = 4
14
- INT16 = 5
15
- INT32 = 6
16
- INT64 = 7
17
- UINT8 = 8
18
- UINT16 = 9
19
- UINT32 = 10
20
- UINT64 = 11
21
- BOOL = 12
22
- STRING = 13
23
- LIST = 14
24
- DICT = 15
25
- IMAGE = 16
26
- BINARY = 17
fxn/c/status.py DELETED
@@ -1,12 +0,0 @@
1
- #
2
- # Function
3
- # Copyright © 2024 NatML Inc. All Rights Reserved.
4
- #
5
-
6
- from ctypes import c_int
7
-
8
- class FXNStatus(c_int):
9
- OK = 0
10
- ERROR_INVALID_ARGUMENT = 1
11
- ERROR_INVALID_OPERATION = 2
12
- ERROR_NOT_IMPLEMENTED = 3
fxn/c/version.py DELETED
@@ -1,13 +0,0 @@
1
- #
2
- # Function
3
- # Copyright © 2024 NatML Inc. All Rights Reserved.
4
- #
5
-
6
- from ctypes import c_char_p, CDLL
7
-
8
- def _register_fxn_version (fxnc: CDLL) -> CDLL:
9
- # FXNGetVersion
10
- fxnc.FXNGetVersion.argtypes = []
11
- fxnc.FXNGetVersion.restype = c_char_p
12
- # Return
13
- return fxnc