Skip to content

Commit 0e54db3

Browse files
release: 0.1.0-alpha.3 (#23)
* feat(api): update examples (#22) * feat(api): manual updates (#24) * feat(api): manual updates (#25) * chore(internal): update client tests (#26) * feat(api): update with latest API spec (#27) * feat(api): manual updates (#28) * feat(api): manual updates (#30) * fix: asyncify on non-asyncio runtimes (#31) * chore(internal): update client tests (#32) * release: 0.1.0-alpha.3 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent f7cb124 commit 0e54db3

File tree

75 files changed

+1323
-744
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1323
-744
lines changed

.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.2"
2+
".": "0.1.0-alpha.3"
33
}

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 111
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-36f9d46890bf3667f5a6529bdb156fe1560834ad8187c4271aa0b0024de1adb5.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-988164042da1361feb3d28364c6f14fee775ceab496b9d79d048141c0fa6da19.yml

CHANGELOG.md

+24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Changelog
22

3+
## 0.1.0-alpha.3 (2025-02-14)
4+
5+
Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/gitpod-io/gitpod-sdk-python/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
6+
7+
### Features
8+
9+
* **api:** manual updates ([#24](https://github.com/gitpod-io/gitpod-sdk-python/issues/24)) ([b14af5b](https://github.com/gitpod-io/gitpod-sdk-python/commit/b14af5b14f013a2d966b6dca24abcc45975555e5))
10+
* **api:** manual updates ([#25](https://github.com/gitpod-io/gitpod-sdk-python/issues/25)) ([a13ae46](https://github.com/gitpod-io/gitpod-sdk-python/commit/a13ae465471d0323a2151fc904c8214f295e5a90))
11+
* **api:** manual updates ([#28](https://github.com/gitpod-io/gitpod-sdk-python/issues/28)) ([b763659](https://github.com/gitpod-io/gitpod-sdk-python/commit/b763659e5a226b94311d5f898534794879b279f8))
12+
* **api:** manual updates ([#30](https://github.com/gitpod-io/gitpod-sdk-python/issues/30)) ([45bdb31](https://github.com/gitpod-io/gitpod-sdk-python/commit/45bdb315c9e912833b335244ac1fdb7737c423c2))
13+
* **api:** update examples ([#22](https://github.com/gitpod-io/gitpod-sdk-python/issues/22)) ([a3a0b9d](https://github.com/gitpod-io/gitpod-sdk-python/commit/a3a0b9dbb81bc5915ca65948fc570b406b2b587e))
14+
* **api:** update with latest API spec ([#27](https://github.com/gitpod-io/gitpod-sdk-python/issues/27)) ([80f6e19](https://github.com/gitpod-io/gitpod-sdk-python/commit/80f6e194b049fa48e82fe310c9c56e632588bfb9))
15+
16+
17+
### Bug Fixes
18+
19+
* asyncify on non-asyncio runtimes ([#31](https://github.com/gitpod-io/gitpod-sdk-python/issues/31)) ([507a01e](https://github.com/gitpod-io/gitpod-sdk-python/commit/507a01eb2eaed68da316448a12a98d13034b57f7))
20+
21+
22+
### Chores
23+
24+
* **internal:** update client tests ([#26](https://github.com/gitpod-io/gitpod-sdk-python/issues/26)) ([e4040d1](https://github.com/gitpod-io/gitpod-sdk-python/commit/e4040d15067dea4ce6eb57742e6857bd8c227c4b))
25+
* **internal:** update client tests ([#32](https://github.com/gitpod-io/gitpod-sdk-python/issues/32)) ([47d7150](https://github.com/gitpod-io/gitpod-sdk-python/commit/47d715021c3ca29e930c5b9e928e2f4aeb201ecc))
26+
327
## 0.1.0-alpha.2 (2025-02-12)
428

529
Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/gitpod-io/gitpod-sdk-python/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)

README.md

+26-26
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ It is generated with [Stainless](https://www.stainlessapi.com/).
1010

1111
## Documentation
1212

13-
The REST API documentation can be found on [docs.gitpod.com](https://docs.gitpod.com). The full API of this library can be found in [api.md](api.md).
13+
The REST API documentation can be found on [docs.gitpod.io](https://docs.gitpod.io). The full API of this library can be found in [api.md](api.md).
1414

1515
## Installation
1616

@@ -31,8 +31,8 @@ client = Gitpod(
3131
bearer_token=os.environ.get("GITPOD_API_KEY"), # This is the default and can be omitted
3232
)
3333

34-
runner = client.runners.create()
35-
print(runner.access_token)
34+
response = client.identity.get_authenticated_identity()
35+
print(response.organization_id)
3636
```
3737

3838
While you can provide a `bearer_token` keyword argument,
@@ -55,8 +55,8 @@ client = AsyncGitpod(
5555

5656

5757
async def main() -> None:
58-
runner = await client.runners.create()
59-
print(runner.access_token)
58+
response = await client.identity.get_authenticated_identity()
59+
print(response.organization_id)
6060

6161

6262
asyncio.run(main())
@@ -84,12 +84,12 @@ from gitpod import Gitpod
8484

8585
client = Gitpod()
8686

87-
all_services = []
87+
all_environments = []
8888
# Automatically fetches more pages as needed.
89-
for service in client.environments.automations.services.list():
90-
# Do something with service here
91-
all_services.append(service)
92-
print(all_services)
89+
for environment in client.environments.list():
90+
# Do something with environment here
91+
all_environments.append(environment)
92+
print(all_environments)
9393
```
9494

9595
Or, asynchronously:
@@ -102,11 +102,11 @@ client = AsyncGitpod()
102102

103103

104104
async def main() -> None:
105-
all_services = []
105+
all_environments = []
106106
# Iterate through items across all pages, issuing requests as needed.
107-
async for service in client.environments.automations.services.list():
108-
all_services.append(service)
109-
print(all_services)
107+
async for environment in client.environments.list():
108+
all_environments.append(environment)
109+
print(all_environments)
110110

111111

112112
asyncio.run(main())
@@ -115,23 +115,23 @@ asyncio.run(main())
115115
Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
116116

117117
```python
118-
first_page = await client.environments.automations.services.list()
118+
first_page = await client.environments.list()
119119
if first_page.has_next_page():
120120
print(f"will fetch next page using these details: {first_page.next_page_info()}")
121121
next_page = await first_page.get_next_page()
122-
print(f"number of items we just fetched: {len(next_page.services)}")
122+
print(f"number of items we just fetched: {len(next_page.environments)}")
123123

124124
# Remove `await` for non-async usage.
125125
```
126126

127127
Or just work directly with the returned data:
128128

129129
```python
130-
first_page = await client.environments.automations.services.list()
130+
first_page = await client.environments.list()
131131

132132
print(f"next page cursor: {first_page.pagination.next_token}") # => "next page cursor: ..."
133-
for service in first_page.services:
134-
print(service.id)
133+
for environment in first_page.environments:
134+
print(environment.id)
135135

136136
# Remove `await` for non-async usage.
137137
```
@@ -152,7 +152,7 @@ from gitpod import Gitpod
152152
client = Gitpod()
153153

154154
try:
155-
client.runners.create()
155+
client.identity.get_authenticated_identity()
156156
except gitpod.APIConnectionError as e:
157157
print("The server could not be reached")
158158
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -195,7 +195,7 @@ client = Gitpod(
195195
)
196196

197197
# Or, configure per-request:
198-
client.with_options(max_retries=5).runners.create()
198+
client.with_options(max_retries=5).identity.get_authenticated_identity()
199199
```
200200

201201
### Timeouts
@@ -218,7 +218,7 @@ client = Gitpod(
218218
)
219219

220220
# Override per-request:
221-
client.with_options(timeout=5.0).runners.create()
221+
client.with_options(timeout=5.0).identity.get_authenticated_identity()
222222
```
223223

224224
On timeout, an `APITimeoutError` is thrown.
@@ -259,11 +259,11 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
259259
from gitpod import Gitpod
260260

261261
client = Gitpod()
262-
response = client.runners.with_raw_response.create()
262+
response = client.identity.with_raw_response.get_authenticated_identity()
263263
print(response.headers.get('X-My-Header'))
264264

265-
runner = response.parse() # get the object that `runners.create()` would have returned
266-
print(runner.access_token)
265+
identity = response.parse() # get the object that `identity.get_authenticated_identity()` would have returned
266+
print(identity.organization_id)
267267
```
268268

269269
These methods return an [`APIResponse`](https://github.com/gitpod-io/gitpod-sdk-python/tree/main/src/gitpod/_response.py) object.
@@ -277,7 +277,7 @@ The above interface eagerly reads the full response body when you make the reque
277277
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.
278278

279279
```python
280-
with client.runners.with_streaming_response.create() as response:
280+
with client.identity.with_streaming_response.get_authenticated_identity() as response:
281281
print(response.headers.get("X-My-Header"))
282282

283283
for line in response.iter_lines():

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "gitpod-sdk"
3-
version = "0.1.0-alpha.2"
3+
version = "0.1.0-alpha.3"
44
description = "The official Python library for the gitpod API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/gitpod/_utils/_sync.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@
77
from typing import Any, TypeVar, Callable, Awaitable
88
from typing_extensions import ParamSpec
99

10+
import anyio
11+
import sniffio
12+
import anyio.to_thread
13+
1014
T_Retval = TypeVar("T_Retval")
1115
T_ParamSpec = ParamSpec("T_ParamSpec")
1216

1317

1418
if sys.version_info >= (3, 9):
15-
to_thread = asyncio.to_thread
19+
_asyncio_to_thread = asyncio.to_thread
1620
else:
1721
# backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
1822
# for Python 3.8 support
19-
async def to_thread(
23+
async def _asyncio_to_thread(
2024
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
2125
) -> Any:
2226
"""Asynchronously run function *func* in a separate thread.
@@ -34,6 +38,17 @@ async def to_thread(
3438
return await loop.run_in_executor(None, func_call)
3539

3640

41+
async def to_thread(
42+
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
43+
) -> T_Retval:
44+
if sniffio.current_async_library() == "asyncio":
45+
return await _asyncio_to_thread(func, *args, **kwargs)
46+
47+
return await anyio.to_thread.run_sync(
48+
functools.partial(func, *args, **kwargs),
49+
)
50+
51+
3752
# inspired by `asyncer`, https://github.com/tiangolo/asyncer
3853
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
3954
"""

src/gitpod/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "gitpod"
4-
__version__ = "0.1.0-alpha.2" # x-release-please-version
4+
__version__ = "0.1.0-alpha.3" # x-release-please-version

src/gitpod/resources/accounts.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def retrieve(
8989
def delete(
9090
self,
9191
*,
92-
account_id: str | NotGiven = NOT_GIVEN,
92+
account_id: str,
9393
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
9494
# The extra values given here take precedence over values defined on the client or passed to this method.
9595
extra_headers: Headers | None = None,
@@ -123,7 +123,7 @@ def delete(
123123
def get_sso_login_url(
124124
self,
125125
*,
126-
email: str | NotGiven = NOT_GIVEN,
126+
email: str,
127127
return_to: Optional[str] | NotGiven = NOT_GIVEN,
128128
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
129129
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -277,7 +277,7 @@ async def retrieve(
277277
async def delete(
278278
self,
279279
*,
280-
account_id: str | NotGiven = NOT_GIVEN,
280+
account_id: str,
281281
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
282282
# The extra values given here take precedence over values defined on the client or passed to this method.
283283
extra_headers: Headers | None = None,
@@ -311,7 +311,7 @@ async def delete(
311311
async def get_sso_login_url(
312312
self,
313313
*,
314-
email: str | NotGiven = NOT_GIVEN,
314+
email: str,
315315
return_to: Optional[str] | NotGiven = NOT_GIVEN,
316316
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
317317
# The extra values given here take precedence over values defined on the client or passed to this method.

src/gitpod/resources/editors.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def with_streaming_response(self) -> EditorsResourceWithStreamingResponse:
5050
def retrieve(
5151
self,
5252
*,
53-
id: str | NotGiven = NOT_GIVEN,
53+
id: str,
5454
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5555
# The extra values given here take precedence over values defined on the client or passed to this method.
5656
extra_headers: Headers | None = None,
@@ -132,9 +132,9 @@ def list(
132132
def resolve_url(
133133
self,
134134
*,
135-
editor_id: str | NotGiven = NOT_GIVEN,
136-
environment_id: str | NotGiven = NOT_GIVEN,
137-
organization_id: str | NotGiven = NOT_GIVEN,
135+
editor_id: str,
136+
environment_id: str,
137+
organization_id: str,
138138
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
139139
# The extra values given here take precedence over values defined on the client or passed to this method.
140140
extra_headers: Headers | None = None,
@@ -200,7 +200,7 @@ def with_streaming_response(self) -> AsyncEditorsResourceWithStreamingResponse:
200200
async def retrieve(
201201
self,
202202
*,
203-
id: str | NotGiven = NOT_GIVEN,
203+
id: str,
204204
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
205205
# The extra values given here take precedence over values defined on the client or passed to this method.
206206
extra_headers: Headers | None = None,
@@ -282,9 +282,9 @@ def list(
282282
async def resolve_url(
283283
self,
284284
*,
285-
editor_id: str | NotGiven = NOT_GIVEN,
286-
environment_id: str | NotGiven = NOT_GIVEN,
287-
organization_id: str | NotGiven = NOT_GIVEN,
285+
editor_id: str,
286+
environment_id: str,
287+
organization_id: str,
288288
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
289289
# The extra values given here take precedence over values defined on the client or passed to this method.
290290
extra_headers: Headers | None = None,

src/gitpod/resources/environments/classes.py

+36-6
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,24 @@ def list(
5757
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
5858
) -> SyncEnvironmentClassesPage[EnvironmentClass]:
5959
"""
60-
ListEnvironmentClasses returns the list of environment classes with runner
61-
details a user is able to use based on the query buf:lint:ignore
62-
RPC_REQUEST_RESPONSE_UNIQUE
60+
Lists available environment classes with their specifications and resource
61+
limits.
62+
63+
Use this method to understand what types of environments you can create and
64+
their capabilities. Environment classes define the compute resources and
65+
features available to your environments.
66+
67+
### Examples
68+
69+
- List all available classes:
70+
71+
Retrieves a list of all environment classes with their specifications.
72+
73+
```yaml
74+
{}
75+
```
76+
77+
buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
6378
6479
Args:
6580
pagination: pagination contains the pagination options for listing environment classes
@@ -135,9 +150,24 @@ def list(
135150
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
136151
) -> AsyncPaginator[EnvironmentClass, AsyncEnvironmentClassesPage[EnvironmentClass]]:
137152
"""
138-
ListEnvironmentClasses returns the list of environment classes with runner
139-
details a user is able to use based on the query buf:lint:ignore
140-
RPC_REQUEST_RESPONSE_UNIQUE
153+
Lists available environment classes with their specifications and resource
154+
limits.
155+
156+
Use this method to understand what types of environments you can create and
157+
their capabilities. Environment classes define the compute resources and
158+
features available to your environments.
159+
160+
### Examples
161+
162+
- List all available classes:
163+
164+
Retrieves a list of all environment classes with their specifications.
165+
166+
```yaml
167+
{}
168+
```
169+
170+
buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
141171
142172
Args:
143173
pagination: pagination contains the pagination options for listing environment classes

0 commit comments

Comments
 (0)