Skip to content

Commit 92bd739

Browse files
authored
Merge pull request #27 from replicate/release-please--branches--main--changes--next
release: 2.0.0-alpha.1
2 parents d9062d0 + 419c3a3 commit 92bd739

17 files changed

+228
-88
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.6.0"
2+
".": "2.0.0-alpha.1"
33
}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 35
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/replicate%2Freplicate-client-37cd8ea847eb57706035f766ca549d5b4e2111053af0656a2df9a8150421428e.yml
33
openapi_spec_hash: a3e4d6fd9aff6de0e4b6d8ad28cbbe05
4-
config_hash: 8e356248f15e5e54d2aecab141f45228
4+
config_hash: da444f7a7ac6238fa0bdecaa01ffa4c3

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Changelog
22

3+
## 2.0.0-alpha.1 (2025-06-10)
4+
5+
Full Changelog: [v0.6.0...v2.0.0-alpha.1](https://github.com/replicate/replicate-python-stainless/compare/v0.6.0...v2.0.0-alpha.1)
6+
7+
### ⚠ BREAKING CHANGES
8+
9+
* rename package to `replicate`
10+
11+
### Features
12+
13+
* **client:** add follow_redirects request option ([d606061](https://github.com/replicate/replicate-python-stainless/commit/d60606146abbdc778dc33573ccccdf7bedb524e4))
14+
15+
16+
### Chores
17+
18+
* **docs:** remove reference to rye shell ([1dfaea4](https://github.com/replicate/replicate-python-stainless/commit/1dfaea4108bee6ea565c48c9f99ed503476fd58f))
19+
* rename package to `replicate` ([42e30b7](https://github.com/replicate/replicate-python-stainless/commit/42e30b7b0e736fbb39e95ef7744299746a70d1b5))
20+
21+
22+
### Documentation
23+
24+
* **internal:** add support for the client config option default_client_example_name to Python ([b320609](https://github.com/replicate/replicate-python-stainless/commit/b3206093c824676a300bfc68da307fab5a0f3718))
25+
326
## 0.6.0 (2025-05-22)
427

528
Full Changelog: [v0.5.1...v0.6.0](https://github.com/replicate/replicate-python-stainless/compare/v0.5.1...v0.6.0)

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ $ rye sync --all-features
1717
You can then run scripts using `rye run python script.py` or by activating the virtual environment:
1818

1919
```sh
20-
$ rye shell
21-
# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
20+
# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
2221
$ source .venv/bin/activate
2322

2423
# now you can omit the `rye run` prefix

README.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Replicate Python API library
22

3-
[![PyPI version](https://img.shields.io/pypi/v/replicate-stainless.svg)](https://pypi.org/project/replicate-stainless/)
3+
[![PyPI version](https://img.shields.io/pypi/v/replicate.svg)](https://pypi.org/project/replicate/)
44

55
The Replicate Python library provides convenient access to the Replicate REST API from any Python 3.8+
66
application. The library includes type definitions for all request params and response fields,
@@ -16,7 +16,7 @@ The REST API documentation can be found on [replicate.com](https://replicate.com
1616

1717
```sh
1818
# install from PyPI
19-
pip install replicate-stainless
19+
pip install --pre replicate
2020
```
2121

2222
## Usage
@@ -27,11 +27,11 @@ The full API of this library can be found in [api.md](api.md).
2727
import os
2828
from replicate import Replicate
2929

30-
client = Replicate(
30+
replicate = Replicate(
3131
bearer_token=os.environ.get("REPLICATE_API_TOKEN"), # This is the default and can be omitted
3232
)
3333

34-
prediction = client.predictions.get(
34+
prediction = replicate.predictions.get(
3535
prediction_id="gm3qorzdhgbfurvjtvhg6dckhu",
3636
)
3737
print(prediction.id)
@@ -51,13 +51,13 @@ import os
5151
import asyncio
5252
from replicate import AsyncReplicate
5353

54-
client = AsyncReplicate(
54+
replicate = AsyncReplicate(
5555
bearer_token=os.environ.get("REPLICATE_API_TOKEN"), # This is the default and can be omitted
5656
)
5757

5858

5959
async def main() -> None:
60-
prediction = await client.predictions.get(
60+
prediction = await replicate.predictions.get(
6161
prediction_id="gm3qorzdhgbfurvjtvhg6dckhu",
6262
)
6363
print(prediction.id)
@@ -86,11 +86,11 @@ This library provides auto-paginating iterators with each list response, so you
8686
```python
8787
from replicate import Replicate
8888

89-
client = Replicate()
89+
replicate = Replicate()
9090

9191
all_models = []
9292
# Automatically fetches more pages as needed.
93-
for model in client.models.list():
93+
for model in replicate.models.list():
9494
# Do something with model here
9595
all_models.append(model)
9696
print(all_models)
@@ -102,13 +102,13 @@ Or, asynchronously:
102102
import asyncio
103103
from replicate import AsyncReplicate
104104

105-
client = AsyncReplicate()
105+
replicate = AsyncReplicate()
106106

107107

108108
async def main() -> None:
109109
all_models = []
110110
# Iterate through items across all pages, issuing requests as needed.
111-
async for model in client.models.list():
111+
async for model in replicate.models.list():
112112
all_models.append(model)
113113
print(all_models)
114114

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

121121
```python
122-
first_page = await client.models.list()
122+
first_page = await replicate.models.list()
123123
if first_page.has_next_page():
124124
print(f"will fetch next page using these details: {first_page.next_page_info()}")
125125
next_page = await first_page.get_next_page()
@@ -131,7 +131,7 @@ if first_page.has_next_page():
131131
Or just work directly with the returned data:
132132

133133
```python
134-
first_page = await client.models.list()
134+
first_page = await replicate.models.list()
135135

136136
print(f"next URL: {first_page.next}") # => "next URL: ..."
137137
for model in first_page.results:
@@ -148,9 +148,9 @@ Request parameters that correspond to file uploads can be passed as `bytes`, or
148148
from pathlib import Path
149149
from replicate import Replicate
150150

151-
client = Replicate()
151+
replicate = Replicate()
152152

153-
client.files.create(
153+
replicate.files.create(
154154
content=Path("/path/to/file"),
155155
)
156156
```
@@ -170,10 +170,10 @@ All errors inherit from `replicate.APIError`.
170170
import replicate
171171
from replicate import Replicate
172172

173-
client = Replicate()
173+
replicate = Replicate()
174174

175175
try:
176-
client.predictions.create(
176+
replicate.predictions.create(
177177
input={"text": "Alice"},
178178
version="replicate/hello-world:5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
179179
)
@@ -213,13 +213,13 @@ You can use the `max_retries` option to configure or disable retry settings:
213213
from replicate import Replicate
214214

215215
# Configure the default for all requests:
216-
client = Replicate(
216+
replicate = Replicate(
217217
# default is 2
218218
max_retries=0,
219219
)
220220

221221
# Or, configure per-request:
222-
client.with_options(max_retries=5).predictions.create(
222+
replicate.with_options(max_retries=5).predictions.create(
223223
input={"text": "Alice"},
224224
version="replicate/hello-world:5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
225225
)
@@ -234,18 +234,18 @@ which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advan
234234
from replicate import Replicate
235235

236236
# Configure the default for all requests:
237-
client = Replicate(
237+
replicate = Replicate(
238238
# 20 seconds (default is 1 minute)
239239
timeout=20.0,
240240
)
241241

242242
# More granular control:
243-
client = Replicate(
243+
replicate = Replicate(
244244
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
245245
)
246246

247247
# Override per-request:
248-
client.with_options(timeout=5.0).predictions.create(
248+
replicate.with_options(timeout=5.0).predictions.create(
249249
input={"text": "Alice"},
250250
version="replicate/hello-world:5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
251251
)
@@ -288,8 +288,8 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
288288
```py
289289
from replicate import Replicate
290290

291-
client = Replicate()
292-
response = client.predictions.with_raw_response.create(
291+
replicate = Replicate()
292+
response = replicate.predictions.with_raw_response.create(
293293
input={
294294
"text": "Alice"
295295
},
@@ -312,7 +312,7 @@ The above interface eagerly reads the full response body when you make the reque
312312
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.
313313

314314
```python
315-
with client.predictions.with_streaming_response.create(
315+
with replicate.predictions.with_streaming_response.create(
316316
input={"text": "Alice"},
317317
version="replicate/hello-world:5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
318318
) as response:
@@ -332,13 +332,13 @@ If you need to access undocumented endpoints, params, or response properties, th
332332

333333
#### Undocumented endpoints
334334

335-
To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
335+
To make requests to undocumented endpoints, you can make requests using `replicate.get`, `replicate.post`, and other
336336
http verbs. Options on the client will be respected (such as retries) when making this request.
337337

338338
```py
339339
import httpx
340340

341-
response = client.post(
341+
response = replicate.post(
342342
"/foo",
343343
cast_to=httpx.Response,
344344
body={"my_param": True},
@@ -370,7 +370,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
370370
import httpx
371371
from replicate import Replicate, DefaultHttpxClient
372372

373-
client = Replicate(
373+
replicate = Replicate(
374374
# Or use the `REPLICATE_BASE_URL` env var
375375
base_url="http://my.test.server.example.com:8083",
376376
http_client=DefaultHttpxClient(
@@ -383,7 +383,7 @@ client = Replicate(
383383
You can also customize the client on a per-request basis by using `with_options()`:
384384

385385
```python
386-
client.with_options(http_client=DefaultHttpxClient(...))
386+
replicate.with_options(http_client=DefaultHttpxClient(...))
387387
```
388388

389389
### Managing HTTP resources
@@ -393,7 +393,7 @@ By default the library closes underlying HTTP connections whenever the client is
393393
```py
394394
from replicate import Replicate
395395

396-
with Replicate() as client:
396+
with Replicate() as replicate:
397397
# make requests here
398398
...
399399

0 commit comments

Comments
 (0)