Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.14.0"
".": "4.14.1"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 4.14.1 (2025-09-08)

Full Changelog: [v4.14.0...v4.14.1](https://github.com/orbcorp/orb-python/compare/v4.14.0...v4.14.1)

### Bug Fixes

* **types:** add missing types to method arguments ([ad3dc7d](https://github.com/orbcorp/orb-python/commit/ad3dc7d0d1d7a20d2a5d3e68000e793e6bc4afd5))


### Chores

* **tests:** simplify `get_platform` test ([dd4f6e1](https://github.com/orbcorp/orb-python/commit/dd4f6e1394dc2ddf53dc791658d300ebe321f8a8))

## 4.14.0 (2025-09-05)

Full Changelog: [v4.13.0...v4.14.0](https://github.com/orbcorp/orb-python/compare/v4.13.0...v4.14.0)
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "orb-billing"
version = "4.14.0"
version = "4.14.1"
description = "The official Python library for the orb API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -56,7 +56,6 @@ dev-dependencies = [
"dirty-equals>=0.6.0",
"importlib-metadata>=6.7.0",
"rich>=13.7.1",
"nest_asyncio==1.6.0",
"pytest-xdist>=3.6.1",
]

Expand Down
1 change: 0 additions & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ multidict==6.4.4
mypy==1.14.1
mypy-extensions==1.0.0
# via mypy
nest-asyncio==1.6.0
nodeenv==1.8.0
# via pyright
nox==2023.4.22
Expand Down
2 changes: 1 addition & 1 deletion src/orb/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "orb"
__version__ = "4.14.0" # x-release-please-version
__version__ = "4.14.1" # x-release-please-version
16 changes: 8 additions & 8 deletions src/orb/resources/customers/credits/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ def create_entry(
self,
customer_id: str,
*,
amount: float | None | NotGiven = NOT_GIVEN,
amount: float | Optional[float] | NotGiven = NOT_GIVEN,
entry_type: Literal["increment"]
| Literal["decrement"]
| Literal["expiration_change"]
Expand All @@ -1056,7 +1056,7 @@ def create_entry(
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
per_unit_cost_basis: Optional[str] | NotGiven = NOT_GIVEN,
target_expiry_date: Union[str, date] | NotGiven = NOT_GIVEN,
block_id: Optional[str] | NotGiven = NOT_GIVEN,
block_id: Optional[str] | str | NotGiven = NOT_GIVEN,
void_reason: Optional[Literal["refund"]] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -1933,7 +1933,7 @@ def create_entry_by_external_id(
self,
external_customer_id: str,
*,
amount: float | None | NotGiven = NOT_GIVEN,
amount: float | Optional[float] | NotGiven = NOT_GIVEN,
entry_type: Literal["increment"]
| Literal["decrement"]
| Literal["expiration_change"]
Expand All @@ -1950,7 +1950,7 @@ def create_entry_by_external_id(
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
per_unit_cost_basis: Optional[str] | NotGiven = NOT_GIVEN,
target_expiry_date: Union[str, date] | NotGiven = NOT_GIVEN,
block_id: Optional[str] | NotGiven = NOT_GIVEN,
block_id: Optional[str] | str | NotGiven = NOT_GIVEN,
void_reason: Optional[Literal["refund"]] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -3172,7 +3172,7 @@ async def create_entry(
self,
customer_id: str,
*,
amount: float | None | NotGiven = NOT_GIVEN,
amount: float | Optional[float] | NotGiven = NOT_GIVEN,
entry_type: Literal["increment"]
| Literal["decrement"]
| Literal["expiration_change"]
Expand All @@ -3187,7 +3187,7 @@ async def create_entry(
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
per_unit_cost_basis: Optional[str] | NotGiven = NOT_GIVEN,
target_expiry_date: Union[str, date] | NotGiven = NOT_GIVEN,
block_id: Optional[str] | NotGiven = NOT_GIVEN,
block_id: Optional[str] | str | NotGiven = NOT_GIVEN,
void_reason: Optional[Literal["refund"]] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -4064,7 +4064,7 @@ async def create_entry_by_external_id(
self,
external_customer_id: str,
*,
amount: float | None | NotGiven = NOT_GIVEN,
amount: float | Optional[float] | NotGiven = NOT_GIVEN,
entry_type: Literal["increment"]
| Literal["decrement"]
| Literal["expiration_change"]
Expand All @@ -4081,7 +4081,7 @@ async def create_entry_by_external_id(
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
per_unit_cost_basis: Optional[str] | NotGiven = NOT_GIVEN,
target_expiry_date: Union[str, date] | NotGiven = NOT_GIVEN,
block_id: Optional[str] | NotGiven = NOT_GIVEN,
block_id: Optional[str] | str | NotGiven = NOT_GIVEN,
void_reason: Optional[Literal["refund"]] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down
52 changes: 52 additions & 0 deletions src/orb/resources/prices/prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -2745,6 +2745,32 @@ def create(
billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN,
conversion_rate: Optional[float] | NotGiven = NOT_GIVEN,
conversion_rate_config: Optional[price_create_params.NewFloatingUnitPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingTieredPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingBulkPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingPackagePriceConversionRateConfig]
| Optional[price_create_params.NewFloatingMatrixPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingThresholdTotalAmountPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingTieredPackagePriceConversionRateConfig]
| Optional[price_create_params.NewFloatingTieredWithMinimumPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingGroupedTieredPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingTieredPackageWithMinimumPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingPackageWithAllocationPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingUnitWithPercentPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingMatrixWithAllocationPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingTieredWithProrationPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingUnitWithProrationPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingGroupedAllocationPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingBulkWithProrationPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingGroupedWithProratedMinimumPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingGroupedWithMeteredMinimumPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingMatrixWithDisplayNamePriceConversionRateConfig]
| Optional[price_create_params.NewFloatingGroupedTieredPackagePriceConversionRateConfig]
| Optional[price_create_params.NewFloatingMaxGroupTieredPackagePriceConversionRateConfig]
| Optional[price_create_params.NewFloatingScalableMatrixWithUnitPricingPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingScalableMatrixWithTieredPricingPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingCumulativeGroupedBulkPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingMinimumCompositePriceConversionRateConfig]
| NotGiven = NOT_GIVEN,
dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN,
external_price_id: Optional[str] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -5974,6 +6000,32 @@ async def create(
billing_cycle_configuration: Optional[NewBillingCycleConfiguration] | NotGiven = NOT_GIVEN,
conversion_rate: Optional[float] | NotGiven = NOT_GIVEN,
conversion_rate_config: Optional[price_create_params.NewFloatingUnitPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingTieredPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingBulkPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingPackagePriceConversionRateConfig]
| Optional[price_create_params.NewFloatingMatrixPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingThresholdTotalAmountPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingTieredPackagePriceConversionRateConfig]
| Optional[price_create_params.NewFloatingTieredWithMinimumPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingGroupedTieredPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingTieredPackageWithMinimumPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingPackageWithAllocationPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingUnitWithPercentPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingMatrixWithAllocationPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingTieredWithProrationPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingUnitWithProrationPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingGroupedAllocationPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingBulkWithProrationPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingGroupedWithProratedMinimumPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingGroupedWithMeteredMinimumPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingGroupedWithMinMaxThresholdsPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingMatrixWithDisplayNamePriceConversionRateConfig]
| Optional[price_create_params.NewFloatingGroupedTieredPackagePriceConversionRateConfig]
| Optional[price_create_params.NewFloatingMaxGroupTieredPackagePriceConversionRateConfig]
| Optional[price_create_params.NewFloatingScalableMatrixWithUnitPricingPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingScalableMatrixWithTieredPricingPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingCumulativeGroupedBulkPriceConversionRateConfig]
| Optional[price_create_params.NewFloatingMinimumCompositePriceConversionRateConfig]
| NotGiven = NOT_GIVEN,
dimensional_price_configuration: Optional[NewDimensionalPriceConfiguration] | NotGiven = NOT_GIVEN,
external_price_id: Optional[str] | NotGiven = NOT_GIVEN,
Expand Down
53 changes: 6 additions & 47 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
import os
import sys
import json
import time
import asyncio
import inspect
import subprocess
import tracemalloc
from typing import Any, Union, cast
from textwrap import dedent
from unittest import mock
from typing_extensions import Literal

Expand All @@ -23,14 +20,17 @@

from orb import Orb, AsyncOrb, APIResponseValidationError
from orb._types import Omit
from orb._utils import asyncify
from orb._models import BaseModel, FinalRequestOptions
from orb._exceptions import OrbError, APIStatusError, APITimeoutError, APIResponseValidationError
from orb._base_client import (
DEFAULT_TIMEOUT,
HTTPX_DEFAULT_TIMEOUT,
BaseClient,
OtherPlatform,
DefaultHttpxClient,
DefaultAsyncHttpxClient,
get_platform,
make_request_options,
)

Expand Down Expand Up @@ -1724,50 +1724,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
assert response.retries_taken == failures_before_success
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success

def test_get_platform(self) -> None:
# A previous implementation of asyncify could leave threads unterminated when
# used with nest_asyncio.
#
# Since nest_asyncio.apply() is global and cannot be un-applied, this
# test is run in a separate process to avoid affecting other tests.
test_code = dedent("""
import asyncio
import nest_asyncio
import threading

from orb._utils import asyncify
from orb._base_client import get_platform

async def test_main() -> None:
result = await asyncify(get_platform)()
print(result)
for thread in threading.enumerate():
print(thread.name)

nest_asyncio.apply()
asyncio.run(test_main())
""")
with subprocess.Popen(
[sys.executable, "-c", test_code],
text=True,
) as process:
timeout = 10 # seconds

start_time = time.monotonic()
while True:
return_code = process.poll()
if return_code is not None:
if return_code != 0:
raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code")

# success
break

if time.monotonic() - start_time > timeout:
process.kill()
raise AssertionError("calling get_platform using asyncify resulted in a hung process")

time.sleep(0.1)
async def test_get_platform(self) -> None:
platform = await asyncify(get_platform)()
assert isinstance(platform, (str, OtherPlatform))

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