Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.1.0-alpha.4 #14

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.3"
".": "0.1.0-alpha.4"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.1.0-alpha.4 (2024-04-18)

Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/riza-io/riza-api-python/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)

### Features

* **api:** update via SDK Studio ([#13](https://github.com/riza-io/riza-api-python/issues/13)) ([b8df108](https://github.com/riza-io/riza-api-python/commit/b8df10863e947363a911582eeee371f67db20ca0))

## 0.1.0-alpha.3 (2024-04-18)

Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/riza-io/riza-api-python/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ client = Riza(
api_key=os.environ.get("RIZA_API_KEY"),
)

code_execute_response = client.code.execute()
print(code_execute_response.exit_code)
sandbox_execute_response = client.sandbox.execute()
print(sandbox_execute_response.exit_code)
```

While you can provide an `api_key` keyword argument,
Expand All @@ -57,8 +57,8 @@ client = AsyncRiza(


async def main() -> None:
code_execute_response = await client.code.execute()
print(code_execute_response.exit_code)
sandbox_execute_response = await client.sandbox.execute()
print(sandbox_execute_response.exit_code)


asyncio.run(main())
Expand Down Expand Up @@ -91,7 +91,7 @@ from rizaio import Riza
client = Riza()

try:
client.code.execute()
client.sandbox.execute()
except rizaio.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
Expand Down Expand Up @@ -134,7 +134,7 @@ client = Riza(
)

# Or, configure per-request:
client.with_options(max_retries=5).code.execute()
client.with_options(max_retries=5).sandbox.execute()
```

### Timeouts
Expand All @@ -157,7 +157,7 @@ client = Riza(
)

# Override per-request:
client.with_options(timeout=5 * 1000).code.execute()
client.with_options(timeout=5 * 1000).sandbox.execute()
```

On timeout, an `APITimeoutError` is thrown.
Expand Down Expand Up @@ -196,11 +196,11 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
from rizaio import Riza

client = Riza()
response = client.code.with_raw_response.execute()
response = client.sandbox.with_raw_response.execute()
print(response.headers.get('X-My-Header'))

code = response.parse() # get the object that `code.execute()` would have returned
print(code.exit_code)
sandbox = response.parse() # get the object that `sandbox.execute()` would have returned
print(sandbox.exit_code)
```

These methods return an [`APIResponse`](https://github.com/riza-io/riza-api-python/tree/main/src/rizaio/_response.py) object.
Expand All @@ -214,7 +214,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.code.with_streaming_response.execute() as response:
with client.sandbox.with_streaming_response.execute() as response:
print(response.headers.get("X-My-Header"))

for line in response.iter_lines():
Expand Down
6 changes: 3 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Code
# Sandbox

Types:

```python
from rizaio.types import CodeExecuteResponse
from rizaio.types import SandboxExecuteResponse
```

Methods:

- <code title="post /v1/execute">client.code.<a href="./src/rizaio/resources/code.py">execute</a>(\*\*<a href="src/rizaio/types/code_execute_params.py">params</a>) -> <a href="./src/rizaio/types/code_execute_response.py">CodeExecuteResponse</a></code>
- <code title="post /v1/execute">client.sandbox.<a href="./src/rizaio/resources/sandbox.py">execute</a>(\*\*<a href="src/rizaio/types/sandbox_execute_params.py">params</a>) -> <a href="./src/rizaio/types/sandbox_execute_response.py">SandboxExecuteResponse</a></code>
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "rizaio"
version = "0.1.0-alpha.3"
version = "0.1.0-alpha.4"
description = "The official Python library for the riza API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
16 changes: 8 additions & 8 deletions src/rizaio/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@


class Riza(SyncAPIClient):
code: resources.Code
sandbox: resources.Sandbox
with_raw_response: RizaWithRawResponse
with_streaming_response: RizaWithStreamedResponse

Expand Down Expand Up @@ -104,7 +104,7 @@ def __init__(
_strict_response_validation=_strict_response_validation,
)

self.code = resources.Code(self)
self.sandbox = resources.Sandbox(self)
self.with_raw_response = RizaWithRawResponse(self)
self.with_streaming_response = RizaWithStreamedResponse(self)

Expand Down Expand Up @@ -214,7 +214,7 @@ def _make_status_error(


class AsyncRiza(AsyncAPIClient):
code: resources.AsyncCode
sandbox: resources.AsyncSandbox
with_raw_response: AsyncRizaWithRawResponse
with_streaming_response: AsyncRizaWithStreamedResponse

Expand Down Expand Up @@ -272,7 +272,7 @@ def __init__(
_strict_response_validation=_strict_response_validation,
)

self.code = resources.AsyncCode(self)
self.sandbox = resources.AsyncSandbox(self)
self.with_raw_response = AsyncRizaWithRawResponse(self)
self.with_streaming_response = AsyncRizaWithStreamedResponse(self)

Expand Down Expand Up @@ -383,22 +383,22 @@ def _make_status_error(

class RizaWithRawResponse:
def __init__(self, client: Riza) -> None:
self.code = resources.CodeWithRawResponse(client.code)
self.sandbox = resources.SandboxWithRawResponse(client.sandbox)


class AsyncRizaWithRawResponse:
def __init__(self, client: AsyncRiza) -> None:
self.code = resources.AsyncCodeWithRawResponse(client.code)
self.sandbox = resources.AsyncSandboxWithRawResponse(client.sandbox)


class RizaWithStreamedResponse:
def __init__(self, client: Riza) -> None:
self.code = resources.CodeWithStreamingResponse(client.code)
self.sandbox = resources.SandboxWithStreamingResponse(client.sandbox)


class AsyncRizaWithStreamedResponse:
def __init__(self, client: AsyncRiza) -> None:
self.code = resources.AsyncCodeWithStreamingResponse(client.code)
self.sandbox = resources.AsyncSandboxWithStreamingResponse(client.sandbox)


Client = Riza
Expand Down
2 changes: 1 addition & 1 deletion src/rizaio/_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__ = "rizaio"
__version__ = "0.1.0-alpha.3" # x-release-please-version
__version__ = "0.1.0-alpha.4" # x-release-please-version
26 changes: 13 additions & 13 deletions src/rizaio/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .code import (
Code,
AsyncCode,
CodeWithRawResponse,
AsyncCodeWithRawResponse,
CodeWithStreamingResponse,
AsyncCodeWithStreamingResponse,
from .sandbox import (
Sandbox,
AsyncSandbox,
SandboxWithRawResponse,
AsyncSandboxWithRawResponse,
SandboxWithStreamingResponse,
AsyncSandboxWithStreamingResponse,
)

__all__ = [
"Code",
"AsyncCode",
"CodeWithRawResponse",
"AsyncCodeWithRawResponse",
"CodeWithStreamingResponse",
"AsyncCodeWithStreamingResponse",
"Sandbox",
"AsyncSandbox",
"SandboxWithRawResponse",
"AsyncSandboxWithRawResponse",
"SandboxWithStreamingResponse",
"AsyncSandboxWithStreamingResponse",
]
68 changes: 34 additions & 34 deletions src/rizaio/resources/code.py → src/rizaio/resources/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import httpx

from ..types import CodeExecuteResponse, code_execute_params
from ..types import SandboxExecuteResponse, sandbox_execute_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import (
maybe_transform,
Expand All @@ -25,17 +25,17 @@
make_request_options,
)

__all__ = ["Code", "AsyncCode"]
__all__ = ["Sandbox", "AsyncSandbox"]


class Code(SyncAPIResource):
class Sandbox(SyncAPIResource):
@cached_property
def with_raw_response(self) -> CodeWithRawResponse:
return CodeWithRawResponse(self)
def with_raw_response(self) -> SandboxWithRawResponse:
return SandboxWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> CodeWithStreamingResponse:
return CodeWithStreamingResponse(self)
def with_streaming_response(self) -> SandboxWithStreamingResponse:
return SandboxWithStreamingResponse(self)

def execute(
self,
Expand All @@ -51,7 +51,7 @@ def execute(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> CodeExecuteResponse:
) -> SandboxExecuteResponse:
"""
Args:
extra_headers: Send extra headers
Expand All @@ -72,23 +72,23 @@ def execute(
"language": language,
"stdin": stdin,
},
code_execute_params.CodeExecuteParams,
sandbox_execute_params.SandboxExecuteParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=CodeExecuteResponse,
cast_to=SandboxExecuteResponse,
)


class AsyncCode(AsyncAPIResource):
class AsyncSandbox(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncCodeWithRawResponse:
return AsyncCodeWithRawResponse(self)
def with_raw_response(self) -> AsyncSandboxWithRawResponse:
return AsyncSandboxWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> AsyncCodeWithStreamingResponse:
return AsyncCodeWithStreamingResponse(self)
def with_streaming_response(self) -> AsyncSandboxWithStreamingResponse:
return AsyncSandboxWithStreamingResponse(self)

async def execute(
self,
Expand All @@ -104,7 +104,7 @@ async def execute(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> CodeExecuteResponse:
) -> SandboxExecuteResponse:
"""
Args:
extra_headers: Send extra headers
Expand All @@ -125,46 +125,46 @@ async def execute(
"language": language,
"stdin": stdin,
},
code_execute_params.CodeExecuteParams,
sandbox_execute_params.SandboxExecuteParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=CodeExecuteResponse,
cast_to=SandboxExecuteResponse,
)


class CodeWithRawResponse:
def __init__(self, code: Code) -> None:
self._code = code
class SandboxWithRawResponse:
def __init__(self, sandbox: Sandbox) -> None:
self._sandbox = sandbox

self.execute = to_raw_response_wrapper(
code.execute,
sandbox.execute,
)


class AsyncCodeWithRawResponse:
def __init__(self, code: AsyncCode) -> None:
self._code = code
class AsyncSandboxWithRawResponse:
def __init__(self, sandbox: AsyncSandbox) -> None:
self._sandbox = sandbox

self.execute = async_to_raw_response_wrapper(
code.execute,
sandbox.execute,
)


class CodeWithStreamingResponse:
def __init__(self, code: Code) -> None:
self._code = code
class SandboxWithStreamingResponse:
def __init__(self, sandbox: Sandbox) -> None:
self._sandbox = sandbox

self.execute = to_streamed_response_wrapper(
code.execute,
sandbox.execute,
)


class AsyncCodeWithStreamingResponse:
def __init__(self, code: AsyncCode) -> None:
self._code = code
class AsyncSandboxWithStreamingResponse:
def __init__(self, sandbox: AsyncSandbox) -> None:
self._sandbox = sandbox

self.execute = async_to_streamed_response_wrapper(
code.execute,
sandbox.execute,
)
4 changes: 2 additions & 2 deletions src/rizaio/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

from __future__ import annotations

from .code_execute_params import CodeExecuteParams as CodeExecuteParams
from .code_execute_response import CodeExecuteResponse as CodeExecuteResponse
from .sandbox_execute_params import SandboxExecuteParams as SandboxExecuteParams
from .sandbox_execute_response import SandboxExecuteResponse as SandboxExecuteResponse
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from typing import Dict, List
from typing_extensions import Literal, TypedDict

__all__ = ["CodeExecuteParams"]
__all__ = ["SandboxExecuteParams"]


class CodeExecuteParams(TypedDict, total=False):
class SandboxExecuteParams(TypedDict, total=False):
args: List[str]

code: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from .._models import BaseModel

__all__ = ["CodeExecuteResponse"]
__all__ = ["SandboxExecuteResponse"]


class CodeExecuteResponse(BaseModel):
class SandboxExecuteResponse(BaseModel):
exit_code: Optional[int] = None

stderr: Optional[str] = None
Expand Down
Loading
Loading