Skip to content

Commit dd6ab66

Browse files
authored
Merge pull request #4 from channel3-ai/release-please--branches--main--changes--next
release: 2.2.0
2 parents 761dc33 + 8248c1f commit dd6ab66

File tree

9 files changed

+24
-100
lines changed

9 files changed

+24
-100
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.1.0"
2+
".": "2.2.0"
33
}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 6
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/channel3%2Fpublic-sdk-c870f6f12fcf671675af9dfddb9b6e4fd968bc75717a50d53d5626180ecbdcaf.yml
33
openapi_spec_hash: 3ac13f44aeb96508ab9073b88a9f633d
4-
config_hash: 8e18f4f27ef0200cac8c5ee682f53ab8
4+
config_hash: 1a71e5acc94d5679abff73aafac92746

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.2.0 (2025-09-16)
4+
5+
Full Changelog: [v2.1.0...v2.2.0](https://github.com/channel3-ai/sdk-python/compare/v2.1.0...v2.2.0)
6+
7+
### Features
8+
9+
* **api:** manual updates ([79f6922](https://github.com/channel3-ai/sdk-python/commit/79f69227ff70ac778731b6dac5f1297a66800893))
10+
311
## 2.1.0 (2025-09-16)
412

513
Full Changelog: [v2.0.0...v2.1.0](https://github.com/channel3-ai/sdk-python/compare/v2.0.0...v2.1.0)

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ from channel3_sdk import Channel3
3030

3131
client = Channel3(
3232
api_key=os.environ.get("CHANNEL3_API_KEY"), # This is the default and can be omitted
33-
# defaults to "production".
34-
environment="development",
3533
)
3634

3735
response = client.search.perform()
@@ -53,8 +51,6 @@ from channel3_sdk import AsyncChannel3
5351

5452
client = AsyncChannel3(
5553
api_key=os.environ.get("CHANNEL3_API_KEY"), # This is the default and can be omitted
56-
# defaults to "production".
57-
environment="development",
5854
)
5955

6056

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "channel3_sdk"
3-
version = "2.1.0"
3+
version = "2.2.0"
44
description = "The official Python library for the channel3 API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/channel3_sdk/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
77
from ._utils import file_from_path
88
from ._client import (
9-
ENVIRONMENTS,
109
Client,
1110
Stream,
1211
Timeout,
@@ -72,7 +71,6 @@
7271
"AsyncStream",
7372
"Channel3",
7473
"AsyncChannel3",
75-
"ENVIRONMENTS",
7674
"file_from_path",
7775
"BaseModel",
7876
"DEFAULT_TIMEOUT",

src/channel3_sdk/_client.py

Lines changed: 12 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from __future__ import annotations
44

55
import os
6-
from typing import Any, Dict, Union, Mapping, cast
7-
from typing_extensions import Self, Literal, override
6+
from typing import Any, Union, Mapping
7+
from typing_extensions import Self, override
88

99
import httpx
1010

@@ -41,7 +41,6 @@
4141
)
4242

4343
__all__ = [
44-
"ENVIRONMENTS",
4544
"Timeout",
4645
"Transport",
4746
"ProxiesTypes",
@@ -52,11 +51,6 @@
5251
"AsyncClient",
5352
]
5453

55-
ENVIRONMENTS: Dict[str, str] = {
56-
"production": "https://api.trychannel3.com",
57-
"development": "https://localhost:8000",
58-
}
59-
6054

6155
class Channel3(SyncAPIClient):
6256
search: search.SearchResource
@@ -69,14 +63,11 @@ class Channel3(SyncAPIClient):
6963
# client options
7064
api_key: str
7165

72-
_environment: Literal["production", "development"] | NotGiven
73-
7466
def __init__(
7567
self,
7668
*,
7769
api_key: str | None = None,
78-
environment: Literal["production", "development"] | NotGiven = NOT_GIVEN,
79-
base_url: str | httpx.URL | None | NotGiven = NOT_GIVEN,
70+
base_url: str | httpx.URL | None = None,
8071
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
8172
max_retries: int = DEFAULT_MAX_RETRIES,
8273
default_headers: Mapping[str, str] | None = None,
@@ -107,31 +98,10 @@ def __init__(
10798
)
10899
self.api_key = api_key
109100

110-
self._environment = environment
111-
112-
base_url_env = os.environ.get("CHANNEL3_BASE_URL")
113-
if is_given(base_url) and base_url is not None:
114-
# cast required because mypy doesn't understand the type narrowing
115-
base_url = cast("str | httpx.URL", base_url) # pyright: ignore[reportUnnecessaryCast]
116-
elif is_given(environment):
117-
if base_url_env and base_url is not None:
118-
raise ValueError(
119-
"Ambiguous URL; The `CHANNEL3_BASE_URL` env var and the `environment` argument are given. If you want to use the environment, you must pass base_url=None",
120-
)
121-
122-
try:
123-
base_url = ENVIRONMENTS[environment]
124-
except KeyError as exc:
125-
raise ValueError(f"Unknown environment: {environment}") from exc
126-
elif base_url_env is not None:
127-
base_url = base_url_env
128-
else:
129-
self._environment = environment = "production"
130-
131-
try:
132-
base_url = ENVIRONMENTS[environment]
133-
except KeyError as exc:
134-
raise ValueError(f"Unknown environment: {environment}") from exc
101+
if base_url is None:
102+
base_url = os.environ.get("CHANNEL3_BASE_URL")
103+
if base_url is None:
104+
base_url = f"https://api.trychannel3.com"
135105

136106
super().__init__(
137107
version=__version__,
@@ -175,7 +145,6 @@ def copy(
175145
self,
176146
*,
177147
api_key: str | None = None,
178-
environment: Literal["production", "development"] | None = None,
179148
base_url: str | httpx.URL | None = None,
180149
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
181150
http_client: httpx.Client | None = None,
@@ -211,7 +180,6 @@ def copy(
211180
return self.__class__(
212181
api_key=api_key or self.api_key,
213182
base_url=base_url or self.base_url,
214-
environment=environment or self._environment,
215183
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
216184
http_client=http_client,
217185
max_retries=max_retries if is_given(max_retries) else self.max_retries,
@@ -288,14 +256,11 @@ class AsyncChannel3(AsyncAPIClient):
288256
# client options
289257
api_key: str
290258

291-
_environment: Literal["production", "development"] | NotGiven
292-
293259
def __init__(
294260
self,
295261
*,
296262
api_key: str | None = None,
297-
environment: Literal["production", "development"] | NotGiven = NOT_GIVEN,
298-
base_url: str | httpx.URL | None | NotGiven = NOT_GIVEN,
263+
base_url: str | httpx.URL | None = None,
299264
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
300265
max_retries: int = DEFAULT_MAX_RETRIES,
301266
default_headers: Mapping[str, str] | None = None,
@@ -326,31 +291,10 @@ def __init__(
326291
)
327292
self.api_key = api_key
328293

329-
self._environment = environment
330-
331-
base_url_env = os.environ.get("CHANNEL3_BASE_URL")
332-
if is_given(base_url) and base_url is not None:
333-
# cast required because mypy doesn't understand the type narrowing
334-
base_url = cast("str | httpx.URL", base_url) # pyright: ignore[reportUnnecessaryCast]
335-
elif is_given(environment):
336-
if base_url_env and base_url is not None:
337-
raise ValueError(
338-
"Ambiguous URL; The `CHANNEL3_BASE_URL` env var and the `environment` argument are given. If you want to use the environment, you must pass base_url=None",
339-
)
340-
341-
try:
342-
base_url = ENVIRONMENTS[environment]
343-
except KeyError as exc:
344-
raise ValueError(f"Unknown environment: {environment}") from exc
345-
elif base_url_env is not None:
346-
base_url = base_url_env
347-
else:
348-
self._environment = environment = "production"
349-
350-
try:
351-
base_url = ENVIRONMENTS[environment]
352-
except KeyError as exc:
353-
raise ValueError(f"Unknown environment: {environment}") from exc
294+
if base_url is None:
295+
base_url = os.environ.get("CHANNEL3_BASE_URL")
296+
if base_url is None:
297+
base_url = f"https://api.trychannel3.com"
354298

355299
super().__init__(
356300
version=__version__,
@@ -394,7 +338,6 @@ def copy(
394338
self,
395339
*,
396340
api_key: str | None = None,
397-
environment: Literal["production", "development"] | None = None,
398341
base_url: str | httpx.URL | None = None,
399342
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
400343
http_client: httpx.AsyncClient | None = None,
@@ -430,7 +373,6 @@ def copy(
430373
return self.__class__(
431374
api_key=api_key or self.api_key,
432375
base_url=base_url or self.base_url,
433-
environment=environment or self._environment,
434376
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
435377
http_client=http_client,
436378
max_retries=max_retries if is_given(max_retries) else self.max_retries,

src/channel3_sdk/_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__ = "channel3_sdk"
4-
__version__ = "2.1.0" # x-release-please-version
4+
__version__ = "2.2.0" # x-release-please-version

tests/test_client.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -560,16 +560,6 @@ def test_base_url_env(self) -> None:
560560
client = Channel3(api_key=api_key, _strict_response_validation=True)
561561
assert client.base_url == "http://localhost:5000/from/env/"
562562

563-
# explicit environment arg requires explicitness
564-
with update_env(CHANNEL3_BASE_URL="http://localhost:5000/from/env"):
565-
with pytest.raises(ValueError, match=r"you must pass base_url=None"):
566-
Channel3(api_key=api_key, _strict_response_validation=True, environment="production")
567-
568-
client = Channel3(
569-
base_url=None, api_key=api_key, _strict_response_validation=True, environment="production"
570-
)
571-
assert str(client.base_url).startswith("https://api.trychannel3.com")
572-
573563
@pytest.mark.parametrize(
574564
"client",
575565
[
@@ -1373,16 +1363,6 @@ def test_base_url_env(self) -> None:
13731363
client = AsyncChannel3(api_key=api_key, _strict_response_validation=True)
13741364
assert client.base_url == "http://localhost:5000/from/env/"
13751365

1376-
# explicit environment arg requires explicitness
1377-
with update_env(CHANNEL3_BASE_URL="http://localhost:5000/from/env"):
1378-
with pytest.raises(ValueError, match=r"you must pass base_url=None"):
1379-
AsyncChannel3(api_key=api_key, _strict_response_validation=True, environment="production")
1380-
1381-
client = AsyncChannel3(
1382-
base_url=None, api_key=api_key, _strict_response_validation=True, environment="production"
1383-
)
1384-
assert str(client.base_url).startswith("https://api.trychannel3.com")
1385-
13861366
@pytest.mark.parametrize(
13871367
"client",
13881368
[

0 commit comments

Comments
 (0)