Skip to content

Commit f2d99dc

Browse files
srirclaude
andcommitted
Remove PyPI publish workflow, fix CI issues
- Remove publish-pypi.yml (private fork, no PyPI publishing) - Fix mypy type ignore in _compat.py line 29 - Fix mock.patch strings in tests (orb -> orb_sdk) - Fix error message strings in tests - Update apply-customizations.sh with all fixes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent b9de8d0 commit f2d99dc

File tree

5 files changed

+23
-45
lines changed

5 files changed

+23
-45
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

scripts/apply-customizations.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ find tests -name "*.py" -exec sed -i 's/from orb$/from orb_sdk/g' {} +
2424
find tests -name "*.py" -exec sed -i 's/import orb\([^_]\)/import orb_sdk\1/g' {} +
2525
find tests -name "*.py" -exec sed -i 's/import orb$/import orb_sdk/g' {} +
2626

27+
# Update mock.patch strings and error messages in tests
28+
echo "Updating mock.patch and error message strings in tests/"
29+
find tests -name "*.py" -exec sed -i "s/\"orb\._/\"orb_sdk._/g" {} +
30+
find tests -name "*.py" -exec sed -i "s/'orb\._/'orb_sdk._/g" {} +
31+
32+
# Add type ignore to _compat.py line 29 if missing
33+
echo "Adding type ignore comment to _compat.py"
34+
sed -i 's/return tp is Union or tp is types.UnionType$/return tp is Union or tp is types.UnionType # type: ignore[comparison-overlap]/' src/orb_sdk/_utils/_compat.py
35+
2736
# Update pyproject.toml
2837
echo "Updating pyproject.toml"
2938
sed -i 's/name = "orb-billing"/name = "orb_sdk"/' pyproject.toml

src/orb_sdk/_utils/_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def is_union(tp: Optional[Type[Any]]) -> bool:
2626
else:
2727
import types
2828

29-
return tp is Union or tp is types.UnionType
29+
return tp is Union or tp is types.UnionType # type: ignore[comparison-overlap]
3030

3131

3232
def is_typeddict(tp: Type[Any]) -> bool:

tests/test_client.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ def test_parse_retry_after_header(
752752
calculated = client._calculate_retry_timeout(remaining_retries, options, headers)
753753
assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType]
754754

755-
@mock.patch("orb._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
755+
@mock.patch("orb_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
756756
@pytest.mark.respx(base_url=base_url)
757757
def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, client: Orb) -> None:
758758
respx_mock.post("/customers").mock(side_effect=httpx.TimeoutException("Test timeout error"))
@@ -762,7 +762,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, clien
762762

763763
assert _get_open_connections(client) == 0
764764

765-
@mock.patch("orb._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
765+
@mock.patch("orb_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
766766
@pytest.mark.respx(base_url=base_url)
767767
def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client: Orb) -> None:
768768
respx_mock.post("/customers").mock(return_value=httpx.Response(500))
@@ -772,7 +772,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client
772772
assert _get_open_connections(client) == 0
773773

774774
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
775-
@mock.patch("orb._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
775+
@mock.patch("orb_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
776776
@pytest.mark.respx(base_url=base_url)
777777
@pytest.mark.parametrize("failure_mode", ["status", "exception"])
778778
def test_retries_taken(
@@ -803,7 +803,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
803803
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
804804

805805
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
806-
@mock.patch("orb._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
806+
@mock.patch("orb_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
807807
@pytest.mark.respx(base_url=base_url)
808808
def test_omit_retry_count_header(self, client: Orb, failures_before_success: int, respx_mock: MockRouter) -> None:
809809
client = client.with_options(max_retries=4)
@@ -826,7 +826,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
826826
assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
827827

828828
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
829-
@mock.patch("orb._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
829+
@mock.patch("orb_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
830830
@pytest.mark.respx(base_url=base_url)
831831
def test_overwrite_retry_count_header(
832832
self, client: Orb, failures_before_success: int, respx_mock: MockRouter
@@ -851,7 +851,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
851851
assert response.http_request.headers.get("x-stainless-retry-count") == "42"
852852

853853
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
854-
@mock.patch("orb._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
854+
@mock.patch("orb_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
855855
@pytest.mark.respx(base_url=base_url)
856856
def test_retries_taken_new_response_class(
857857
self, client: Orb, failures_before_success: int, respx_mock: MockRouter
@@ -1630,7 +1630,7 @@ async def test_parse_retry_after_header(
16301630
calculated = async_client._calculate_retry_timeout(remaining_retries, options, headers)
16311631
assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType]
16321632

1633-
@mock.patch("orb._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
1633+
@mock.patch("orb_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
16341634
@pytest.mark.respx(base_url=base_url)
16351635
async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, async_client: AsyncOrb) -> None:
16361636
respx_mock.post("/customers").mock(side_effect=httpx.TimeoutException("Test timeout error"))
@@ -1642,7 +1642,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter,
16421642

16431643
assert _get_open_connections(async_client) == 0
16441644

1645-
@mock.patch("orb._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
1645+
@mock.patch("orb_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
16461646
@pytest.mark.respx(base_url=base_url)
16471647
async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, async_client: AsyncOrb) -> None:
16481648
respx_mock.post("/customers").mock(return_value=httpx.Response(500))
@@ -1654,7 +1654,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter,
16541654
assert _get_open_connections(async_client) == 0
16551655

16561656
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
1657-
@mock.patch("orb._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
1657+
@mock.patch("orb_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
16581658
@pytest.mark.respx(base_url=base_url)
16591659
@pytest.mark.parametrize("failure_mode", ["status", "exception"])
16601660
async def test_retries_taken(
@@ -1685,7 +1685,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
16851685
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
16861686

16871687
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
1688-
@mock.patch("orb._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
1688+
@mock.patch("orb_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
16891689
@pytest.mark.respx(base_url=base_url)
16901690
async def test_omit_retry_count_header(
16911691
self, async_client: AsyncOrb, failures_before_success: int, respx_mock: MockRouter
@@ -1710,7 +1710,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
17101710
assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
17111711

17121712
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
1713-
@mock.patch("orb._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
1713+
@mock.patch("orb_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
17141714
@pytest.mark.respx(base_url=base_url)
17151715
async def test_overwrite_retry_count_header(
17161716
self, async_client: AsyncOrb, failures_before_success: int, respx_mock: MockRouter
@@ -1735,7 +1735,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
17351735
assert response.http_request.headers.get("x-stainless-retry-count") == "42"
17361736

17371737
@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
1738-
@mock.patch("orb._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
1738+
@mock.patch("orb_sdk._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
17391739
@pytest.mark.respx(base_url=base_url)
17401740
async def test_retries_taken_new_response_class(
17411741
self, async_client: AsyncOrb, failures_before_success: int, respx_mock: MockRouter

tests/test_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_extract_response_type_direct_classes() -> None:
3737
def test_extract_response_type_direct_class_missing_type_arg() -> None:
3838
with pytest.raises(
3939
RuntimeError,
40-
match="Expected type <class 'orb._response.AsyncAPIResponse'> to have a type argument at index 0 but it did not",
40+
match="Expected type <class 'orb_sdk._response.AsyncAPIResponse'> to have a type argument at index 0 but it did not",
4141
):
4242
extract_response_type(AsyncAPIResponse)
4343

0 commit comments

Comments
 (0)