Skip to content

Commit ed77e36

Browse files
authored
Merge pull request #39 from replicate/release-please--branches--main--changes--next
release: 2.0.0-alpha.11
2 parents b2ab858 + 12c1a79 commit ed77e36

File tree

12 files changed

+92
-19
lines changed

12 files changed

+92
-19
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.10"
2+
".": "2.0.0-alpha.11"
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-d174b63c516640a0987bbb0879d1cb435ecf6cbcfe7c9f6465bfcc5416eff8e1.yml
33
openapi_spec_hash: 46f69b0827b955f2adf93928fcfb2c57
4-
config_hash: 71c9e54dad5d546e9a98afe5edc6742b
4+
config_hash: 218f95f3af761e55867d28b8d75464c8

CHANGELOG.md

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

3+
## 2.0.0-alpha.11 (2025-07-12)
4+
5+
Full Changelog: [v2.0.0-alpha.10...v2.0.0-alpha.11](https://github.com/replicate/replicate-python-stainless/compare/v2.0.0-alpha.10...v2.0.0-alpha.11)
6+
7+
### Bug Fixes
8+
9+
* **client:** don't send Content-Type header on GET requests ([32d3401](https://github.com/replicate/replicate-python-stainless/commit/32d3401e0180ab91d7e8aba5959d15dae8640814))
10+
* **parsing:** correctly handle nested discriminated unions ([2aaaab1](https://github.com/replicate/replicate-python-stainless/commit/2aaaab1999f44d7ee8581cc7466e3be04360f4c7))
11+
12+
13+
### Chores
14+
15+
* **internal:** bump pinned h11 dep ([c3101fc](https://github.com/replicate/replicate-python-stainless/commit/c3101fc57487b08ea55344b8eff1308bb92290cf))
16+
* **package:** mark python 3.13 as supported ([1263862](https://github.com/replicate/replicate-python-stainless/commit/1263862868ee1a2750eb8b66d6b2f76c0b6f753d))
17+
* **readme:** fix version rendering on pypi ([626518b](https://github.com/replicate/replicate-python-stainless/commit/626518b846fd2dcb02ca21e1054a8fd4f0849130))
18+
319
## 2.0.0-alpha.10 (2025-07-08)
420

521
Full Changelog: [v2.0.0-alpha.9...v2.0.0-alpha.10](https://github.com/replicate/replicate-python-stainless/compare/v2.0.0-alpha.9...v2.0.0-alpha.10)

README.md

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

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

56
The Replicate Python library provides convenient access to the Replicate REST API from any Python 3.8+
67
application. The library includes type definitions for all request params and response fields,

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.10"
3+
version = "2.0.0-alpha.11"
44
description = "The official Python library for the replicate API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -24,6 +24,7 @@ classifiers = [
2424
"Programming Language :: Python :: 3.10",
2525
"Programming Language :: Python :: 3.11",
2626
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
2728
"Operating System :: OS Independent",
2829
"Operating System :: POSIX",
2930
"Operating System :: MacOS",
@@ -38,7 +39,7 @@ Homepage = "https://github.com/replicate/replicate-python-stainless"
3839
Repository = "https://github.com/replicate/replicate-python-stainless"
3940

4041
[project.optional-dependencies]
41-
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"]
42+
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]
4243

4344
[tool.rye]
4445
managed = true

requirements-dev.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ filelock==3.12.4
4848
frozenlist==1.6.2
4949
# via aiohttp
5050
# via aiosignal
51-
h11==0.14.0
51+
h11==0.16.0
5252
# via httpcore
53-
httpcore==1.0.2
53+
httpcore==1.0.9
5454
# via httpx
5555
httpx==0.28.1
5656
# via httpx-aiohttp

requirements.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ exceptiongroup==1.2.2
3636
frozenlist==1.6.2
3737
# via aiohttp
3838
# via aiosignal
39-
h11==0.14.0
39+
h11==0.16.0
4040
# via httpcore
41-
httpcore==1.0.2
41+
httpcore==1.0.9
4242
# via httpx
4343
httpx==0.28.1
4444
# via httpx-aiohttp

src/replicate/_base_client.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,15 @@ def _build_request(
529529
# work around https://github.com/encode/httpx/discussions/2880
530530
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
531531

532+
is_body_allowed = options.method.lower() != "get"
533+
534+
if is_body_allowed:
535+
kwargs["json"] = json_data if is_given(json_data) else None
536+
kwargs["files"] = files
537+
else:
538+
headers.pop("Content-Type", None)
539+
kwargs.pop("data", None)
540+
532541
# TODO: report this error to httpx
533542
return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
534543
headers=headers,
@@ -540,8 +549,6 @@ def _build_request(
540549
# so that passing a `TypedDict` doesn't cause an error.
541550
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
542551
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
543-
json=json_data if is_given(json_data) else None,
544-
files=files,
545552
**kwargs,
546553
)
547554

src/replicate/_models.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
import os
44
import inspect
5-
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast
5+
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
66
from datetime import date, datetime
77
from typing_extensions import (
8+
List,
89
Unpack,
910
Literal,
1011
ClassVar,
@@ -366,7 +367,7 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
366367
if type_ is None:
367368
raise RuntimeError(f"Unexpected field type is None for {key}")
368369

369-
return construct_type(value=value, type_=type_)
370+
return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
370371

371372

372373
def is_basemodel(type_: type) -> bool:
@@ -420,7 +421,7 @@ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T:
420421
return cast(_T, construct_type(value=value, type_=type_))
421422

422423

423-
def construct_type(*, value: object, type_: object) -> object:
424+
def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object:
424425
"""Loose coercion to the expected type with construction of nested values.
425426
426427
If the given value does not match the expected type then it is returned as-is.
@@ -438,8 +439,10 @@ def construct_type(*, value: object, type_: object) -> object:
438439
type_ = type_.__value__ # type: ignore[unreachable]
439440

440441
# unwrap `Annotated[T, ...]` -> `T`
441-
if is_annotated_type(type_):
442-
meta: tuple[Any, ...] = get_args(type_)[1:]
442+
if metadata is not None:
443+
meta: tuple[Any, ...] = tuple(metadata)
444+
elif is_annotated_type(type_):
445+
meta = get_args(type_)[1:]
443446
type_ = extract_type_arg(type_, 0)
444447
else:
445448
meta = tuple()

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.10" # x-release-please-version
4+
__version__ = "2.0.0-alpha.11" # x-release-please-version

0 commit comments

Comments
 (0)