Skip to content

Commit 30d1282

Browse files
release: 2.0.0-alpha.24 (#63)
* expand agents.md (#62) * chore(tests): simplify `get_platform` test `nest_asyncio` is archived and broken on some platforms so it's not worth keeping in our test suite. * release: 2.0.0-alpha.24 --------- Co-authored-by: Zeke Sikelianos <[email protected]> Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent ae85a60 commit 30d1282

File tree

7 files changed

+32
-54
lines changed

7 files changed

+32
-54
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.23"
2+
".": "2.0.0-alpha.24"
33
}

AGENTS.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AGENTS.md
22

3-
This file is for code-writing LLM agents like Claude Code, Gemini CLI, Cursor, etc.
3+
This file contains instructions for code-writing LLM agents like Claude Code, Gemini CLI, Cursor, OpenAI Codex, etc.
44

55
CLAUDE.md symlinks to this file.
66

@@ -19,4 +19,17 @@ Use the `scripts/` directory to run scripts:
1919
- `scripts/lint` - Run linting checks (ruff + pyright + mypy) and import verification
2020
- `scripts/format` - Run code formatting (ruff format + doc formatting)
2121
- `scripts/test` - Run full test suite (includes Prism mock server setup and Pydantic v1 compatibility tests)
22-
- `scripts/mock` - Start Prism mock server for testing
22+
- `scripts/mock` - Start Prism mock server for testing
23+
24+
25+
## Branches and Pull Requests
26+
27+
When opening a pull request, target the `next` branch.
28+
29+
The `main` branch reflects code that has been released to the package manager whereas the next branch queues up unreleased changes for you to review via the release PR.
30+
31+
32+
## More information
33+
34+
Read the CONTRIBUTING.md file in this repository for more information.
35+

CHANGELOG.md

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

3+
## 2.0.0-alpha.24 (2025-09-11)
4+
5+
Full Changelog: [v2.0.0-alpha.23...v2.0.0-alpha.24](https://github.com/replicate/replicate-python-stainless/compare/v2.0.0-alpha.23...v2.0.0-alpha.24)
6+
7+
### Chores
8+
9+
* **tests:** simplify `get_platform` test ([0b697dc](https://github.com/replicate/replicate-python-stainless/commit/0b697dc72e8a177ad383fac229b7e43ee5d7d1ee))
10+
311
## 2.0.0-alpha.23 (2025-09-04)
412

513
Full Changelog: [v2.0.0-alpha.22...v2.0.0-alpha.23](https://github.com/replicate/replicate-python-stainless/compare/v2.0.0-alpha.22...v2.0.0-alpha.23)

pyproject.toml

Lines changed: 1 addition & 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.23"
3+
version = "2.0.0-alpha.24"
44
description = "The official Python library for the replicate API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -57,7 +57,6 @@ dev-dependencies = [
5757
"dirty-equals>=0.6.0",
5858
"importlib-metadata>=6.7.0",
5959
"rich>=13.7.1",
60-
"nest_asyncio==1.6.0",
6160
"pytest-xdist>=3.6.1",
6261
]
6362

requirements-dev.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ multidict==6.4.4
7575
mypy==1.14.1
7676
mypy-extensions==1.0.0
7777
# via mypy
78-
nest-asyncio==1.6.0
7978
nodeenv==1.8.0
8079
# via pyright
8180
nox==2023.4.22

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

tests/test_client.py

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@
66
import os
77
import sys
88
import json
9-
import time
109
import asyncio
1110
import inspect
12-
import subprocess
1311
import tracemalloc
1412
from typing import Any, Union, cast
15-
from textwrap import dedent
1613
from unittest import mock
1714
from typing_extensions import Literal
1815

@@ -23,14 +20,17 @@
2320

2421
from replicate import Replicate, AsyncReplicate, APIResponseValidationError
2522
from replicate._types import Omit
23+
from replicate._utils import asyncify
2624
from replicate._models import BaseModel, FinalRequestOptions
2725
from replicate._exceptions import APIStatusError, ReplicateError, APITimeoutError, APIResponseValidationError
2826
from replicate._base_client import (
2927
DEFAULT_TIMEOUT,
3028
HTTPX_DEFAULT_TIMEOUT,
3129
BaseClient,
30+
OtherPlatform,
3231
DefaultHttpxClient,
3332
DefaultAsyncHttpxClient,
33+
get_platform,
3434
make_request_options,
3535
)
3636

@@ -1709,50 +1709,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
17091709

17101710
assert response.http_request.headers.get("x-stainless-retry-count") == "42"
17111711

1712-
def test_get_platform(self) -> None:
1713-
# A previous implementation of asyncify could leave threads unterminated when
1714-
# used with nest_asyncio.
1715-
#
1716-
# Since nest_asyncio.apply() is global and cannot be un-applied, this
1717-
# test is run in a separate process to avoid affecting other tests.
1718-
test_code = dedent("""
1719-
import asyncio
1720-
import nest_asyncio
1721-
import threading
1722-
1723-
from replicate._utils import asyncify
1724-
from replicate._base_client import get_platform
1725-
1726-
async def test_main() -> None:
1727-
result = await asyncify(get_platform)()
1728-
print(result)
1729-
for thread in threading.enumerate():
1730-
print(thread.name)
1731-
1732-
nest_asyncio.apply()
1733-
asyncio.run(test_main())
1734-
""")
1735-
with subprocess.Popen(
1736-
[sys.executable, "-c", test_code],
1737-
text=True,
1738-
) as process:
1739-
timeout = 10 # seconds
1740-
1741-
start_time = time.monotonic()
1742-
while True:
1743-
return_code = process.poll()
1744-
if return_code is not None:
1745-
if return_code != 0:
1746-
raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code")
1747-
1748-
# success
1749-
break
1750-
1751-
if time.monotonic() - start_time > timeout:
1752-
process.kill()
1753-
raise AssertionError("calling get_platform using asyncify resulted in a hung process")
1754-
1755-
time.sleep(0.1)
1712+
async def test_get_platform(self) -> None:
1713+
platform = await asyncify(get_platform)()
1714+
assert isinstance(platform, (str, OtherPlatform))
17561715

17571716
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
17581717
# Test that the proxy environment variables are set correctly

0 commit comments

Comments
 (0)