Merge pull request #710 from jlowin/deprecation-stack

Ensure deprecation warnings have stacklevel=2
This commit is contained in:
Jeremiah Lowin 2025-06-04 16:01:50 -04:00 committed by GitHub
commit c0e1d1fa71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 0 deletions

View file

@ -60,6 +60,7 @@ class PromptManager:
warnings.warn(
"PromptManager.add_prompt_from_fn() is deprecated. Use Prompt.from_function() and call add_prompt() instead.",
DeprecationWarning,
stacklevel=2,
)
prompt = FunctionPrompt.from_function(
fn, name=name, description=description, tags=tags

View file

@ -125,6 +125,7 @@ class ResourceManager:
warnings.warn(
"add_resource_from_fn is deprecated. Use Resource.from_function() and call add_resource() instead.",
DeprecationWarning,
stacklevel=2,
)
resource = Resource.from_function(
fn=fn,
@ -181,6 +182,7 @@ class ResourceManager:
warnings.warn(
"add_template_from_fn is deprecated. Use ResourceTemplate.from_function() and call add_template() instead.",
DeprecationWarning,
stacklevel=2,
)
template = ResourceTemplate.from_function(
fn,

View file

@ -73,6 +73,7 @@ class ToolManager:
warnings.warn(
"ToolManager.add_tool_from_fn() is deprecated. Use Tool.from_function() and call add_tool() instead.",
DeprecationWarning,
stacklevel=2,
)
tool = Tool.from_function(
fn,