runloop-api-client 0.1.0a3__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 (62) hide show
  1. runloop_api_client-0.1.0a3/.gitignore +15 -0
  2. runloop_api_client-0.1.0a3/LICENSE +7 -0
  3. runloop_api_client-0.1.0a3/PKG-INFO +334 -0
  4. runloop_api_client-0.1.0a3/pyproject.toml +196 -0
  5. runloop_api_client-0.1.0a3/src/runloop/lib/.keep +4 -0
  6. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/__init__.py +83 -0
  7. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_base_client.py +2006 -0
  8. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_client.py +422 -0
  9. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_compat.py +222 -0
  10. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_constants.py +14 -0
  11. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_exceptions.py +108 -0
  12. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_files.py +127 -0
  13. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_models.py +739 -0
  14. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_qs.py +150 -0
  15. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_resource.py +43 -0
  16. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_response.py +822 -0
  17. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_streaming.py +333 -0
  18. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_types.py +220 -0
  19. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_utils/__init__.py +52 -0
  20. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_utils/_logs.py +25 -0
  21. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_utils/_proxy.py +63 -0
  22. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_utils/_reflection.py +8 -0
  23. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_utils/_streams.py +12 -0
  24. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_utils/_sync.py +81 -0
  25. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_utils/_transform.py +382 -0
  26. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_utils/_typing.py +120 -0
  27. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_utils/_utils.py +402 -0
  28. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/_version.py +4 -0
  29. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/lib/.keep +4 -0
  30. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/py.typed +0 -0
  31. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/resources/__init__.py +47 -0
  32. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/resources/devboxes/__init__.py +33 -0
  33. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/resources/devboxes/devboxes.py +560 -0
  34. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/resources/devboxes/logs.py +143 -0
  35. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/resources/functions/__init__.py +33 -0
  36. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/resources/functions/functions.py +376 -0
  37. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/resources/functions/invocations/__init__.py +33 -0
  38. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/resources/functions/invocations/invocations.py +310 -0
  39. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/resources/functions/invocations/spans.py +147 -0
  40. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/resources/projects/__init__.py +33 -0
  41. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/resources/projects/logs.py +143 -0
  42. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/resources/projects/projects.py +155 -0
  43. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/__init__.py +14 -0
  44. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/devbox_create_params.py +30 -0
  45. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/devbox_execution_detail_view.py +21 -0
  46. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/devbox_list_params.py +12 -0
  47. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/devbox_list_view.py +13 -0
  48. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/devbox_view.py +21 -0
  49. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/devboxes/__init__.py +5 -0
  50. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/devboxes/devbox_logs_list_view.py +23 -0
  51. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/function_invoke_async_params.py +23 -0
  52. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/function_invoke_sync_params.py +23 -0
  53. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/function_list_view.py +20 -0
  54. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/functions/__init__.py +5 -0
  55. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/functions/function_invocation_list_view.py +26 -0
  56. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/functions/invocations/__init__.py +5 -0
  57. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/functions/invocations/invocation_span_list_view.py +16 -0
  58. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/project_list_view.py +149 -0
  59. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/projects/__init__.py +3 -0
  60. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/shared/__init__.py +4 -0
  61. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/shared/function_invocation_detail_view.py +25 -0
  62. runloop_api_client-0.1.0a3/src/runloop_minus_api_minus_client/types/shared/project_logs_view.py +22 -0
