Skip to content

Commit 02cb51b

Browse files
authored
Merge pull request #28 from replicate/release-please--branches--main--changes--next
release: 2.0.0-alpha.2
2 parents 92bd739 + 01e7d4d commit 02cb51b

File tree

9 files changed

+43
-8
lines changed

9 files changed

+43
-8
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-
".": "2.0.0-alpha.1"
2+
".": "2.0.0-alpha.2"
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: da444f7a7ac6238fa0bdecaa01ffa4c3
4+
config_hash: 12536d2bf978a995771d076a4647c17d

CHANGELOG.md

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

3+
## 2.0.0-alpha.2 (2025-06-13)
4+
5+
Full Changelog: [v2.0.0-alpha.1...v2.0.0-alpha.2](https://github.com/replicate/replicate-python-stainless/compare/v2.0.0-alpha.1...v2.0.0-alpha.2)
6+
7+
### Bug Fixes
8+
9+
* **client:** correctly parse binary response | stream ([ec19335](https://github.com/replicate/replicate-python-stainless/commit/ec19335fcce5a7ceba6aa1a4ac67411421a571ec))
10+
* **test:** update prediction response ([b6608ca](https://github.com/replicate/replicate-python-stainless/commit/b6608ca5bbfc38d68a9bbfb853bbb8645e046d39))
11+
12+
13+
### Chores
14+
15+
* **internal:** version bump ([497fe10](https://github.com/replicate/replicate-python-stainless/commit/497fe1047ade040d99bf5d7d4fb99f1b1b95a09d))
16+
* **tests:** run tests in parallel ([9330c56](https://github.com/replicate/replicate-python-stainless/commit/9330c565de11b0c61e43df899f4113c5214572c9))
17+
318
## 2.0.0-alpha.1 (2025-06-10)
419

520
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)

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "replicate"
3-
version = "2.0.0-alpha.1"
3+
version = "2.0.0-alpha.2"
44
description = "The official Python library for the replicate API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -54,6 +54,7 @@ dev-dependencies = [
5454
"importlib-metadata>=6.7.0",
5555
"rich>=13.7.1",
5656
"nest_asyncio==1.6.0",
57+
"pytest-xdist>=3.6.1",
5758
]
5859

5960
[tool.rye.scripts]
@@ -125,7 +126,7 @@ replacement = '[\1](https://github.com/replicate/replicate-python-stainless/tree
125126

126127
[tool.pytest.ini_options]
127128
testpaths = ["tests"]
128-
addopts = "--tb=short"
129+
addopts = "--tb=short -n auto"
129130
xfail_strict = true
130131
asyncio_mode = "auto"
131132
asyncio_default_fixture_loop_scope = "session"

requirements-dev.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ distro==1.8.0
3030
exceptiongroup==1.2.2
3131
# via anyio
3232
# via pytest
33+
execnet==2.1.1
34+
# via pytest-xdist
3335
filelock==3.12.4
3436
# via virtualenv
3537
h11==0.14.0
@@ -72,7 +74,9 @@ pygments==2.18.0
7274
pyright==1.1.399
7375
pytest==8.3.3
7476
# via pytest-asyncio
77+
# via pytest-xdist
7578
pytest-asyncio==0.24.0
79+
pytest-xdist==3.7.0
7680
python-dateutil==2.8.2
7781
# via time-machine
7882
pytz==2023.3.post1

scripts/utils/upload-artifact.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \
1818

1919
if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
2020
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
21-
echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/replicate-client-python/$SHA'\033[0m"
21+
echo -e "\033[32mInstallation: pip install --pre 'https://pkg.stainless.com/s/replicate-client-python/$SHA'\033[0m"
2222
else
2323
echo -e "\033[31mFailed to upload artifact.\033[0m"
2424
exit 1

src/replicate/_base_client.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,14 @@ def _process_response(
10711071
) -> ResponseT:
10721072
origin = get_origin(cast_to) or cast_to
10731073

1074-
if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse):
1074+
if (
1075+
inspect.isclass(origin)
1076+
and issubclass(origin, BaseAPIResponse)
1077+
# we only want to actually return the custom BaseAPIResponse class if we're
1078+
# returning the raw response, or if we're not streaming SSE, as if we're streaming
1079+
# SSE then `cast_to` doesn't actively reflect the type we need to parse into
1080+
and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER)))
1081+
):
10751082
if not issubclass(origin, APIResponse):
10761083
raise TypeError(f"API Response types must subclass {APIResponse}; Received {origin}")
10771084

@@ -1588,7 +1595,14 @@ async def _process_response(
15881595
) -> ResponseT:
15891596
origin = get_origin(cast_to) or cast_to
15901597

1591-
if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse):
1598+
if (
1599+
inspect.isclass(origin)
1600+
and issubclass(origin, BaseAPIResponse)
1601+
# we only want to actually return the custom BaseAPIResponse class if we're
1602+
# returning the raw response, or if we're not streaming SSE, as if we're streaming
1603+
# SSE then `cast_to` doesn't actively reflect the type we need to parse into
1604+
and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER)))
1605+
):
15921606
if not issubclass(origin, AsyncAPIResponse):
15931607
raise TypeError(f"API Response types must subclass {AsyncAPIResponse}; Received {origin}")
15941608

src/replicate/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "replicate"
4-
__version__ = "2.0.0-alpha.1" # x-release-please-version
4+
__version__ = "2.0.0-alpha.2" # x-release-please-version

tests/lib/test_run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def create_mock_prediction(
3232
urls = {
3333
"get": "https://api.replicate.com/v1/predictions/test_prediction_id",
3434
"cancel": "https://api.replicate.com/v1/predictions/test_prediction_id/cancel",
35+
"web": "https://replicate.com/p/test_prediction_id",
3536
}
3637

3738
return {

0 commit comments

Comments
 (0)