Skip to content

Commit

Permalink
Merge pull request #18 from riza-io/release-please--branches--main--c…
Browse files Browse the repository at this point in the history
…hanges--next

release: 0.1.0-alpha.6
  • Loading branch information
kyleconroy authored Apr 23, 2024
2 parents 2395d76 + 439d723 commit f2a6ef5
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 115 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.5"
".": "0.1.0-alpha.6"
}
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.6 (2024-04-23)

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

### Features

* **api:** update via SDK Studio ([#17](https://github.com/riza-io/riza-api-python/issues/17)) ([cf7aa3b](https://github.com/riza-io/riza-api-python/commit/cf7aa3bc0732faed46e89f6606e968c4f3f01f87))

## 0.1.0-alpha.5 (2024-04-19)

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

sandbox_execute_response = client.sandbox.execute(
command_exec_response = client.command.exec(
code='print("Hello world!")',
language="PYTHON",
)
print(sandbox_execute_response.exit_code)
print(command_exec_response.exit_code)
```

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


async def main() -> None:
sandbox_execute_response = await client.sandbox.execute(
command_exec_response = await client.command.exec(
code='print("Hello world!")',
language="PYTHON",
)
print(sandbox_execute_response.exit_code)
print(command_exec_response.exit_code)


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

try:
client.sandbox.execute(
client.command.exec(
code='print("Hello world!")',
language="PYTHON",
)
Expand Down Expand Up @@ -143,7 +143,7 @@ client = Riza(
)

# Or, configure per-request:
client.with_options(max_retries=5).sandbox.execute(
client.with_options(max_retries=5).command.exec(
code='print("Hello world!")',
language="PYTHON",
)
Expand All @@ -169,7 +169,7 @@ client = Riza(
)

# Override per-request:
client.with_options(timeout=5 * 1000).sandbox.execute(
client.with_options(timeout=5 * 1000).command.exec(
code='print("Hello world!")',
language="PYTHON",
)
Expand Down Expand Up @@ -211,14 +211,14 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
from rizaio import Riza

client = Riza()
response = client.sandbox.with_raw_response.execute(
response = client.command.with_raw_response.exec(
code="print(\"Hello world!\")",
language="PYTHON",
)
print(response.headers.get('X-My-Header'))

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

These methods return an [`APIResponse`](https://github.com/riza-io/riza-api-python/tree/main/src/rizaio/_response.py) object.
Expand All @@ -232,7 +232,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.sandbox.with_streaming_response.execute(
with client.command.with_streaming_response.exec(
code='print("Hello world!")',
language="PYTHON",
) as response:
Expand Down
6 changes: 3 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Sandbox
# Command

Types:

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

Methods:

- <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>
- <code title="post /v1/execute">client.command.<a href="./src/rizaio/resources/command.py">exec</a>(\*\*<a href="src/rizaio/types/command_exec_params.py">params</a>) -> <a href="./src/rizaio/types/command_exec_response.py">CommandExecResponse</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.5"
version = "0.1.0-alpha.6"
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):
sandbox: resources.Sandbox
command: resources.Command
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.sandbox = resources.Sandbox(self)
self.command = resources.Command(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):
sandbox: resources.AsyncSandbox
command: resources.AsyncCommand
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.sandbox = resources.AsyncSandbox(self)
self.command = resources.AsyncCommand(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.sandbox = resources.SandboxWithRawResponse(client.sandbox)
self.command = resources.CommandWithRawResponse(client.command)


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


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


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


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.5" # x-release-please-version
__version__ = "0.1.0-alpha.6" # 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 .sandbox import (
Sandbox,
AsyncSandbox,
SandboxWithRawResponse,
AsyncSandboxWithRawResponse,
SandboxWithStreamingResponse,
AsyncSandboxWithStreamingResponse,
from .command import (
Command,
AsyncCommand,
CommandWithRawResponse,
AsyncCommandWithRawResponse,
CommandWithStreamingResponse,
AsyncCommandWithStreamingResponse,
)

__all__ = [
"Sandbox",
"AsyncSandbox",
"SandboxWithRawResponse",
"AsyncSandboxWithRawResponse",
"SandboxWithStreamingResponse",
"AsyncSandboxWithStreamingResponse",
"Command",
"AsyncCommand",
"CommandWithRawResponse",
"AsyncCommandWithRawResponse",
"CommandWithStreamingResponse",
"AsyncCommandWithStreamingResponse",
]
80 changes: 40 additions & 40 deletions src/rizaio/resources/sandbox.py → src/rizaio/resources/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import httpx

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

__all__ = ["Sandbox", "AsyncSandbox"]
__all__ = ["Command", "AsyncCommand"]


class Sandbox(SyncAPIResource):
class Command(SyncAPIResource):
@cached_property
def with_raw_response(self) -> SandboxWithRawResponse:
return SandboxWithRawResponse(self)
def with_raw_response(self) -> CommandWithRawResponse:
return CommandWithRawResponse(self)

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

def execute(
def exec(
self,
*,
code: str,
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,
) -> SandboxExecuteResponse:
) -> CommandExecResponse:
"""Run a script in a secure, isolated sandbox.
Scripts can read from stdin and
Expand Down Expand Up @@ -87,25 +87,25 @@ def execute(
"env": env,
"stdin": stdin,
},
sandbox_execute_params.SandboxExecuteParams,
command_exec_params.CommandExecParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=SandboxExecuteResponse,
cast_to=CommandExecResponse,
)


class AsyncSandbox(AsyncAPIResource):
class AsyncCommand(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncSandboxWithRawResponse:
return AsyncSandboxWithRawResponse(self)
def with_raw_response(self) -> AsyncCommandWithRawResponse:
return AsyncCommandWithRawResponse(self)

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

async def execute(
async def exec(
self,
*,
code: str,
Expand All @@ -119,7 +119,7 @@ async def execute(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SandboxExecuteResponse:
) -> CommandExecResponse:
"""Run a script in a secure, isolated sandbox.
Scripts can read from stdin and
Expand Down Expand Up @@ -155,46 +155,46 @@ async def execute(
"env": env,
"stdin": stdin,
},
sandbox_execute_params.SandboxExecuteParams,
command_exec_params.CommandExecParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=SandboxExecuteResponse,
cast_to=CommandExecResponse,
)


class SandboxWithRawResponse:
def __init__(self, sandbox: Sandbox) -> None:
self._sandbox = sandbox
class CommandWithRawResponse:
def __init__(self, command: Command) -> None:
self._command = command

self.execute = to_raw_response_wrapper(
sandbox.execute,
self.exec = to_raw_response_wrapper(
command.exec,
)


class AsyncSandboxWithRawResponse:
def __init__(self, sandbox: AsyncSandbox) -> None:
self._sandbox = sandbox
class AsyncCommandWithRawResponse:
def __init__(self, command: AsyncCommand) -> None:
self._command = command

self.execute = async_to_raw_response_wrapper(
sandbox.execute,
self.exec = async_to_raw_response_wrapper(
command.exec,
)


class SandboxWithStreamingResponse:
def __init__(self, sandbox: Sandbox) -> None:
self._sandbox = sandbox
class CommandWithStreamingResponse:
def __init__(self, command: Command) -> None:
self._command = command

self.execute = to_streamed_response_wrapper(
sandbox.execute,
self.exec = to_streamed_response_wrapper(
command.exec,
)


class AsyncSandboxWithStreamingResponse:
def __init__(self, sandbox: AsyncSandbox) -> None:
self._sandbox = sandbox
class AsyncCommandWithStreamingResponse:
def __init__(self, command: AsyncCommand) -> None:
self._command = command

self.execute = async_to_streamed_response_wrapper(
sandbox.execute,
self.exec = async_to_streamed_response_wrapper(
command.exec,
)
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 .sandbox_execute_params import SandboxExecuteParams as SandboxExecuteParams
from .sandbox_execute_response import SandboxExecuteResponse as SandboxExecuteResponse
from .command_exec_params import CommandExecParams as CommandExecParams
from .command_exec_response import CommandExecResponse as CommandExecResponse
Loading

0 comments on commit f2a6ef5

Please sign in to comment.