-
Notifications
You must be signed in to change notification settings - Fork 416
release: 0.74.0 #1074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release: 0.74.0 #1074
Conversation
On Windows, str(Path) produces backslash-separated paths which the API rejects. Use .as_posix() to ensure forward slashes on all platforms. Fixes #1051
2940aef to
c6cc3e3
Compare
c6cc3e3 to
61a0d97
Compare
61a0d97 to
09e6676
Compare
| client = AnthropicFoundry() | ||
|
|
||
| assert client.api_key == "env-key" | ||
| assert "env-resource.services.ai.azure.com" in str(client.base_url) |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High test
env-resource.services.ai.azure.com
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
The problem should be fixed by parsing client.base_url as a URL, extracting its hostname, and then asserting that the hostname matches (or ends with) the expected value, instead of using a substring match on the URL as a string. For Python, the standard urllib.parse module provides a urlparse function to parse URLs. The line should be replaced with something like:
from urllib.parse import urlparse
assert urlparse(str(client.base_url)).hostname == "env-resource.services.ai.azure.com"If you haven't already imported urlparse in this test file, add the import near the top. Only change the relevant assertion line and add the required import line.
-
Copy modified line R4 -
Copy modified line R52 -
Copy modified line R106
| @@ -1,7 +1,7 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import pytest | ||
|
|
||
| from urllib.parse import urlparse | ||
| from anthropic._exceptions import AnthropicError | ||
| from anthropic.lib.foundry import AnthropicFoundry, AsyncAnthropicFoundry | ||
|
|
||
| @@ -49,7 +49,7 @@ | ||
| client = AnthropicFoundry() | ||
|
|
||
| assert client.api_key == "env-key" | ||
| assert "env-resource.services.ai.azure.com" in str(client.base_url) | ||
| assert urlparse(str(client.base_url)).hostname == "env-resource.services.ai.azure.com" | ||
|
|
||
| def test_missing_credentials_error(self) -> None: | ||
| """Test error raised when no credentials are provided.""" | ||
| @@ -103,4 +103,4 @@ | ||
| client = AsyncAnthropicFoundry() | ||
|
|
||
| assert client.api_key == "env-key" | ||
| assert "env-resource.services.ai.azure.com" in str(client.base_url) | ||
| assert urlparse(str(client.base_url)).hostname == "env-resource.services.ai.azure.com" |
| client = AsyncAnthropicFoundry() | ||
|
|
||
| assert client.api_key == "env-key" | ||
| assert "env-resource.services.ai.azure.com" in str(client.base_url) |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High test
env-resource.services.ai.azure.com
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
The best way to fix the flagged substring check is to properly parse the URL, extract the host portion, and assert directly on the hostname, rather than using a substring match on the full URL. Specifically, replace:
assert "env-resource.services.ai.azure.com" in str(client.base_url)with:
from urllib.parse import urlparse
assert urlparse(str(client.base_url)).hostname == "env-resource.services.ai.azure.com"This ensures the test only passes when the constructed base_url is exactly as expected at the correct position in the URL, rather than occurring anywhere in the string. To implement this, you must import urlparse from urllib.parse at the top of the file, if it doesn't already exist.
-
Copy modified line R4 -
Copy modified line R52 -
Copy modified line R106
| @@ -1,7 +1,7 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import pytest | ||
|
|
||
| from urllib.parse import urlparse | ||
| from anthropic._exceptions import AnthropicError | ||
| from anthropic.lib.foundry import AnthropicFoundry, AsyncAnthropicFoundry | ||
|
|
||
| @@ -49,7 +49,7 @@ | ||
| client = AnthropicFoundry() | ||
|
|
||
| assert client.api_key == "env-key" | ||
| assert "env-resource.services.ai.azure.com" in str(client.base_url) | ||
| assert urlparse(str(client.base_url)).hostname == "env-resource.services.ai.azure.com" | ||
|
|
||
| def test_missing_credentials_error(self) -> None: | ||
| """Test error raised when no credentials are provided.""" | ||
| @@ -103,4 +103,4 @@ | ||
| client = AsyncAnthropicFoundry() | ||
|
|
||
| assert client.api_key == "env-key" | ||
| assert "env-resource.services.ai.azure.com" in str(client.base_url) | ||
| assert urlparse(str(client.base_url)).hostname == "env-resource.services.ai.azure.com" |
Automated Release PR
0.74.0 (2025-11-18)
Full Changelog: v0.73.0...v0.74.0
Features
Bug Fixes
Chores
Documentation
This pull request is managed by Stainless's GitHub App.
The semver version number is based on included commit messages. Alternatively, you can manually set the version number in the title of this pull request.
For a better experience, it is recommended to use either rebase-merge or squash-merge when merging this pull request.
🔗 Stainless website
📚 Read the docs
🙋 Reach out for help or questions