@@ -0,0 +1,15 @@
1
+ .vscode
2
+ _dev
3
+
4
+ __pycache__
5
+ .mypy_cache
6
+
7
+ dist
8
+
9
+ .venv
10
+ .idea
11
+
12
+ .env
13
+ .envrc
14
+ codegen.log
15
+ Brewfile.lock.json
@@ -0,0 +1,7 @@
1
+ Copyright 2024 runloop
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,334 @@
1
+ Metadata-Version: 2.3
2
+ Name: runloop-api-client
3
+ Version: 0.1.0a3
4
+ Summary: The official Python library for the runloop API
5
+ Project-URL: Homepage, https://github.com/runloopai/api-client-python
6
+ Project-URL: Repository, https://github.com/runloopai/api-client-python
7
+ Author-email: Runloop <support@runloop.ai>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: MacOS
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Operating System :: POSIX
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3.7
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.7
26
+ Requires-Dist: anyio<5,>=3.5.0
27
+ Requires-Dist: cached-property; python_version < '3.8'
28
+ Requires-Dist: distro<2,>=1.7.0
29
+ Requires-Dist: httpx<1,>=0.23.0
30
+ Requires-Dist: pydantic<3,>=1.9.0
31
+ Requires-Dist: sniffio
32
+ Requires-Dist: typing-extensions<5,>=4.7
33
+ Description-Content-Type: text/markdown
34
+
35
+ # Runloop Python API library
36
+
37
+ [![PyPI version](https://img.shields.io/pypi/v/runloop-api-client.svg)](https://pypi.org/project/runloop-api-client/)
38
+
39
+ The Runloop Python library provides convenient access to the Runloop REST API from any Python 3.7+
40
+ application. The library includes type definitions for all request params and response fields,
41
+ and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
42
+
43
+ It is generated with [Stainless](https://www.stainlessapi.com/).
44
+
45
+ ## Documentation
46
+
47
+ The REST API documentation can be found [on runloop.ai](https://runloop.ai). The full API of this library can be found in [api.md](https://github.com/runloopai/api-client-python/tree/main/api.md).
48
+
49
+ ## Installation
50
+
51
+ ```sh
52
+ # install from PyPI
53
+ pip install --pre runloop-api-client
54
+ ```
55
+
56
+ ## Usage
57
+
58
+ The full API of this library can be found in [api.md](https://github.com/runloopai/api-client-python/tree/main/api.md).
59
+
60
+ ```python
61
+ import os
62
+ from runloop_minus_api_minus_client import Runloop
63
+
64
+ client = Runloop(
65
+ # This is the default and can be omitted
66
+ bearer_token=os.environ.get("RUNLOOP_BEARER_TOKEN"),
67
+ )
68
+
69
+ devbox_view = client.devboxes.create()
70
+ print(devbox_view.id)
71
+ ```
72
+
73
+ While you can provide a `bearer_token` keyword argument,
74
+ we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
75
+ to add `RUNLOOP_BEARER_TOKEN="My Bearer Token"` to your `.env` file
76
+ so that your Bearer Token is not stored in source control.
77
+
78
+ ## Async usage
79
+
80
+ Simply import `AsyncRunloop` instead of `Runloop` and use `await` with each API call:
81
+
82
+ ```python
83
+ import os
84
+ import asyncio
85
+ from runloop_minus_api_minus_client import AsyncRunloop
86
+
87
+ client = AsyncRunloop(
88
+ # This is the default and can be omitted
89
+ bearer_token=os.environ.get("RUNLOOP_BEARER_TOKEN"),
90
+ )
91
+
92
+
93
+ async def main() -> None:
94
+ devbox_view = await client.devboxes.create()
95
+ print(devbox_view.id)
96
+
97
+
98
+ asyncio.run(main())
99
+ ```
100
+
101
+ Functionality between the synchronous and asynchronous clients is otherwise identical.
102
+
103
+ ## Using types
104
+
105
+ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
106
+
107
+ - Serializing back into JSON, `model.to_json()`
108
+ - Converting to a dictionary, `model.to_dict()`
109
+
110
+ Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
111
+
112
+ ## Handling errors
113
+
114
+ When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `runloop_minus_api_minus_client.APIConnectionError` is raised.
115
+
116
+ When the API returns a non-success status code (that is, 4xx or 5xx
117
+ response), a subclass of `runloop_minus_api_minus_client.APIStatusError` is raised, containing `status_code` and `response` properties.
118
+
119
+ All errors inherit from `runloop_minus_api_minus_client.APIError`.
120
+
121
+ ```python
122
+ import runloop_minus_api_minus_client
123
+ from runloop_minus_api_minus_client import Runloop
124
+
125
+ client = Runloop()
126
+
127
+ try:
128
+ client.devboxes.create()
129
+ except runloop_minus_api_minus_client.APIConnectionError as e:
130
+ print("The server could not be reached")
131
+ print(e.__cause__) # an underlying Exception, likely raised within httpx.
132
+ except runloop_minus_api_minus_client.RateLimitError as e:
133
+ print("A 429 status code was received; we should back off a bit.")
134
+ except runloop_minus_api_minus_client.APIStatusError as e:
135
+ print("Another non-200-range status code was received")
136
+ print(e.status_code)
137
+ print(e.response)
138
+ ```
139
+
140
+ Error codes are as followed:
141
+
142
+ | Status Code | Error Type |
143
+ | ----------- | -------------------------- |
144
+ | 400 | `BadRequestError` |
145
+ | 401 | `AuthenticationError` |
146
+ | 403 | `PermissionDeniedError` |
147
+ | 404 | `NotFoundError` |
148
+ | 422 | `UnprocessableEntityError` |
149
+ | 429 | `RateLimitError` |
150
+ | >=500 | `InternalServerError` |
151
+ | N/A | `APIConnectionError` |
152
+
153
+ ### Retries
154
+
155
+ Certain errors are automatically retried 2 times by default, with a short exponential backoff.
156
+ Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
157
+ 429 Rate Limit, and >=500 Internal errors are all retried by default.
158
+
159
+ You can use the `max_retries` option to configure or disable retry settings:
160
+
161
+ ```python
162
+ from runloop_minus_api_minus_client import Runloop
163
+
164
+ # Configure the default for all requests:
165
+ client = Runloop(
166
+ # default is 2
167
+ max_retries=0,
168
+ )
169
+
170
+ # Or, configure per-request:
171
+ client.with_options(max_retries=5).devboxes.create()
172
+ ```
173
+
174
+ ### Timeouts
175
+
176
+ By default requests time out after 1 minute. You can configure this with a `timeout` option,
177
+ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
178
+
179
+ ```python
180
+ from runloop_minus_api_minus_client import Runloop
181
+
182
+ # Configure the default for all requests:
183
+ client = Runloop(
184
+ # 20 seconds (default is 1 minute)
185
+ timeout=20.0,
186
+ )
187
+
188
+ # More granular control:
189
+ client = Runloop(
190
+ timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
191
+ )
192
+
193
+ # Override per-request:
194
+ client.with_options(timeout=5.0).devboxes.create()
195
+ ```
196
+
197
+ On timeout, an `APITimeoutError` is thrown.
198
+
199
+ Note that requests that time out are [retried twice by default](https://github.com/runloopai/api-client-python/tree/main/#retries).
200
+
201
+ ## Advanced
202
+
203
+ ### Logging
204
+
205
+ We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
206
+
207
+ You can enable logging by setting the environment variable `RUNLOOP_LOG` to `debug`.
208
+
209
+ ```shell
210
+ $ export RUNLOOP_LOG=debug
211
+ ```
212
+
213
+ ### How to tell whether `None` means `null` or missing
214
+
215
+ In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:
216
+
217
+ ```py
218
+ if response.my_field is None:
219
+ if 'my_field' not in response.model_fields_set:
220
+ print('Got json like {}, without a "my_field" key present at all.')
221
+ else:
222
+ print('Got json like {"my_field": null}.')
223
+ ```
224
+
225
+ ### Accessing raw response data (e.g. headers)
226
+
227
+ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
228
+
229
+ ```py
230
+ from runloop_minus_api_minus_client import Runloop
231
+
232
+ client = Runloop()
233
+ response = client.devboxes.with_raw_response.create()
234
+ print(response.headers.get('X-My-Header'))
235
+
236
+ devbox = response.parse() # get the object that `devboxes.create()` would have returned
237
+ print(devbox.id)
238
+ ```
239
+
240
+ These methods return an [`APIResponse`](https://github.com/runloopai/api-client-python/tree/main/src/runloop_minus_api_minus_client/_response.py) object.
241
+
242
+ The async client returns an [`AsyncAPIResponse`](https://github.com/runloopai/api-client-python/tree/main/src/runloop_minus_api_minus_client/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
243
+
244
+ #### `.with_streaming_response`
245
+
246
+ The above interface eagerly reads the full response body when you make the request, which may not always be what you want.
247
+
248
+ To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
249
+
250
+ ```python
251
+ with client.devboxes.with_streaming_response.create() as response:
252
+ print(response.headers.get("X-My-Header"))
253
+
254
+ for line in response.iter_lines():
255
+ print(line)
256
+ ```
257
+
258
+ The context manager is required so that the response will reliably be closed.
259
+
260
+ ### Making custom/undocumented requests
261
+
262
+ This library is typed for convenient access to the documented API.
263
+
264
+ If you need to access undocumented endpoints, params, or response properties, the library can still be used.
265
+
266
+ #### Undocumented endpoints
267
+
268
+ To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
269
+ http verbs. Options on the client will be respected (such as retries) will be respected when making this
270
+ request.
271
+
272
+ ```py
273
+ import httpx
274
+
275
+ response = client.post(
276
+ "/foo",
277
+ cast_to=httpx.Response,
278
+ body={"my_param": True},
279
+ )
280
+
281
+ print(response.headers.get("x-foo"))
282
+ ```
283
+
284
+ #### Undocumented request params
285
+
286
+ If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request
287
+ options.
288
+
289
+ #### Undocumented response properties
290
+
291
+ To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You
292
+ can also get all the extra fields on the Pydantic model as a dict with
293
+ [`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).
294
+
295
+ ### Configuring the HTTP client
296
+
297
+ You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
298
+
299
+ - Support for proxies
300
+ - Custom transports
301
+ - Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
302
+
303
+ ```python
304
+ from runloop_minus_api_minus_client import Runloop, DefaultHttpxClient
305
+
306
+ client = Runloop(
307
+ # Or use the `RUNLOOP_BASE_URL` env var
308
+ base_url="http://my.test.server.example.com:8083",
309
+ http_client=DefaultHttpxClient(
310
+ proxies="http://my.test.proxy.example.com",
311
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
312
+ ),
313
+ )
314
+ ```
315
+
316
+ ### Managing HTTP resources
317
+
318
+ By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
319
+
320
+ ## Versioning
321
+
322
+ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
323
+
324
+ 1. Changes that only affect static types, without breaking runtime behavior.
325
+ 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
326
+ 3. Changes that we do not expect to impact the vast majority of users in practice.
327
+
328
+ We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
329
+
330
+ We are keen for your feedback; please open an [issue](https://www.github.com/runloopai/api-client-python/issues) with questions, bugs, or suggestions.
331
+
332
+ ## Requirements
333
+
334
+ Python 3.7 or higher.
@@ -0,0 +1,196 @@
1
+ [project]
2
+ name = "runloop-api-client"
3
+ version = "0.1.0-alpha.3"
4
+ description = "The official Python library for the runloop API"
5
+ dynamic = ["readme"]
6
+ license = "MIT"
7
+ authors = [
8
+ { name = "Runloop", email = "support@runloop.ai" },
9
+ ]
10
+ dependencies = [
11
+ "httpx>=0.23.0, <1",
12
+ "pydantic>=1.9.0, <3",
13
+ "typing-extensions>=4.7, <5",
14
+ "anyio>=3.5.0, <5",
15
+ "distro>=1.7.0, <2",
16
+ "sniffio",
17
+ "cached-property; python_version < '3.8'",
18
+
19
+ ]
20
+ requires-python = ">= 3.7"
21
+ classifiers = [
22
+ "Typing :: Typed",
23
+ "Intended Audience :: Developers",
24
+ "Programming Language :: Python :: 3.7",
25
+ "Programming Language :: Python :: 3.8",
26
+ "Programming Language :: Python :: 3.9",
27
+ "Programming Language :: Python :: 3.10",
28
+ "Programming Language :: Python :: 3.11",
29
+ "Programming Language :: Python :: 3.12",
30
+ "Operating System :: OS Independent",
31
+ "Operating System :: POSIX",
32
+ "Operating System :: MacOS",
33
+ "Operating System :: POSIX :: Linux",
34
+ "Operating System :: Microsoft :: Windows",
35
+ "Topic :: Software Development :: Libraries :: Python Modules",
36
+ "License :: OSI Approved :: MIT License"
37
+ ]
38
+
39
+
40
+
41
+ [project.urls]
42
+ Homepage = "https://github.com/runloopai/api-client-python"
43
+ Repository = "https://github.com/runloopai/api-client-python"
44
+
45
+
46
+
47
+ [tool.rye]
48
+ managed = true
49
+ # version pins are in requirements-dev.lock
50
+ dev-dependencies = [
51
+ "pyright>=1.1.359",
52
+ "mypy",
53
+ "respx",
54
+ "pytest",
55
+ "pytest-asyncio",
56
+ "ruff",
57
+ "time-machine",
58
+ "nox",
59
+ "dirty-equals>=0.6.0",
60
+ "importlib-metadata>=6.7.0",
61
+
62
+ ]
63
+
64
+ [tool.rye.scripts]
65
+ format = { chain = [
66
+ "format:ruff",
67
+ "format:docs",
68
+ "fix:ruff",
69
+ ]}
70
+ "format:black" = "black ."
71
+ "format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md"
72
+ "format:ruff" = "ruff format"
73
+ "format:isort" = "isort ."
74
+
75
+ "lint" = { chain = [
76
+ "check:ruff",
77
+ "typecheck",
78
+ ]}
79
+ "check:ruff" = "ruff ."
80
+ "fix:ruff" = "ruff --fix ."
81
+
82
+ typecheck = { chain = [
83
+ "typecheck:pyright",
84
+ "typecheck:mypy"
85
+ ]}
86
+ "typecheck:pyright" = "pyright"
87
+ "typecheck:verify-types" = "pyright --verifytypes runloop_minus_api_minus_client --ignoreexternal"
88
+ "typecheck:mypy" = "mypy ."
89
+
90
+ [build-system]
91
+ requires = ["hatchling", "hatch-fancy-pypi-readme"]
92
+ build-backend = "hatchling.build"
93
+
94
+ [tool.hatch.build]
95
+ include = [
96
+ "src/*"
97
+ ]
98
+
99
+ [tool.hatch.build.targets.wheel]
100
+ packages = ["src/runloop_minus_api_minus_client"]
101
+
102
+ [tool.hatch.metadata.hooks.fancy-pypi-readme]
103
+ content-type = "text/markdown"
104
+
105
+ [[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
106
+ path = "README.md"
107
+
108
+ [[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
109
+ # replace relative links with absolute links
110
+ pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
111
+ replacement = '[\1](https://github.com/runloopai/api-client-python/tree/main/\g<2>)'
112
+
113
+ [tool.black]
114
+ line-length = 120
115
+ target-version = ["py37"]
116
+
117
+ [tool.pytest.ini_options]
118
+ testpaths = ["tests"]
119
+ addopts = "--tb=short"
120
+ xfail_strict = true
121
+ asyncio_mode = "auto"
122
+ filterwarnings = [
123
+ "error"
124
+ ]
125
+
126
+ [tool.pyright]
127
+ # this enables practically every flag given by pyright.
128
+ # there are a couple of flags that are still disabled by
129
+ # default in strict mode as they are experimental and niche.
130
+ typeCheckingMode = "strict"
131
+ pythonVersion = "3.7"
132
+
133
+ exclude = [
134
+ "_dev",
135
+ ".venv",
136
+ ".nox",
137
+ ]
138
+
139
+ reportImplicitOverride = true
140
+
141
+ reportImportCycles = false
142
+ reportPrivateUsage = false
143
+
144
+
145
+ [tool.ruff]
146
+ line-length = 120
147
+ output-format = "grouped"
148
+ target-version = "py37"
149
+ select = [
150
+ # isort
151
+ "I",
152
+ # bugbear rules
153
+ "B",
154
+ # remove unused imports
155
+ "F401",
156
+ # bare except statements
157
+ "E722",
158
+ # unused arguments
159
+ "ARG",
160
+ # print statements
161
+ "T201",
162
+ "T203",
163
+ # misuse of typing.TYPE_CHECKING
164
+ "TCH004",
165
+ # import rules
166
+ "TID251",
167
+ ]
168
+ ignore = [
169
+ # mutable defaults
170
+ "B006",
171
+ ]
172
+ unfixable = [
173
+ # disable auto fix for print statements
174
+ "T201",
175
+ "T203",
176
+ ]
177
+ ignore-init-module-imports = true
178
+
179
+ [tool.ruff.format]
180
+ docstring-code-format = true
181
+
182
+ [tool.ruff.lint.flake8-tidy-imports.banned-api]
183
+ "functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead"
184
+
185
+ [tool.ruff.lint.isort]
186
+ length-sort = true
187
+ length-sort-straight = true
188
+ combine-as-imports = true
189
+ extra-standard-library = ["typing_extensions"]
190
+ known-first-party = ["runloop_minus_api_minus_client", "tests"]
191
+
192
+ [tool.ruff.per-file-ignores]
193
+ "bin/**.py" = ["T201", "T203"]
194
+ "scripts/**.py" = ["T201", "T203"]
195
+ "tests/**.py" = ["T201", "T203"]
196
+ "examples/**.py" = ["T201", "T203"]
@@ -0,0 +1,4 @@
1
+ File generated from our OpenAPI spec by Stainless.
2
+
3
+ This directory can be used to store custom files to expand the SDK.
4
+ It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.
@@ -0,0 +1,83 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from . import types
4
+ from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes
5
+ from ._utils import file_from_path
6
+ from ._client import Client, Stream, Runloop, Timeout, Transport, AsyncClient, AsyncStream, AsyncRunloop, RequestOptions
7
+ from ._models import BaseModel
8
+ from ._version import __title__, __version__
9
+ from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse
10
+ from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS
11
+ from ._exceptions import (
12
+ APIError,
13
+ RunloopError,
14
+ ConflictError,
15
+ NotFoundError,
16
+ APIStatusError,
17
+ RateLimitError,
18
+ APITimeoutError,
19
+ BadRequestError,
20
+ APIConnectionError,
21
+ AuthenticationError,
22
+ InternalServerError,
23
+ PermissionDeniedError,
24
+ UnprocessableEntityError,
25
+ APIResponseValidationError,
26
+ )
27
+ from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
28
+ from ._utils._logs import setup_logging as _setup_logging
29
+
30
+ __all__ = [
31
+ "types",
32
+ "__version__",
33
+ "__title__",
34
+ "NoneType",
35
+ "Transport",
36
+ "ProxiesTypes",
37
+ "NotGiven",
38
+ "NOT_GIVEN",
39
+ "RunloopError",
40
+ "APIError",
41
+ "APIStatusError",
42
+ "APITimeoutError",
43
+ "APIConnectionError",
44
+ "APIResponseValidationError",
45
+ "BadRequestError",
46
+ "AuthenticationError",
47
+ "PermissionDeniedError",
48
+ "NotFoundError",
49
+ "ConflictError",
50
+ "UnprocessableEntityError",
51
+ "RateLimitError",
52
+ "InternalServerError",
53
+ "Timeout",
54
+ "RequestOptions",
55
+ "Client",
56
+ "AsyncClient",
57
+ "Stream",
58
+ "AsyncStream",
59
+ "Runloop",
60
+ "AsyncRunloop",
61
+ "file_from_path",
62
+ "BaseModel",
63
+ "DEFAULT_TIMEOUT",
64
+ "DEFAULT_MAX_RETRIES",
65
+ "DEFAULT_CONNECTION_LIMITS",
66
+ "DefaultHttpxClient",
67
+ "DefaultAsyncHttpxClient",
68
+ ]
69
+
70
+ _setup_logging()
71
+
72
+ # Update the __module__ attribute for exported symbols so that
73
+ # error messages point to this module instead of the module
74
+ # it was originally defined in, e.g.
75
+ # runloop_minus_api_minus_client._exceptions.NotFoundError -> runloop_minus_api_minus_client.NotFoundError
76
+ __locals = locals()
77
+ for __name in __all__:
78
+ if not __name.startswith("__"):
79
+ try:
80
+ __locals[__name].__module__ = "runloop_minus_api_minus_client"
81
+ except (TypeError, AttributeError):
82
+ # Some of our exported symbols are builtins which we can't set attributes for.
83
+ pass