runloop-api-client 0.1.0a4__tar.gz → 0.1.0a5__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 (106) hide show
  1. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/.gitignore +1 -0
  2. runloop_api_client-0.1.0a5/.release-please-manifest.json +3 -0
  3. runloop_api_client-0.1.0a5/CHANGELOG.md +58 -0
  4. runloop_api_client-0.1.0a5/CONTRIBUTING.md +125 -0
  5. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/PKG-INFO +1 -1
  6. runloop_api_client-0.1.0a5/README.md +300 -0
  7. runloop_api_client-0.1.0a5/SECURITY.md +27 -0
  8. runloop_api_client-0.1.0a5/api.md +79 -0
  9. runloop_api_client-0.1.0a5/bin/check-release-environment +32 -0
  10. runloop_api_client-0.1.0a5/bin/publish-pypi +9 -0
  11. runloop_api_client-0.1.0a5/examples/.keep +4 -0
  12. runloop_api_client-0.1.0a5/mypy.ini +47 -0
  13. runloop_api_client-0.1.0a5/noxfile.py +9 -0
  14. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/pyproject.toml +17 -1
  15. runloop_api_client-0.1.0a5/release-please-config.json +66 -0
  16. runloop_api_client-0.1.0a5/requirements-dev.lock +104 -0
  17. runloop_api_client-0.1.0a5/requirements.lock +44 -0
  18. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_base_client.py +18 -2
  19. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_client.py +2 -2
  20. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_models.py +27 -0
  21. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_utils/__init__.py +4 -1
  22. runloop_api_client-0.1.0a5/src/runloop_api_client/_utils/_reflection.py +42 -0
  23. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_version.py +1 -1
  24. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/resources/devboxes/devboxes.py +17 -1
  25. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/resources/functions/invocations/__init__.py +0 -14
  26. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/resources/functions/invocations/invocations.py +0 -32
  27. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/__init__.py +1 -0
  28. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/devbox_create_params.py +3 -0
  29. runloop_api_client-0.1.0a5/src/runloop_api_client/types/devbox_execute_sync_params.py +12 -0
  30. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/devbox_view.py +3 -0
  31. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/devboxes/devbox_logs_list_view.py +13 -0
  32. {runloop_api_client-0.1.0a4/src/runloop_api_client/types/functions/invocations → runloop_api_client-0.1.0a5/src/runloop_api_client/types/projects}/__init__.py +0 -2
  33. runloop_api_client-0.1.0a5/tests/__init__.py +1 -0
  34. runloop_api_client-0.1.0a5/tests/api_resources/__init__.py +1 -0
  35. runloop_api_client-0.1.0a5/tests/api_resources/devboxes/__init__.py +1 -0
  36. runloop_api_client-0.1.0a5/tests/api_resources/devboxes/test_logs.py +98 -0
  37. runloop_api_client-0.1.0a5/tests/api_resources/functions/__init__.py +1 -0
  38. runloop_api_client-0.1.0a5/tests/api_resources/functions/invocations/__init__.py +1 -0
  39. runloop_api_client-0.1.0a5/tests/api_resources/functions/test_invocations.py +225 -0
  40. runloop_api_client-0.1.0a5/tests/api_resources/projects/__init__.py +1 -0
  41. runloop_api_client-0.1.0a5/tests/api_resources/projects/test_logs.py +98 -0
  42. runloop_api_client-0.1.0a5/tests/api_resources/test_devboxes.py +406 -0
  43. runloop_api_client-0.1.0a5/tests/api_resources/test_functions.py +325 -0
  44. runloop_api_client-0.1.0a5/tests/api_resources/test_projects.py +72 -0
  45. runloop_api_client-0.1.0a5/tests/conftest.py +49 -0
  46. runloop_api_client-0.1.0a5/tests/sample_file.txt +1 -0
  47. runloop_api_client-0.1.0a5/tests/test_client.py +1475 -0
  48. runloop_api_client-0.1.0a5/tests/test_deepcopy.py +59 -0
  49. runloop_api_client-0.1.0a5/tests/test_extract_files.py +64 -0
  50. runloop_api_client-0.1.0a5/tests/test_files.py +51 -0
  51. runloop_api_client-0.1.0a5/tests/test_models.py +829 -0
  52. runloop_api_client-0.1.0a5/tests/test_qs.py +78 -0
  53. runloop_api_client-0.1.0a5/tests/test_required_args.py +111 -0
  54. runloop_api_client-0.1.0a5/tests/test_response.py +194 -0
  55. runloop_api_client-0.1.0a5/tests/test_streaming.py +248 -0
  56. runloop_api_client-0.1.0a5/tests/test_transform.py +410 -0
  57. runloop_api_client-0.1.0a5/tests/test_utils/test_proxy.py +23 -0
  58. runloop_api_client-0.1.0a5/tests/test_utils/test_typing.py +78 -0
  59. runloop_api_client-0.1.0a5/tests/utils.py +151 -0
  60. runloop_api_client-0.1.0a4/src/runloop_api_client/_utils/_reflection.py +0 -8
  61. runloop_api_client-0.1.0a4/src/runloop_api_client/resources/functions/invocations/spans.py +0 -147
  62. runloop_api_client-0.1.0a4/src/runloop_api_client/types/functions/invocations/invocation_span_list_view.py +0 -16
  63. runloop_api_client-0.1.0a4/src/runloop_minus_api_minus_client/lib/.keep +0 -4
  64. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/LICENSE +0 -0
  65. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop/lib/.keep +0 -0
  66. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/__init__.py +0 -0
  67. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_compat.py +0 -0
  68. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_constants.py +0 -0
  69. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_exceptions.py +0 -0
  70. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_files.py +0 -0
  71. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_qs.py +0 -0
  72. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_resource.py +0 -0
  73. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_response.py +0 -0
  74. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_streaming.py +0 -0
  75. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_types.py +0 -0
  76. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_utils/_logs.py +0 -0
  77. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_utils/_proxy.py +0 -0
  78. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_utils/_streams.py +0 -0
  79. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_utils/_sync.py +0 -0
  80. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_utils/_transform.py +0 -0
  81. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_utils/_typing.py +0 -0
  82. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/_utils/_utils.py +0 -0
  83. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/lib/.keep +0 -0
  84. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/py.typed +0 -0
  85. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/resources/__init__.py +0 -0
  86. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/resources/devboxes/__init__.py +0 -0
  87. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/resources/devboxes/logs.py +0 -0
  88. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/resources/functions/__init__.py +0 -0
  89. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/resources/functions/functions.py +0 -0
  90. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/resources/projects/__init__.py +0 -0
  91. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/resources/projects/logs.py +0 -0
  92. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/resources/projects/projects.py +0 -0
  93. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/devbox_execution_detail_view.py +0 -0
  94. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/devbox_list_params.py +0 -0
  95. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/devbox_list_view.py +0 -0
  96. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/devboxes/__init__.py +0 -0
  97. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/function_invoke_async_params.py +0 -0
  98. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/function_invoke_sync_params.py +0 -0
  99. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/function_list_view.py +0 -0
  100. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/functions/__init__.py +0 -0
  101. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/functions/function_invocation_list_view.py +0 -0
  102. {runloop_api_client-0.1.0a4/src/runloop_api_client/types/projects → runloop_api_client-0.1.0a5/src/runloop_api_client/types/functions/invocations}/__init__.py +0 -0
  103. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/project_list_view.py +0 -0
  104. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/shared/__init__.py +0 -0
  105. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/shared/function_invocation_detail_view.py +0 -0
  106. {runloop_api_client-0.1.0a4 → runloop_api_client-0.1.0a5}/src/runloop_api_client/types/shared/project_logs_view.py +0 -0
