Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

release: 0.1.0-alpha.6 #8

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

Merged
zeke merged 5 commits into main from release-please--branches--main--changes--next
Apr 24, 2025
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
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
- next
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ubuntu-latest
runs-on: ${{ github.repository == 'stainless-sdks/replicate-client-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4

Expand All @@ -33,7 +33,7 @@ jobs:
test:
timeout-minutes: 10
name: test
runs-on: ubuntu-latest
runs-on: ${{ github.repository == 'stainless-sdks/replicate-client-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.5"
".": "0.1.0-alpha.6"
}
2 changes: 1 addition & 1 deletion .stats.yml
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 29
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/replicate%2Freplicate-client-2788217b7ad7d61d1a77800bc5ff12a6810f1692d4d770b72fa8f898c6a055ab.yml
openapi_spec_hash: 4423bf747e228484547b441468a9f156
config_hash: d820945093fc56fea6d062c90745d7a5
config_hash: e9a36632894b8541a86a71420dd3d0b7
15 changes: 15 additions & 0 deletions CHANGELOG.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.1.0-alpha.6 (2025年04月24日)

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

### Bug Fixes

* correct mapping for account.get ([e501778](https://github.com/replicate/replicate-python-stainless/commit/e501778a22c481147fbe419803a3f52ac9ba8243))


### Chores

* broadly detect json family of content-type headers ([eeaa507](https://github.com/replicate/replicate-python-stainless/commit/eeaa5071ed47e31264a268d9445fe8c0b8d059b1))
* **ci:** only use depot for staging repos ([f7ec0b8](https://github.com/replicate/replicate-python-stainless/commit/f7ec0b8e11782aa89eee5f4af962158b665eee13))
* **internal:** codegen related update ([fd43800](https://github.com/replicate/replicate-python-stainless/commit/fd43800c1da9a5c6ff06309a6c4a6a3808decff9))

## 0.1.0-alpha.5 (2025年04月24日)

Full Changelog: [v0.1.0-alpha.4...v0.1.0-alpha.5](https://github.com/replicate/replicate-python-stainless/compare/v0.1.0-alpha.4...v0.1.0-alpha.5)
Expand Down
20 changes: 10 additions & 10 deletions README.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ client = ReplicateClient(
bearer_token=os.environ.get("REPLICATE_API_TOKEN"), # This is the default and can be omitted
)

accounts = client.accounts.list()
print(accounts.type)
account = client.account.get()
print(account.type)
```

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


async def main() -> None:
accounts = await client.accounts.list()
print(accounts.type)
account = await client.account.get()
print(account.type)


asyncio.run(main())
Expand Down Expand Up @@ -152,7 +152,7 @@ from replicate import ReplicateClient
client = ReplicateClient()

try:
client.accounts.list()
client.account.get()
except replicate.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
Expand Down Expand Up @@ -195,7 +195,7 @@ client = ReplicateClient(
)

# Or, configure per-request:
client.with_options(max_retries=5).accounts.list()
client.with_options(max_retries=5).account.get()
```

### Timeouts
Expand All @@ -218,7 +218,7 @@ client = ReplicateClient(
)

# Override per-request:
client.with_options(timeout=5.0).accounts.list()
client.with_options(timeout=5.0).account.get()
```

On timeout, an `APITimeoutError` is thrown.
Expand Down Expand Up @@ -259,10 +259,10 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
from replicate import ReplicateClient

client = ReplicateClient()
response = client.accounts.with_raw_response.list()
response = client.account.with_raw_response.get()
print(response.headers.get('X-My-Header'))

account = response.parse() # get the object that `accounts.list()` would have returned
account = response.parse() # get the object that `account.get()` would have returned
print(account.type)
```

Expand All @@ -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.accounts.with_streaming_response.list() as response:
with client.account.with_streaming_response.get() 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
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ Methods:

- <code title="get /hardware">client.hardware.<a href="./src/replicate/resources/hardware.py">list</a>() -> <a href="./src/replicate/types/hardware_list_response.py">HardwareListResponse</a></code>

# Accounts
# Account

Types:

```python
from replicate.types import AccountListResponse
from replicate.types import AccountGetResponse
```

Methods:

- <code title="get /account">client.accounts.<a href="./src/replicate/resources/accounts.py">list</a>() -> <a href="./src/replicate/types/account_list_response.py">AccountListResponse</a></code>
- <code title="get /account">client.account.<a href="./src/replicate/resources/account.py">get</a>() -> <a href="./src/replicate/types/account_get_response.py">AccountGetResponse</a></code>

# Models

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "replicate-stainless"
version = "0.1.0-alpha.5"
version = "0.1.0-alpha.6"
description = "The official Python library for the replicate-client API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/replicate/__init__.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def _reset_client() -> None: # type: ignore[reportUnusedFunction]

from ._module_client import (
models as models,
accounts as accounts,
account as account,
hardware as hardware,
webhooks as webhooks,
trainings as trainings,
Expand Down
18 changes: 9 additions & 9 deletions src/replicate/_client.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)
from ._utils import is_given, get_async_library
from ._version import __version__
from .resources import accounts, hardware, trainings, collections, predictions
from .resources import account, hardware, trainings, collections, predictions
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import APIStatusError, ReplicateClientError
from ._base_client import (
Expand Down Expand Up @@ -49,7 +49,7 @@ class ReplicateClient(SyncAPIClient):
collections: collections.CollectionsResource
deployments: deployments.DeploymentsResource
hardware: hardware.HardwareResource
accounts: accounts.AccountsResource
account: account.AccountResource
models: models.ModelsResource
predictions: predictions.PredictionsResource
trainings: trainings.TrainingsResource
Expand Down Expand Up @@ -114,7 +114,7 @@ def __init__(
self.collections = collections.CollectionsResource(self)
self.deployments = deployments.DeploymentsResource(self)
self.hardware = hardware.HardwareResource(self)
self.accounts = accounts.AccountsResource(self)
self.account = account.AccountResource(self)
self.models = models.ModelsResource(self)
self.predictions = predictions.PredictionsResource(self)
self.trainings = trainings.TrainingsResource(self)
Expand Down Expand Up @@ -231,7 +231,7 @@ class AsyncReplicateClient(AsyncAPIClient):
collections: collections.AsyncCollectionsResource
deployments: deployments.AsyncDeploymentsResource
hardware: hardware.AsyncHardwareResource
accounts: accounts.AsyncAccountsResource
account: account.AsyncAccountResource
models: models.AsyncModelsResource
predictions: predictions.AsyncPredictionsResource
trainings: trainings.AsyncTrainingsResource
Expand Down Expand Up @@ -296,7 +296,7 @@ def __init__(
self.collections = collections.AsyncCollectionsResource(self)
self.deployments = deployments.AsyncDeploymentsResource(self)
self.hardware = hardware.AsyncHardwareResource(self)
self.accounts = accounts.AsyncAccountsResource(self)
self.account = account.AsyncAccountResource(self)
self.models = models.AsyncModelsResource(self)
self.predictions = predictions.AsyncPredictionsResource(self)
self.trainings = trainings.AsyncTrainingsResource(self)
Expand Down Expand Up @@ -414,7 +414,7 @@ def __init__(self, client: ReplicateClient) -> None:
self.collections = collections.CollectionsResourceWithRawResponse(client.collections)
self.deployments = deployments.DeploymentsResourceWithRawResponse(client.deployments)
self.hardware = hardware.HardwareResourceWithRawResponse(client.hardware)
self.accounts = accounts.AccountsResourceWithRawResponse(client.accounts)
self.account = account.AccountResourceWithRawResponse(client.account)
self.models = models.ModelsResourceWithRawResponse(client.models)
self.predictions = predictions.PredictionsResourceWithRawResponse(client.predictions)
self.trainings = trainings.TrainingsResourceWithRawResponse(client.trainings)
Expand All @@ -426,7 +426,7 @@ def __init__(self, client: AsyncReplicateClient) -> None:
self.collections = collections.AsyncCollectionsResourceWithRawResponse(client.collections)
self.deployments = deployments.AsyncDeploymentsResourceWithRawResponse(client.deployments)
self.hardware = hardware.AsyncHardwareResourceWithRawResponse(client.hardware)
self.accounts = accounts.AsyncAccountsResourceWithRawResponse(client.accounts)
self.account = account.AsyncAccountResourceWithRawResponse(client.account)
self.models = models.AsyncModelsResourceWithRawResponse(client.models)
self.predictions = predictions.AsyncPredictionsResourceWithRawResponse(client.predictions)
self.trainings = trainings.AsyncTrainingsResourceWithRawResponse(client.trainings)
Expand All @@ -438,7 +438,7 @@ def __init__(self, client: ReplicateClient) -> None:
self.collections = collections.CollectionsResourceWithStreamingResponse(client.collections)
self.deployments = deployments.DeploymentsResourceWithStreamingResponse(client.deployments)
self.hardware = hardware.HardwareResourceWithStreamingResponse(client.hardware)
self.accounts = accounts.AccountsResourceWithStreamingResponse(client.accounts)
self.account = account.AccountResourceWithStreamingResponse(client.account)
self.models = models.ModelsResourceWithStreamingResponse(client.models)
self.predictions = predictions.PredictionsResourceWithStreamingResponse(client.predictions)
self.trainings = trainings.TrainingsResourceWithStreamingResponse(client.trainings)
Expand All @@ -450,7 +450,7 @@ def __init__(self, client: AsyncReplicateClient) -> None:
self.collections = collections.AsyncCollectionsResourceWithStreamingResponse(client.collections)
self.deployments = deployments.AsyncDeploymentsResourceWithStreamingResponse(client.deployments)
self.hardware = hardware.AsyncHardwareResourceWithStreamingResponse(client.hardware)
self.accounts = accounts.AsyncAccountsResourceWithStreamingResponse(client.accounts)
self.account = account.AsyncAccountResourceWithStreamingResponse(client.account)
self.models = models.AsyncModelsResourceWithStreamingResponse(client.models)
self.predictions = predictions.AsyncPredictionsResourceWithStreamingResponse(client.predictions)
self.trainings = trainings.AsyncTrainingsResourceWithStreamingResponse(client.trainings)
Expand Down
14 changes: 7 additions & 7 deletions src/replicate/_module_client.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ def __load__(self) -> resources.ModelsResource:
return _load_client().models


class HardwareResourceProxy(LazyProxy[resources.HardwareResource]):
class AccountResourceProxy(LazyProxy[resources.AccountResource]):
@override
def __load__(self) -> resources.HardwareResource:
return _load_client().hardware
def __load__(self) -> resources.AccountResource:
return _load_client().account


class AccountsResourceProxy(LazyProxy[resources.AccountsResource]):
class HardwareResourceProxy(LazyProxy[resources.HardwareResource]):
@override
def __load__(self) -> resources.AccountsResource:
return _load_client().accounts
def __load__(self) -> resources.HardwareResource:
return _load_client().hardware


class WebhooksResourceProxy(LazyProxy[resources.WebhooksResource]):
Expand Down Expand Up @@ -55,8 +55,8 @@ def __load__(self) -> resources.PredictionsResource:


models: resources.ModelsResource = ModelsResourceProxy().__as_proxied__()
account: resources.AccountResource = AccountResourceProxy().__as_proxied__()
hardware: resources.HardwareResource = HardwareResourceProxy().__as_proxied__()
accounts: resources.AccountsResource = AccountsResourceProxy().__as_proxied__()
webhooks: resources.WebhooksResource = WebhooksResourceProxy().__as_proxied__()
trainings: resources.TrainingsResource = TrainingsResourceProxy().__as_proxied__()
collections: resources.CollectionsResource = CollectionsResourceProxy().__as_proxied__()
Expand Down
2 changes: 1 addition & 1 deletion src/replicate/_response.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
# split is required to handle cases where additional information is included
# in the response, e.g. application/json; charset=utf-8
content_type, *_ = response.headers.get("content-type", "*").split(";")
if content_type != "application/json":
if not content_type.endswith("json"):
if is_basemodel(cast_to):
try:
data = response.json()
Expand Down
2 changes: 1 addition & 1 deletion src/replicate/_version.py
View file Open in desktop
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__ = "replicate"
__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/replicate/resources/__init__.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
ModelsResourceWithStreamingResponse,
AsyncModelsResourceWithStreamingResponse,
)
from .accounts import (
AccountsResource,
AsyncAccountsResource,
AccountsResourceWithRawResponse,
AsyncAccountsResourceWithRawResponse,
AccountsResourceWithStreamingResponse,
AsyncAccountsResourceWithStreamingResponse,
from .account import (
AccountResource,
AsyncAccountResource,
AccountResourceWithRawResponse,
AsyncAccountResourceWithRawResponse,
AccountResourceWithStreamingResponse,
AsyncAccountResourceWithStreamingResponse,
)
from .hardware import (
HardwareResource,
Expand Down Expand Up @@ -84,12 +84,12 @@
"AsyncHardwareResourceWithRawResponse",
"HardwareResourceWithStreamingResponse",
"AsyncHardwareResourceWithStreamingResponse",
"AccountsResource",
"AsyncAccountsResource",
"AccountsResourceWithRawResponse",
"AsyncAccountsResourceWithRawResponse",
"AccountsResourceWithStreamingResponse",
"AsyncAccountsResourceWithStreamingResponse",
"AccountResource",
"AsyncAccountResource",
"AccountResourceWithRawResponse",
"AsyncAccountResourceWithRawResponse",
"AccountResourceWithStreamingResponse",
"AsyncAccountResourceWithStreamingResponse",
"ModelsResource",
"AsyncModelsResource",
"ModelsResourceWithRawResponse",
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /