Skip to content

Conversation

@stainless-app
Copy link
Contributor

@stainless-app stainless-app bot commented Nov 18, 2025

Automated Release PR

0.74.0 (2025-11-18)

Full Changelog: v0.73.0...v0.74.0

Features

Bug Fixes

  • examples/memory: properly add assistant_content to messages (#1049) (9c7141b)
  • use posix paths in file collection for cross-platform compatibility (d9c6f40), closes #1051

Chores

  • internal: remove unnecessary wrapper around external snapshots (19eceac)

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

On Windows, str(Path) produces backslash-separated paths which
the API rejects. Use .as_posix() to ensure forward slashes on
all platforms.

Fixes #1051
@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next branch from 2940aef to c6cc3e3 Compare November 18, 2025 11:22
@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next branch from c6cc3e3 to 61a0d97 Compare November 18, 2025 15:24
@stainless-app stainless-app bot changed the title release: 0.73.1 release: 0.74.0 Nov 18, 2025
@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next branch from 61a0d97 to 09e6676 Compare November 18, 2025 15:25
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

The string
env-resource.services.ai.azure.com
may be at an arbitrary position in the sanitized URL.

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.

Suggested changeset 1
tests/lib/test_azure.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/lib/test_azure.py b/tests/lib/test_azure.py
--- a/tests/lib/test_azure.py
+++ b/tests/lib/test_azure.py
@@ -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"
EOF
@@ -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"
Copilot is powered by AI and may make mistakes. Always verify output.
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

The string
env-resource.services.ai.azure.com
may be at an arbitrary position in the sanitized URL.

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.


Suggested changeset 1
tests/lib/test_azure.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/lib/test_azure.py b/tests/lib/test_azure.py
--- a/tests/lib/test_azure.py
+++ b/tests/lib/test_azure.py
@@ -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"
EOF
@@ -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"
Copilot is powered by AI and may make mistakes. Always verify output.
@RobertCraigie RobertCraigie merged commit 49fe6ed into main Nov 18, 2025
9 of 10 checks passed
@stainless-app
Copy link
Contributor Author

stainless-app bot commented Nov 18, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skills.create requires posix paths

6 participants