@@ -1,3 +1,4 @@
1
+ .prism.log
1
2
  .vscode
2
3
  _dev
3
4
 
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.0-alpha.5"
3
+ }
@@ -0,0 +1,58 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0-alpha.5 (2024-07-03)
4
+
5
+ Full Changelog: [v0.1.0-alpha.4...v0.1.0-alpha.5](https://github.com/runloopai/api-client-python/compare/v0.1.0-alpha.4...v0.1.0-alpha.5)
6
+
7
+ ### Features
8
+
9
+ * **api:** OpenAPI spec update via Stainless API ([#19](https://github.com/runloopai/api-client-python/issues/19)) ([9def751](https://github.com/runloopai/api-client-python/commit/9def7518972cdb0c0a03728408d8e10f79090ba5))
10
+ * **api:** OpenAPI spec update via Stainless API ([#20](https://github.com/runloopai/api-client-python/issues/20)) ([a0bf266](https://github.com/runloopai/api-client-python/commit/a0bf2667f1831d91cc1375328f355dc561b98a37))
11
+ * **api:** OpenAPI spec update via Stainless API ([#21](https://github.com/runloopai/api-client-python/issues/21)) ([9e9f3c2](https://github.com/runloopai/api-client-python/commit/9e9f3c2150928658c49e5c18569411766be60bbe))
12
+ * **api:** OpenAPI spec update via Stainless API ([#22](https://github.com/runloopai/api-client-python/issues/22)) ([5bf8bc0](https://github.com/runloopai/api-client-python/commit/5bf8bc0c5030ed78d04b7a513a0d167aa3e9acf8))
13
+
14
+ ## 0.1.0-alpha.4 (2024-06-26)
15
+
16
+ Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/runloopai/api-client-python/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)
17
+
18
+ ### Features
19
+
20
+ * **api:** update via SDK Studio ([#15](https://github.com/runloopai/api-client-python/issues/15)) ([4813de5](https://github.com/runloopai/api-client-python/commit/4813de5f1d73df3e39a4efff76d7d80202e65162))
21
+
22
+ ## 0.1.0-alpha.3 (2024-06-26)
23
+
24
+ Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/runloopai/api-client-python/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
25
+
26
+ ### Features
27
+
28
+ * **api:** update via SDK Studio ([#12](https://github.com/runloopai/api-client-python/issues/12)) ([a86d706](https://github.com/runloopai/api-client-python/commit/a86d7069570b8d0360d3e67b90ee1fed736ec1df))
29
+
30
+ ## 0.1.0-alpha.2 (2024-06-25)
31
+
32
+ Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/runloopai/api-client-python/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
33
+
34
+ ### Features
35
+
36
+ * **api:** update via SDK Studio ([#9](https://github.com/runloopai/api-client-python/issues/9)) ([9a53399](https://github.com/runloopai/api-client-python/commit/9a533998e9f44bf77fc0697c32af441ab1ec49fc))
37
+
38
+ ## 0.1.0-alpha.1 (2024-06-25)
39
+
40
+ Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/runloopai/api-client-python/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
41
+
42
+ ### Features
43
+
44
+ * **api:** OpenAPI spec update via Stainless API ([17991ec](https://github.com/runloopai/api-client-python/commit/17991ec2bd449f7ffef39a9da4b274f82c61c364))
45
+ * **api:** OpenAPI spec update via Stainless API ([a624924](https://github.com/runloopai/api-client-python/commit/a62492427ea762b1fa8e6e438ba489ff08b798e5))
46
+ * **api:** OpenAPI spec update via Stainless API ([#4](https://github.com/runloopai/api-client-python/issues/4)) ([134f28f](https://github.com/runloopai/api-client-python/commit/134f28ff63f25f18d3a4b7e2300b768ffa4c7590))
47
+ * **api:** update via SDK Studio ([88939b3](https://github.com/runloopai/api-client-python/commit/88939b3e46af521bc43a7b25e66ddb5a553a2af6))
48
+ * **api:** update via SDK Studio ([e2cca37](https://github.com/runloopai/api-client-python/commit/e2cca3796d1a2b128abb6f93b8e444f0dd4da501))
49
+
50
+
51
+ ### Chores
52
+
53
+ * go live ([#2](https://github.com/runloopai/api-client-python/issues/2)) ([3ae4996](https://github.com/runloopai/api-client-python/commit/3ae4996b2474aabb19a98cf38b834ca3e91d7c2b))
54
+ * go live ([#5](https://github.com/runloopai/api-client-python/issues/5)) ([626be20](https://github.com/runloopai/api-client-python/commit/626be201c2ed40ac34f2b5869f6c17c431ee543b))
55
+ * update SDK settings ([ac8358a](https://github.com/runloopai/api-client-python/commit/ac8358ae8d3ac7ba5bab2082384ae5029c50fcc8))
56
+ * update SDK settings ([#3](https://github.com/runloopai/api-client-python/issues/3)) ([ef88178](https://github.com/runloopai/api-client-python/commit/ef88178299ae3988bc3d1e813c462d609312f69a))
57
+ * update SDK settings ([#6](https://github.com/runloopai/api-client-python/issues/6)) ([82a6f56](https://github.com/runloopai/api-client-python/commit/82a6f56061cd0ebfa88ed3ec71d044a0fb131f0a))
58
+ * update SDK settings ([#7](https://github.com/runloopai/api-client-python/issues/7)) ([aa9d69b](https://github.com/runloopai/api-client-python/commit/aa9d69b15a011dfa8381ec08327c88e5c2a1ab8d))
@@ -0,0 +1,125 @@
1
+ ## Setting up the environment
2
+
3
+ ### With Rye
4
+
5
+ We use [Rye](https://rye.astral.sh/) to manage dependencies so we highly recommend [installing it](https://rye.astral.sh/guide/installation/) as it will automatically provision a Python environment with the expected Python version.
6
+
7
+ After installing Rye, you'll just have to run this command:
8
+
9
+ ```sh
10
+ $ rye sync --all-features
11
+ ```
12
+
13
+ You can then run scripts using `rye run python script.py` or by activating the virtual environment:
14
+
15
+ ```sh
16
+ $ rye shell
17
+ # or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
18
+ $ source .venv/bin/activate
19
+
20
+ # now you can omit the `rye run` prefix
21
+ $ python script.py
22
+ ```
23
+
24
+ ### Without Rye
25
+
26
+ Alternatively if you don't want to install `Rye`, you can stick with the standard `pip` setup by ensuring you have the Python version specified in `.python-version`, create a virtual environment however you desire and then install dependencies using this command:
27
+
28
+ ```sh
29
+ $ pip install -r requirements-dev.lock
30
+ ```
31
+
32
+ ## Modifying/Adding code
33
+
34
+ Most of the SDK is generated code, and any modified code will be overridden on the next generation. The
35
+ `src/runloop_api_client/lib/` and `examples/` directories are exceptions and will never be overridden.
36
+
37
+ ## Adding and running examples
38
+
39
+ All files in the `examples/` directory are not modified by the Stainless generator and can be freely edited or
40
+ added to.
41
+
42
+ ```bash
43
+ # add an example to examples/<your-example>.py
44
+
45
+ #!/usr/bin/env -S rye run python
46
+ …
47
+ ```
48
+
49
+ ```
50
+ chmod +x examples/<your-example>.py
51
+ # run the example against your api
52
+ ./examples/<your-example>.py
53
+ ```
54
+
55
+ ## Using the repository from source
56
+
57
+ If you’d like to use the repository from source, you can either install from git or link to a cloned repository:
58
+
59
+ To install via git:
60
+
61
+ ```bash
62
+ pip install git+ssh://git@github.com/runloopai/api-client-python.git
63
+ ```
64
+
65
+ Alternatively, you can build from source and install the wheel file:
66
+
67
+ Building this package will create two files in the `dist/` directory, a `.tar.gz` containing the source files and a `.whl` that can be used to install the package efficiently.
68
+
69
+ To create a distributable version of the library, all you have to do is run this command:
70
+
71
+ ```bash
72
+ rye build
73
+ # or
74
+ python -m build
75
+ ```
76
+
77
+ Then to install:
78
+
79
+ ```sh
80
+ pip install ./path-to-wheel-file.whl
81
+ ```
82
+
83
+ ## Running tests
84
+
85
+ Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
86
+
87
+ ```bash
88
+ # you will need npm installed
89
+ npx prism mock path/to/your/openapi.yml
90
+ ```
91
+
92
+ ```bash
93
+ rye run pytest
94
+ ```
95
+
96
+ ## Linting and formatting
97
+
98
+ This repository uses [ruff](https://github.com/astral-sh/ruff) and
99
+ [black](https://github.com/psf/black) to format the code in the repository.
100
+
101
+ To lint:
102
+
103
+ ```bash
104
+ rye run lint
105
+ ```
106
+
107
+ To format and fix all ruff issues automatically:
108
+
109
+ ```bash
110
+ rye run format
111
+ ```
112
+
113
+ ## Publishing and releases
114
+
115
+ Changes made to this repository via the automated release PR pipeline should publish to PyPI automatically. If
116
+ the changes aren't made through the automated pipeline, you may want to make releases manually.
117
+
118
+ ### Publish with a GitHub workflow
119
+
120
+ You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/runloopai/api-client-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
121
+
122
+ ### Publish manually
123
+
124
+ If you need to manually release a package, you can run the `bin/publish-pypi` script with a `PYPI_TOKEN` set on
125
+ the environment.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: runloop_api_client
3
- Version: 0.1.0a4
3
+ Version: 0.1.0a5
4
4
  Summary: The official Python library for the runloop API
5
5
  Project-URL: Homepage, https://github.com/runloopai/api-client-python
6
6
  Project-URL: Repository, https://github.com/runloopai/api-client-python
@@ -0,0 +1,300 @@
1
+ # Runloop Python API library
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/runloop_api_client.svg)](https://pypi.org/project/runloop_api_client/)
4
+
5
+ The Runloop Python library provides convenient access to the Runloop REST API from any Python 3.7+
6
+ application. The library includes type definitions for all request params and response fields,
7
+ and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
8
+
9
+ It is generated with [Stainless](https://www.stainlessapi.com/).
10
+
11
+ ## Documentation
12
+
13
+ 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](api.md).
14
+
15
+ ## Installation
16
+
17
+ ```sh
18
+ # install from PyPI
19
+ pip install --pre runloop_api_client
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ The full API of this library can be found in [api.md](api.md).
25
+
26
+ ```python
27
+ import os
28
+ from runloop_api_client import Runloop
29
+
30
+ client = Runloop(
31
+ # This is the default and can be omitted
32
+ bearer_token=os.environ.get("RUNLOOP_BEARER_TOKEN"),
33
+ )
34
+
35
+ devbox_view = client.devboxes.create()
36
+ print(devbox_view.id)
37
+ ```
38
+
39
+ While you can provide a `bearer_token` keyword argument,
40
+ we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
41
+ to add `RUNLOOP_BEARER_TOKEN="My Bearer Token"` to your `.env` file
42
+ so that your Bearer Token is not stored in source control.
43
+
44
+ ## Async usage
45
+
46
+ Simply import `AsyncRunloop` instead of `Runloop` and use `await` with each API call:
47
+
48
+ ```python
49
+ import os
50
+ import asyncio
51
+ from runloop_api_client import AsyncRunloop
52
+
53
+ client = AsyncRunloop(
54
+ # This is the default and can be omitted
55
+ bearer_token=os.environ.get("RUNLOOP_BEARER_TOKEN"),
56
+ )
57
+
58
+
59
+ async def main() -> None:
60
+ devbox_view = await client.devboxes.create()
61
+ print(devbox_view.id)
62
+
63
+
64
+ asyncio.run(main())
65
+ ```
66
+
67
+ Functionality between the synchronous and asynchronous clients is otherwise identical.
68
+
69
+ ## Using types
70
+
71
+ 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:
72
+
73
+ - Serializing back into JSON, `model.to_json()`
74
+ - Converting to a dictionary, `model.to_dict()`
75
+
76
+ 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`.
77
+
78
+ ## Handling errors
79
+
80
+ When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `runloop_api_client.APIConnectionError` is raised.
81
+
82
+ When the API returns a non-success status code (that is, 4xx or 5xx
83
+ response), a subclass of `runloop_api_client.APIStatusError` is raised, containing `status_code` and `response` properties.
84
+
85
+ All errors inherit from `runloop_api_client.APIError`.
86
+
87
+ ```python
88
+ import runloop_api_client
89
+ from runloop_api_client import Runloop
90
+
91
+ client = Runloop()
92
+
93
+ try:
94
+ client.devboxes.create()
95
+ except runloop_api_client.APIConnectionError as e:
96
+ print("The server could not be reached")
97
+ print(e.__cause__) # an underlying Exception, likely raised within httpx.
98
+ except runloop_api_client.RateLimitError as e:
99
+ print("A 429 status code was received; we should back off a bit.")
100
+ except runloop_api_client.APIStatusError as e:
101
+ print("Another non-200-range status code was received")
102
+ print(e.status_code)
103
+ print(e.response)
104
+ ```
105
+
106
+ Error codes are as followed:
107
+
108
+ | Status Code | Error Type |
109
+ | ----------- | -------------------------- |
110
+ | 400 | `BadRequestError` |
111
+ | 401 | `AuthenticationError` |
112
+ | 403 | `PermissionDeniedError` |
113
+ | 404 | `NotFoundError` |
114
+ | 422 | `UnprocessableEntityError` |
115
+ | 429 | `RateLimitError` |
116
+ | >=500 | `InternalServerError` |
117
+ | N/A | `APIConnectionError` |
118
+
119
+ ### Retries
120
+
121
+ Certain errors are automatically retried 2 times by default, with a short exponential backoff.
122
+ Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
123
+ 429 Rate Limit, and >=500 Internal errors are all retried by default.
124
+
125
+ You can use the `max_retries` option to configure or disable retry settings:
126
+
127
+ ```python
128
+ from runloop_api_client import Runloop
129
+
130
+ # Configure the default for all requests:
131
+ client = Runloop(
132
+ # default is 2
133
+ max_retries=0,
134
+ )
135
+
136
+ # Or, configure per-request:
137
+ client.with_options(max_retries=5).devboxes.create()
138
+ ```
139
+
140
+ ### Timeouts
141
+
142
+ By default requests time out after 1 minute. You can configure this with a `timeout` option,
143
+ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
144
+
145
+ ```python
146
+ from runloop_api_client import Runloop
147
+
148
+ # Configure the default for all requests:
149
+ client = Runloop(
150
+ # 20 seconds (default is 1 minute)
151
+ timeout=20.0,
152
+ )
153
+
154
+ # More granular control:
155
+ client = Runloop(
156
+ timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
157
+ )
158
+
159
+ # Override per-request:
160
+ client.with_options(timeout=5.0).devboxes.create()
161
+ ```
162
+
163
+ On timeout, an `APITimeoutError` is thrown.
164
+
165
+ Note that requests that time out are [retried twice by default](#retries).
166
+
167
+ ## Advanced
168
+
169
+ ### Logging
170
+
171
+ We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
172
+
173
+ You can enable logging by setting the environment variable `RUNLOOP_LOG` to `debug`.
174
+
175
+ ```shell
176
+ $ export RUNLOOP_LOG=debug
177
+ ```
178
+
179
+ ### How to tell whether `None` means `null` or missing
180
+
181
+ 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`:
182
+
183
+ ```py
184
+ if response.my_field is None:
185
+ if 'my_field' not in response.model_fields_set:
186
+ print('Got json like {}, without a "my_field" key present at all.')
187
+ else:
188
+ print('Got json like {"my_field": null}.')
189
+ ```
190
+
191
+ ### Accessing raw response data (e.g. headers)
192
+
193
+ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
194
+
195
+ ```py
196
+ from runloop_api_client import Runloop
197
+
198
+ client = Runloop()
199
+ response = client.devboxes.with_raw_response.create()
200
+ print(response.headers.get('X-My-Header'))
201
+
202
+ devbox = response.parse() # get the object that `devboxes.create()` would have returned
203
+ print(devbox.id)
204
+ ```
205
+
206
+ These methods return an [`APIResponse`](https://github.com/runloopai/api-client-python/tree/main/src/runloop_api_client/_response.py) object.
207
+
208
+ The async client returns an [`AsyncAPIResponse`](https://github.com/runloopai/api-client-python/tree/main/src/runloop_api_client/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
209
+
210
+ #### `.with_streaming_response`
211
+
212
+ The above interface eagerly reads the full response body when you make the request, which may not always be what you want.
213
+
214
+ 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.
215
+
216
+ ```python
217
+ with client.devboxes.with_streaming_response.create() as response:
218
+ print(response.headers.get("X-My-Header"))
219
+
220
+ for line in response.iter_lines():
221
+ print(line)
222
+ ```
223
+
224
+ The context manager is required so that the response will reliably be closed.
225
+
226
+ ### Making custom/undocumented requests
227
+
228
+ This library is typed for convenient access to the documented API.
229
+
230
+ If you need to access undocumented endpoints, params, or response properties, the library can still be used.
231
+
232
+ #### Undocumented endpoints
233
+
234
+ To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
235
+ http verbs. Options on the client will be respected (such as retries) will be respected when making this
236
+ request.
237
+
238
+ ```py
239
+ import httpx
240
+
241
+ response = client.post(
242
+ "/foo",
243
+ cast_to=httpx.Response,
244
+ body={"my_param": True},
245
+ )
246
+
247
+ print(response.headers.get("x-foo"))
248
+ ```
249
+
250
+ #### Undocumented request params
251
+
252
+ If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request
253
+ options.
254
+
255
+ #### Undocumented response properties
256
+
257
+ To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You
258
+ can also get all the extra fields on the Pydantic model as a dict with
259
+ [`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).
260
+
261
+ ### Configuring the HTTP client
262
+
263
+ You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
264
+
265
+ - Support for proxies
266
+ - Custom transports
267
+ - Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
268
+
269
+ ```python
270
+ from runloop_api_client import Runloop, DefaultHttpxClient
271
+
272
+ client = Runloop(
273
+ # Or use the `RUNLOOP_BASE_URL` env var
274
+ base_url="http://my.test.server.example.com:8083",
275
+ http_client=DefaultHttpxClient(
276
+ proxies="http://my.test.proxy.example.com",
277
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
278
+ ),
279
+ )
280
+ ```
281
+
282
+ ### Managing HTTP resources
283
+
284
+ 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.
285
+
286
+ ## Versioning
287
+
288
+ 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:
289
+
290
+ 1. Changes that only affect static types, without breaking runtime behavior.
291
+ 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)_.
292
+ 3. Changes that we do not expect to impact the vast majority of users in practice.
293
+
294
+ We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
295
+
296
+ We are keen for your feedback; please open an [issue](https://www.github.com/runloopai/api-client-python/issues) with questions, bugs, or suggestions.
297
+
298
+ ## Requirements
299
+
300
+ Python 3.7 or higher.
@@ -0,0 +1,27 @@
1
+ # Security Policy
2
+
3
+ ## Reporting Security Issues
4
+
5
+ This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.
6
+
7
+ To report a security issue, please contact the Stainless team at security@stainlessapi.com.
8
+
9
+ ## Responsible Disclosure
10
+
11
+ We appreciate the efforts of security researchers and individuals who help us maintain the security of
12
+ SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible
13
+ disclosure practices by allowing us a reasonable amount of time to investigate and address the issue
14
+ before making any information public.
15
+
16
+ ## Reporting Non-SDK Related Security Issues
17
+
18
+ If you encounter security issues that are not directly related to SDKs but pertain to the services
19
+ or products provided by Runloop please follow the respective company's security reporting guidelines.
20
+
21
+ ### Runloop Terms and Policies
22
+
23
+ Please contact support@runloop.ai for any questions or concerns regarding security of our services.
24
+
25
+ ---
26
+
27
+ Thank you for helping us keep the SDKs and systems they interact with secure.
@@ -0,0 +1,79 @@
1
+ # Shared Types
2
+
3
+ ```python
4
+ from runloop_api_client.types import FunctionInvocationDetailView, ProjectLogsView
5
+ ```
6
+
7
+ # Devboxes
8
+
9
+ Types:
10
+
11
+ ```python
12
+ from runloop_api_client.types import DevboxExecutionDetailView, DevboxListView, DevboxView
13
+ ```
14
+
15
+ Methods:
16
+
17
+ - <code title="post /v1/devboxes">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">create</a>(\*\*<a href="src/runloop_api_client/types/devbox_create_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>
18
+ - <code title="get /v1/devboxes/{id}">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">retrieve</a>(id) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>
19
+ - <code title="get /v1/devboxes">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">list</a>(\*\*<a href="src/runloop_api_client/types/devbox_list_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_list_view.py">DevboxListView</a></code>
20
+ - <code title="post /v1/devboxes/{id}/execute_sync">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">execute_sync</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_execute_sync_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
21
+ - <code title="post /v1/devboxes/{id}/shutdown">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">shutdown</a>(id) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>
22
+
23
+ ## Logs
24
+
25
+ Types:
26
+
27
+ ```python
28
+ from runloop_api_client.types.devboxes import DevboxLogsListView
29
+ ```
30
+
31
+ Methods:
32
+
33
+ - <code title="get /v1/devboxes/{id}/logs">client.devboxes.logs.<a href="./src/runloop_api_client/resources/devboxes/logs.py">list</a>(id) -> <a href="./src/runloop_api_client/types/devboxes/devbox_logs_list_view.py">DevboxLogsListView</a></code>
34
+
35
+ # Functions
36
+
37
+ Types:
38
+
39
+ ```python
40
+ from runloop_api_client.types import FunctionListView
41
+ ```
42
+
43
+ Methods:
44
+
45
+ - <code title="get /v1/functions">client.functions.<a href="./src/runloop_api_client/resources/functions/functions.py">list</a>() -> <a href="./src/runloop_api_client/types/function_list_view.py">FunctionListView</a></code>
46
+ - <code title="post /v1/functions/{project_name}/{function_name}/invoke_async">client.functions.<a href="./src/runloop_api_client/resources/functions/functions.py">invoke_async</a>(function_name, \*, project_name, \*\*<a href="src/runloop_api_client/types/function_invoke_async_params.py">params</a>) -> <a href="./src/runloop_api_client/types/shared/function_invocation_detail_view.py">FunctionInvocationDetailView</a></code>
47
+ - <code title="post /v1/functions/{project_name}/{function_name}/invoke_sync">client.functions.<a href="./src/runloop_api_client/resources/functions/functions.py">invoke_sync</a>(function_name, \*, project_name, \*\*<a href="src/runloop_api_client/types/function_invoke_sync_params.py">params</a>) -> <a href="./src/runloop_api_client/types/shared/function_invocation_detail_view.py">FunctionInvocationDetailView</a></code>
48
+
49
+ ## Invocations
50
+
51
+ Types:
52
+
53
+ ```python
54
+ from runloop_api_client.types.functions import FunctionInvocationListView, KillOperationResponse
55
+ ```
56
+
57
+ Methods:
58
+
59
+ - <code title="get /v1/functions/invocations/{invocationId}">client.functions.invocations.<a href="./src/runloop_api_client/resources/functions/invocations/invocations.py">retrieve</a>(invocation_id) -> <a href="./src/runloop_api_client/types/shared/function_invocation_detail_view.py">FunctionInvocationDetailView</a></code>
60
+ - <code title="get /v1/functions/invocations">client.functions.invocations.<a href="./src/runloop_api_client/resources/functions/invocations/invocations.py">list</a>() -> <a href="./src/runloop_api_client/types/functions/function_invocation_list_view.py">FunctionInvocationListView</a></code>
61
+ - <code title="post /v1/functions/invocations/{invocationId}/kill">client.functions.invocations.<a href="./src/runloop_api_client/resources/functions/invocations/invocations.py">kill</a>(invocation_id) -> <a href="./src/runloop_api_client/types/functions/kill_operation_response.py">object</a></code>
62
+
63
+ # Projects
64
+
65
+ Types:
66
+
67
+ ```python
68
+ from runloop_api_client.types import ProjectListView
69
+ ```
70
+
71
+ Methods:
72
+
73
+ - <code title="get /v1/projects">client.projects.<a href="./src/runloop_api_client/resources/projects/projects.py">list</a>() -> <a href="./src/runloop_api_client/types/project_list_view.py">ProjectListView</a></code>
74
+
75
+ ## Logs
76
+
77
+ Methods:
78
+
79
+ - <code title="get /v1/projects/{id}/logs">client.projects.logs.<a href="./src/runloop_api_client/resources/projects/logs.py">list</a>(id) -> <a href="./src/runloop_api_client/types/shared/project_logs_view.py">ProjectLogsView</a></code>
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env bash
2
+
3
+ warnings=()
4
+ errors=()
5
+
6
+ if [ -z "${PYPI_TOKEN}" ]; then
7
+ warnings+=("The RUNLOOP_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
8
+ fi
9
+
10
+ lenWarnings=${#warnings[@]}
11
+
12
+ if [[ lenWarnings -gt 0 ]]; then
13
+ echo -e "Found the following warnings in the release environment:\n"
14
+
15
+ for warning in "${warnings[@]}"; do
16
+ echo -e "- $warning\n"
17
+ done
18
+ fi
19
+
20
+ lenErrors=${#errors[@]}
21
+
22
+ if [[ lenErrors -gt 0 ]]; then
23
+ echo -e "Found the following errors in the release environment:\n"
24
+
25
+ for error in "${errors[@]}"; do
26
+ echo -e "- $error\n"
27
+ done
28
+
29
+ exit 1
30
+ fi
31
+
32
+ echo "The environment is ready to push releases!"
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -eux
4
+ mkdir -p dist
5
+ rye build --clean
6
+ # Patching importlib-metadata version until upstream library version is updated
7
+ # https://github.com/pypa/twine/issues/977#issuecomment-2189800841
8
+ "$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1'
9
+ rye publish --yes --token=$PYPI_TOKEN
@@ -0,0 +1,4 @@
1
+ File generated from our OpenAPI spec by Stainless.
2
+
3
+ This directory can be used to store example files demonstrating usage of this SDK.
4
+ It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.