Skip to content
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 .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
run: |
bash ./bin/publish-pypi
env:
PYPI_TOKEN: ${{ secrets.MIRU_SERVER_PYPI_TOKEN || secrets.PYPI_TOKEN }}
PYPI_TOKEN: ${{ secrets.MIRU_PYPI_TOKEN || secrets.PYPI_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
run: |
bash ./bin/check-release-environment
env:
PYPI_TOKEN: ${{ secrets.MIRU_SERVER_PYPI_TOKEN || secrets.PYPI_TOKEN }}
PYPI_TOKEN: ${{ secrets.MIRU_PYPI_TOKEN || secrets.PYPI_TOKEN }}
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.4.0"
".": "0.4.1-beta.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 14
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/miru-ml%2Fmiru-server-7d0dd143c8ea9bc230d9810d8cfb3fde8b1d4eb48295ebf2db7ea67916fb96c3.yml
openapi_spec_hash: b6667a2e80a356a67bab83f8d5f6e51a
config_hash: a6a12b948f6bbf51b6e6c16c1e99fae7
config_hash: 78c50efd3bbfb4969846973cb0609eff
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.4.1-beta.0 (2025-10-05)

Full Changelog: [v0.4.0...v0.4.1-beta.0](https://github.com/miruml/python-server-sdk/compare/v0.4.0...v0.4.1-beta.0)

### Refactors

* **api:** rename miru-server to miru ([163c465](https://github.com/miruml/python-server-sdk/commit/163c4659c64f6b954d9b91e7b340554f0919efa6))
* **api:** revert package name to miru_server_sdk ([0c8b7d7](https://github.com/miruml/python-server-sdk/commit/0c8b7d74ae67df4005fc069c4575ffae78b975c6))

## 0.4.0 (2025-09-23)

Full Changelog: [v0.0.1...v0.4.0](https://github.com/miruml/python-server-sdk/compare/v0.0.1...v0.4.0)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $ pip install -r requirements-dev.lock

Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
result in merge conflicts between manual patches and changes from the generator. The generator will never
modify the contents of the `src/miru_server/lib/` and `examples/` directories.
modify the contents of the `src/miru_server_sdk/lib/` and `examples/` directories.

## Adding and running examples

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2025 miru-server
Copyright 2025 miru

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
78 changes: 39 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Miru Server Python API library
# Miru Python API library

<!-- prettier-ignore -->
[![PyPI version](https://img.shields.io/pypi/v/miru_server_sdk.svg?label=pypi%20(stable))](https://pypi.org/project/miru_server_sdk/)

The Miru Server Python library provides convenient access to the Miru Server REST API from any Python 3.8+
The Miru Python library provides convenient access to the Miru REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).

Expand All @@ -17,7 +17,7 @@ The full API of this library can be found in [api.md](api.md).

```sh
# install from PyPI
pip install miru_server_sdk
pip install --pre miru_server_sdk
```

## Usage
Expand All @@ -26,9 +26,9 @@ The full API of this library can be found in [api.md](api.md).

```python
import os
from miru_server import MiruServer
from miru_server_sdk import Miru

client = MiruServer(
client = Miru(
api_key=os.environ.get("MIRU_SERVER_API_KEY"), # This is the default and can be omitted
)

Expand All @@ -45,14 +45,14 @@ so that your API Key is not stored in source control.

## Async usage

Simply import `AsyncMiruServer` instead of `MiruServer` and use `await` with each API call:
Simply import `AsyncMiru` instead of `Miru` and use `await` with each API call:

```python
import os
import asyncio
from miru_server import AsyncMiruServer
from miru_server_sdk import AsyncMiru

client = AsyncMiruServer(
client = AsyncMiru(
api_key=os.environ.get("MIRU_SERVER_API_KEY"), # This is the default and can be omitted
)

Expand All @@ -77,19 +77,19 @@ You can enable this by installing `aiohttp`:

```sh
# install from PyPI
pip install miru_server_sdk[aiohttp]
pip install --pre miru_server_sdk[aiohttp]
```

Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:

```python
import asyncio
from miru_server import DefaultAioHttpClient
from miru_server import AsyncMiruServer
from miru_server_sdk import DefaultAioHttpClient
from miru_server_sdk import AsyncMiru


async def main() -> None:
async with AsyncMiruServer(
async with AsyncMiru(
api_key="My API Key",
http_client=DefaultAioHttpClient(),
) as client:
Expand All @@ -113,29 +113,29 @@ Typed requests and responses provide autocomplete and documentation within your

## Handling errors

When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `miru_server.APIConnectionError` is raised.
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `miru_server_sdk.APIConnectionError` is raised.

When the API returns a non-success status code (that is, 4xx or 5xx
response), a subclass of `miru_server.APIStatusError` is raised, containing `status_code` and `response` properties.
response), a subclass of `miru_server_sdk.APIStatusError` is raised, containing `status_code` and `response` properties.

All errors inherit from `miru_server.APIError`.
All errors inherit from `miru_server_sdk.APIError`.

```python
import miru_server
from miru_server import MiruServer
import miru_server_sdk
from miru_server_sdk import Miru

client = MiruServer()
client = Miru()

try:
client.config_instances.retrieve(
config_instance_id="cfg_inst_123",
)
except miru_server.APIConnectionError as e:
except miru_server_sdk.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
except miru_server.RateLimitError as e:
except miru_server_sdk.RateLimitError as e:
print("A 429 status code was received; we should back off a bit.")
except miru_server.APIStatusError as e:
except miru_server_sdk.APIStatusError as e:
print("Another non-200-range status code was received")
print(e.status_code)
print(e.response)
Expand Down Expand Up @@ -163,10 +163,10 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
You can use the `max_retries` option to configure or disable retry settings:

```python
from miru_server import MiruServer
from miru_server_sdk import Miru

# Configure the default for all requests:
client = MiruServer(
client = Miru(
# default is 2
max_retries=0,
)
Expand All @@ -183,16 +183,16 @@ By default requests time out after 1 minute. You can configure this with a `time
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:

```python
from miru_server import MiruServer
from miru_server_sdk import Miru

# Configure the default for all requests:
client = MiruServer(
client = Miru(
# 20 seconds (default is 1 minute)
timeout=20.0,
)

# More granular control:
client = MiruServer(
client = Miru(
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
)

Expand All @@ -212,10 +212,10 @@ Note that requests that time out are [retried twice by default](#retries).

We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.

You can enable logging by setting the environment variable `MIRU_SERVER_LOG` to `info`.
You can enable logging by setting the environment variable `MIRU_LOG` to `info`.

```shell
$ export MIRU_SERVER_LOG=info
$ export MIRU_LOG=info
```

Or to `debug` for more verbose logging.
Expand All @@ -237,9 +237,9 @@ if response.my_field is None:
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,

```py
from miru_server import MiruServer
from miru_server_sdk import Miru

client = MiruServer()
client = Miru()
response = client.config_instances.with_raw_response.retrieve(
config_instance_id="cfg_inst_123",
)
Expand All @@ -249,9 +249,9 @@ config_instance = response.parse() # get the object that `config_instances.retr
print(config_instance.id)
```

These methods return an [`APIResponse`](https://github.com/miruml/python-server-sdk/tree/main/src/miru_server/_response.py) object.
These methods return an [`APIResponse`](https://github.com/miruml/python-server-sdk/tree/main/src/miru_server_sdk/_response.py) object.

The async client returns an [`AsyncAPIResponse`](https://github.com/miruml/python-server-sdk/tree/main/src/miru_server/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
The async client returns an [`AsyncAPIResponse`](https://github.com/miruml/python-server-sdk/tree/main/src/miru_server_sdk/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.

#### `.with_streaming_response`

Expand Down Expand Up @@ -315,10 +315,10 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c

```python
import httpx
from miru_server import MiruServer, DefaultHttpxClient
from miru_server_sdk import Miru, DefaultHttpxClient

client = MiruServer(
# Or use the `MIRU_SERVER_BASE_URL` env var
client = Miru(
# Or use the `MIRU_BASE_URL` env var
base_url="http://my.test.server.example.com:8083",
http_client=DefaultHttpxClient(
proxy="http://my.test.proxy.example.com",
Expand All @@ -338,9 +338,9 @@ client.with_options(http_client=DefaultHttpxClient(...))
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.

```py
from miru_server import MiruServer
from miru_server_sdk import Miru

with MiruServer() as client:
with Miru() as client:
# make requests here
...

Expand All @@ -366,8 +366,8 @@ If you've upgraded to the latest version but aren't seeing any new features you
You can determine the version that is being used at runtime with:

```py
import miru_server
print(miru_server.__version__)
import miru_server_sdk
print(miru_server_sdk.__version__)
```

## Requirements
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ before making any information public.
## Reporting Non-SDK Related Security Issues

If you encounter security issues that are not directly related to SDKs but pertain to the services
or products provided by Miru Server, please follow the respective company's security reporting guidelines.
or products provided by Miru, please follow the respective company's security reporting guidelines.

---

Expand Down
36 changes: 18 additions & 18 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Types:

```python
from miru_server.types import (
from miru_server_sdk.types import (
ConfigInstance,
ConfigSchema,
ConfigSchemaList,
Expand All @@ -15,30 +15,30 @@ from miru_server.types import (

Methods:

- <code title="get /config_instances/{config_instance_id}">client.config_instances.<a href="./src/miru_server/resources/config_instances.py">retrieve</a>(config_instance_id, \*\*<a href="src/miru_server/types/config_instance_retrieve_params.py">params</a>) -> <a href="./src/miru_server/types/config_instance.py">ConfigInstance</a></code>
- <code title="get /config_instances">client.config_instances.<a href="./src/miru_server/resources/config_instances.py">list</a>(\*\*<a href="src/miru_server/types/config_instance_list_params.py">params</a>) -> <a href="./src/miru_server/types/config_instance_list_response.py">ConfigInstanceListResponse</a></code>
- <code title="get /config_instances/{config_instance_id}">client.config_instances.<a href="./src/miru_server_sdk/resources/config_instances.py">retrieve</a>(config_instance_id, \*\*<a href="src/miru_server_sdk/types/config_instance_retrieve_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/config_instance.py">ConfigInstance</a></code>
- <code title="get /config_instances">client.config_instances.<a href="./src/miru_server_sdk/resources/config_instances.py">list</a>(\*\*<a href="src/miru_server_sdk/types/config_instance_list_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/config_instance_list_response.py">ConfigInstanceListResponse</a></code>

# Deployments

Types:

```python
from miru_server.types import Deployment, DeploymentListResponse, DeploymentValidateResponse
from miru_server_sdk.types import Deployment, DeploymentListResponse, DeploymentValidateResponse
```

Methods:

- <code title="post /deployments">client.deployments.<a href="./src/miru_server/resources/deployments.py">create</a>(\*\*<a href="src/miru_server/types/deployment_create_params.py">params</a>) -> <a href="./src/miru_server/types/deployment.py">Deployment</a></code>
- <code title="get /deployments/{deployment_id}">client.deployments.<a href="./src/miru_server/resources/deployments.py">retrieve</a>(deployment_id, \*\*<a href="src/miru_server/types/deployment_retrieve_params.py">params</a>) -> <a href="./src/miru_server/types/deployment.py">Deployment</a></code>
- <code title="get /deployments">client.deployments.<a href="./src/miru_server/resources/deployments.py">list</a>(\*\*<a href="src/miru_server/types/deployment_list_params.py">params</a>) -> <a href="./src/miru_server/types/deployment_list_response.py">DeploymentListResponse</a></code>
- <code title="post /deployments/{deployment_id}/validate">client.deployments.<a href="./src/miru_server/resources/deployments.py">validate</a>(deployment_id, \*\*<a href="src/miru_server/types/deployment_validate_params.py">params</a>) -> <a href="./src/miru_server/types/deployment_validate_response.py">DeploymentValidateResponse</a></code>
- <code title="post /deployments">client.deployments.<a href="./src/miru_server_sdk/resources/deployments.py">create</a>(\*\*<a href="src/miru_server_sdk/types/deployment_create_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/deployment.py">Deployment</a></code>
- <code title="get /deployments/{deployment_id}">client.deployments.<a href="./src/miru_server_sdk/resources/deployments.py">retrieve</a>(deployment_id, \*\*<a href="src/miru_server_sdk/types/deployment_retrieve_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/deployment.py">Deployment</a></code>
- <code title="get /deployments">client.deployments.<a href="./src/miru_server_sdk/resources/deployments.py">list</a>(\*\*<a href="src/miru_server_sdk/types/deployment_list_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/deployment_list_response.py">DeploymentListResponse</a></code>
- <code title="post /deployments/{deployment_id}/validate">client.deployments.<a href="./src/miru_server_sdk/resources/deployments.py">validate</a>(deployment_id, \*\*<a href="src/miru_server_sdk/types/deployment_validate_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/deployment_validate_response.py">DeploymentValidateResponse</a></code>

# Devices

Types:

```python
from miru_server.types import (
from miru_server_sdk.types import (
Device,
DeviceListResponse,
DeviceDeleteResponse,
Expand All @@ -48,22 +48,22 @@ from miru_server.types import (

Methods:

- <code title="post /devices">client.devices.<a href="./src/miru_server/resources/devices.py">create</a>(\*\*<a href="src/miru_server/types/device_create_params.py">params</a>) -> <a href="./src/miru_server/types/device.py">Device</a></code>
- <code title="get /devices/{device_id}">client.devices.<a href="./src/miru_server/resources/devices.py">retrieve</a>(device_id) -> <a href="./src/miru_server/types/device.py">Device</a></code>
- <code title="patch /devices/{device_id}">client.devices.<a href="./src/miru_server/resources/devices.py">update</a>(device_id, \*\*<a href="src/miru_server/types/device_update_params.py">params</a>) -> <a href="./src/miru_server/types/device.py">Device</a></code>
- <code title="get /devices">client.devices.<a href="./src/miru_server/resources/devices.py">list</a>(\*\*<a href="src/miru_server/types/device_list_params.py">params</a>) -> <a href="./src/miru_server/types/device_list_response.py">DeviceListResponse</a></code>
- <code title="delete /devices/{device_id}">client.devices.<a href="./src/miru_server/resources/devices.py">delete</a>(device_id) -> <a href="./src/miru_server/types/device_delete_response.py">DeviceDeleteResponse</a></code>
- <code title="post /devices/{device_id}/activation_token">client.devices.<a href="./src/miru_server/resources/devices.py">create_activation_token</a>(device_id, \*\*<a href="src/miru_server/types/device_create_activation_token_params.py">params</a>) -> <a href="./src/miru_server/types/device_create_activation_token_response.py">DeviceCreateActivationTokenResponse</a></code>
- <code title="post /devices">client.devices.<a href="./src/miru_server_sdk/resources/devices.py">create</a>(\*\*<a href="src/miru_server_sdk/types/device_create_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/device.py">Device</a></code>
- <code title="get /devices/{device_id}">client.devices.<a href="./src/miru_server_sdk/resources/devices.py">retrieve</a>(device_id) -> <a href="./src/miru_server_sdk/types/device.py">Device</a></code>
- <code title="patch /devices/{device_id}">client.devices.<a href="./src/miru_server_sdk/resources/devices.py">update</a>(device_id, \*\*<a href="src/miru_server_sdk/types/device_update_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/device.py">Device</a></code>
- <code title="get /devices">client.devices.<a href="./src/miru_server_sdk/resources/devices.py">list</a>(\*\*<a href="src/miru_server_sdk/types/device_list_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/device_list_response.py">DeviceListResponse</a></code>
- <code title="delete /devices/{device_id}">client.devices.<a href="./src/miru_server_sdk/resources/devices.py">delete</a>(device_id) -> <a href="./src/miru_server_sdk/types/device_delete_response.py">DeviceDeleteResponse</a></code>
- <code title="post /devices/{device_id}/activation_token">client.devices.<a href="./src/miru_server_sdk/resources/devices.py">create_activation_token</a>(device_id, \*\*<a href="src/miru_server_sdk/types/device_create_activation_token_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/device_create_activation_token_response.py">DeviceCreateActivationTokenResponse</a></code>

# Releases

Types:

```python
from miru_server.types import Release, ReleaseListResponse
from miru_server_sdk.types import Release, ReleaseListResponse
```

Methods:

- <code title="get /releases/{release_id}">client.releases.<a href="./src/miru_server/resources/releases.py">retrieve</a>(release_id, \*\*<a href="src/miru_server/types/release_retrieve_params.py">params</a>) -> <a href="./src/miru_server/types/release.py">Release</a></code>
- <code title="get /releases">client.releases.<a href="./src/miru_server/resources/releases.py">list</a>(\*\*<a href="src/miru_server/types/release_list_params.py">params</a>) -> <a href="./src/miru_server/types/release_list_response.py">ReleaseListResponse</a></code>
- <code title="get /releases/{release_id}">client.releases.<a href="./src/miru_server_sdk/resources/releases.py">retrieve</a>(release_id, \*\*<a href="src/miru_server_sdk/types/release_retrieve_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/release.py">Release</a></code>
- <code title="get /releases">client.releases.<a href="./src/miru_server_sdk/resources/releases.py">list</a>(\*\*<a href="src/miru_server_sdk/types/release_list_params.py">params</a>) -> <a href="./src/miru_server_sdk/types/release_list_response.py">ReleaseListResponse</a></code>
Loading