Skip to content

Commit

Permalink
release: 0.1.0-alpha.3 (#23)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
stainless-app[bot] authored Feb 14, 2025
1 parent f7cb124 commit 0e54db3
Showing 75 changed files with 1,323 additions and 744 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.2"
".": "0.1.0-alpha.3"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 111
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-36f9d46890bf3667f5a6529bdb156fe1560834ad8187c4271aa0b0024de1adb5.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-988164042da1361feb3d28364c6f14fee775ceab496b9d79d048141c0fa6da19.yml
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## 0.1.0-alpha.3 (2025-02-14)

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)

### Features

* **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))
* **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))
* **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))
* **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))
* **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))
* **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))


### Bug Fixes

* 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))


### Chores

* **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))
* **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))

## 0.1.0-alpha.2 (2025-02-12)

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)
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ It is generated with [Stainless](https://www.stainlessapi.com/).

## Documentation

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).
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).

## Installation

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

runner = client.runners.create()
print(runner.access_token)
response = client.identity.get_authenticated_identity()
print(response.organization_id)
```

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


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


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

client = Gitpod()

all_services = []
all_environments = []
# Automatically fetches more pages as needed.
for service in client.environments.automations.services.list():
# Do something with service here
all_services.append(service)
print(all_services)
for environment in client.environments.list():
# Do something with environment here
all_environments.append(environment)
print(all_environments)
```

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


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


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

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

# Remove `await` for non-async usage.
```

Or just work directly with the returned data:

```python
first_page = await client.environments.automations.services.list()
first_page = await client.environments.list()

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

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

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

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

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

# Override per-request:
client.with_options(timeout=5.0).runners.create()
client.with_options(timeout=5.0).identity.get_authenticated_identity()
```

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

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

runner = response.parse() # get the object that `runners.create()` would have returned
print(runner.access_token)
identity = response.parse() # get the object that `identity.get_authenticated_identity()` would have returned
print(identity.organization_id)
```

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
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.

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

for line in response.iter_lines():
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "gitpod-sdk"
version = "0.1.0-alpha.2"
version = "0.1.0-alpha.3"
description = "The official Python library for the gitpod API"
dynamic = ["readme"]
license = "Apache-2.0"
19 changes: 17 additions & 2 deletions src/gitpod/_utils/_sync.py
Original file line number Diff line number Diff line change
@@ -7,16 +7,20 @@
from typing import Any, TypeVar, Callable, Awaitable
from typing_extensions import ParamSpec

import anyio
import sniffio
import anyio.to_thread

T_Retval = TypeVar("T_Retval")
T_ParamSpec = ParamSpec("T_ParamSpec")


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


async def to_thread(
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
) -> T_Retval:
if sniffio.current_async_library() == "asyncio":
return await _asyncio_to_thread(func, *args, **kwargs)

return await anyio.to_thread.run_sync(
functools.partial(func, *args, **kwargs),
)


# inspired by `asyncer`, https://github.com/tiangolo/asyncer
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
"""
2 changes: 1 addition & 1 deletion src/gitpod/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "gitpod"
__version__ = "0.1.0-alpha.2" # x-release-please-version
__version__ = "0.1.0-alpha.3" # x-release-please-version
8 changes: 4 additions & 4 deletions src/gitpod/resources/accounts.py
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ def retrieve(
def delete(
self,
*,
account_id: str | NotGiven = NOT_GIVEN,
account_id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@@ -123,7 +123,7 @@ def delete(
def get_sso_login_url(
self,
*,
email: str | NotGiven = NOT_GIVEN,
email: str,
return_to: Optional[str] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# 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(
async def delete(
self,
*,
account_id: str | NotGiven = NOT_GIVEN,
account_id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@@ -311,7 +311,7 @@ async def delete(
async def get_sso_login_url(
self,
*,
email: str | NotGiven = NOT_GIVEN,
email: str,
return_to: Optional[str] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
16 changes: 8 additions & 8 deletions src/gitpod/resources/editors.py
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ def with_streaming_response(self) -> EditorsResourceWithStreamingResponse:
def retrieve(
self,
*,
id: str | NotGiven = NOT_GIVEN,
id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@@ -132,9 +132,9 @@ def list(
def resolve_url(
self,
*,
editor_id: str | NotGiven = NOT_GIVEN,
environment_id: str | NotGiven = NOT_GIVEN,
organization_id: str | NotGiven = NOT_GIVEN,
editor_id: str,
environment_id: str,
organization_id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@@ -200,7 +200,7 @@ def with_streaming_response(self) -> AsyncEditorsResourceWithStreamingResponse:
async def retrieve(
self,
*,
id: str | NotGiven = NOT_GIVEN,
id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
@@ -282,9 +282,9 @@ def list(
async def resolve_url(
self,
*,
editor_id: str | NotGiven = NOT_GIVEN,
environment_id: str | NotGiven = NOT_GIVEN,
organization_id: str | NotGiven = NOT_GIVEN,
editor_id: str,
environment_id: str,
organization_id: str,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
42 changes: 36 additions & 6 deletions src/gitpod/resources/environments/classes.py
Original file line number Diff line number Diff line change
@@ -57,9 +57,24 @@ def list(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncEnvironmentClassesPage[EnvironmentClass]:
"""
ListEnvironmentClasses returns the list of environment classes with runner
details a user is able to use based on the query buf:lint:ignore
RPC_REQUEST_RESPONSE_UNIQUE
Lists available environment classes with their specifications and resource
limits.
Use this method to understand what types of environments you can create and
their capabilities. Environment classes define the compute resources and
features available to your environments.
### Examples
- List all available classes:
Retrieves a list of all environment classes with their specifications.
```yaml
{}
```
buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
Args:
pagination: pagination contains the pagination options for listing environment classes
@@ -135,9 +150,24 @@ def list(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[EnvironmentClass, AsyncEnvironmentClassesPage[EnvironmentClass]]:
"""
ListEnvironmentClasses returns the list of environment classes with runner
details a user is able to use based on the query buf:lint:ignore
RPC_REQUEST_RESPONSE_UNIQUE
Lists available environment classes with their specifications and resource
limits.
Use this method to understand what types of environments you can create and
their capabilities. Environment classes define the compute resources and
features available to your environments.
### Examples
- List all available classes:
Retrieves a list of all environment classes with their specifications.
```yaml
{}
```
buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE
Args:
pagination: pagination contains the pagination options for listing environment classes
Loading
Oops, something went wrong.

0 comments on commit 0e54db3

Please sign in to comment.