arcade-core 4.2.1__py3-none-any.whl → 4.2.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
arcade_core/errors.py CHANGED
@@ -1,5 +1,4 @@
1
1
  import traceback
2
- import warnings
3
2
  from abc import ABC, abstractmethod
4
3
  from enum import Enum
5
4
  from typing import Any
@@ -230,15 +229,10 @@ class ToolOutputError(ToolSerializationError):
230
229
  # 2. ------ tool-body errors ------
231
230
  class ToolExecutionError(ToolRuntimeError):
232
231
  """
233
- DEPRECATED: Raised when there is an error executing a tool.
234
-
235
- ToolExecutionError is deprecated and will be removed in a future major version.
236
- Use more specific error types instead:
237
- - RetryableToolError for retryable errors
238
- - ContextRequiredToolError for errors requiring user context
239
- - FatalToolError for fatal/unexpected errors
240
- - UpstreamError for upstream service errors
241
- - UpstreamRateLimitError for upstream rate limiting errors
232
+ Raised when an error occurs during the execution of a tool's body.
233
+
234
+ This is the base class for tool execution errors and should be raised when catching
235
+ exceptions within a tool to provide meaningful information to the tool caller.
242
236
  """
243
237
 
244
238
  def __init__(
@@ -248,14 +242,6 @@ class ToolExecutionError(ToolRuntimeError):
248
242
  *,
249
243
  extra: dict[str, Any] | None = None,
250
244
  ):
251
- if type(self) is ToolExecutionError:
252
- warnings.warn(
253
- "ToolExecutionError is deprecated and will be removed in a future major version. "
254
- "Use more specific error types instead: RetryableToolError, ContextRequiredToolError, "
255
- "FatalToolError, UpstreamError, or UpstreamRateLimitError.",
256
- DeprecationWarning,
257
- stacklevel=2,
258
- )
259
245
  super().__init__(message, developer_message=developer_message, extra=extra)
260
246
 
261
247
 
arcade_core/toolkit.py CHANGED
@@ -299,32 +299,50 @@ class Toolkit(BaseModel):
299
299
  # Skipping this file is necessary because tools are discovered via AST parsing, but those tools
300
300
  # aren't in the module's namespace yet since the file is still executing.
301
301
  current_file = None
302
+ current_module_name = None
302
303
  main_module = sys.modules.get("__main__")
303
- if main_module and hasattr(main_module, "__file__") and main_module.__file__:
304
- with contextlib.suppress(Exception):
305
- current_file = Path(main_module.__file__).resolve()
304
+ if main_module:
305
+ if hasattr(main_module, "__file__") and main_module.__file__:
306
+ with contextlib.suppress(Exception):
307
+ current_file = Path(main_module.__file__).resolve()
308
+ # Get module name from __spec__ if available (used when paths don't match,
309
+ # e.g., script runs from bundle but package is in site-packages)
310
+ main_spec = getattr(main_module, "__spec__", None)
311
+ if main_spec and main_spec.name:
312
+ current_module_name = main_spec.name
306
313
 
307
314
  tools: dict[str, list[str]] = {}
308
315
 
309
316
  for module_path in modules:
310
- # Skip adding tools from the currently executing file
317
+ # Build import path first (needed for module name comparison in skip logic)
318
+ relative_path = module_path.relative_to(package_dir)
319
+ relative_parts = relative_path.with_suffix("").parts
320
+ import_path = ".".join(relative_parts)
321
+ if relative_parts and relative_parts[0] == package_name:
322
+ full_import_path = import_path
323
+ else:
324
+ full_import_path = f"{package_name}.{import_path}" if import_path else package_name
325
+
326
+ # Skip logic: check by file path OR by module name
327
+ # This handles cases where the script is run from a different location than
328
+ # where the package is installed (e.g., deployment scenarios)
329
+ should_skip = False
311
330
  if current_file:
312
331
  try:
313
332
  module_path_resolved = module_path.resolve()
314
333
  if module_path_resolved == current_file:
315
- continue
334
+ should_skip = True
316
335
  except Exception: # noqa: S110
317
336
  pass
318
337
 
319
- relative_path = module_path.relative_to(package_dir)
338
+ # Secondary check: compare module names when paths don't match
339
+ if not should_skip and current_module_name and full_import_path == current_module_name:
340
+ should_skip = True
341
+
342
+ if should_skip:
343
+ continue
344
+
320
345
  cls.validate_file(module_path)
321
- # Build import path and avoid duplicating the package prefix if it already exists
322
- relative_parts = relative_path.with_suffix("").parts
323
- import_path = ".".join(relative_parts)
324
- if relative_parts and relative_parts[0] == package_name:
325
- full_import_path = import_path
326
- else:
327
- full_import_path = f"{package_name}.{import_path}" if import_path else package_name
328
346
  tools[full_import_path] = get_tools_from_file(str(module_path))
329
347
 
330
348
  if not tools:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arcade-core
3
- Version: 4.2.1
3
+ Version: 4.2.3
4
4
  Summary: Arcade Core - Core library for Arcade platform
5
5
  Author-email: Arcade <dev@arcade.dev>
6
6
  License: MIT
@@ -17,6 +17,7 @@ Requires-Dist: httpx>=0.27.0
17
17
  Requires-Dist: loguru>=0.7.0
18
18
  Requires-Dist: packaging>=24.1
19
19
  Requires-Dist: portalocker>=2.10.0
20
+ Requires-Dist: posthog<7.0.0,>=6.7.6
20
21
  Requires-Dist: pydantic>=2.7.0
21
22
  Requires-Dist: pyjwt>=2.8.0
22
23
  Requires-Dist: pyyaml>=6.0
@@ -8,13 +8,13 @@ arcade_core/config_model.py,sha256=EA6XQWj-oJu_e4j0kuVT1K5fbwRvwv-lUYMrctcW2Ws,6
8
8
  arcade_core/constants.py,sha256=E3s22aGDhYDM_vkxdo7PZf8F3pznqM-NqQQzgIjhhD8,531
9
9
  arcade_core/context.py,sha256=J2MgbVznhJC2qarHq3dTL72W4NGYOM1pjXdI_YwgkA4,3316
10
10
  arcade_core/discovery.py,sha256=PluKGhNtJ7RYjJuPDMB8LCNinQLKzlqoAtc3dwKb6IA,8397
11
- arcade_core/errors.py,sha256=fsi7m6TQQSsdSNHl4rBoSN_YH3ZV910gjvBFqB207f4,13326
11
+ arcade_core/errors.py,sha256=B7Qqmnbi2F_3i8rhC_hyNKS6ApH5DxwBK5wEo-Ui0Tc,12658
12
12
  arcade_core/executor.py,sha256=RKUmh0by3CVcNSKSbmuSLhk5TzcWrH8PYOSUhR9tRsI,4333
13
13
  arcade_core/output.py,sha256=CMY1pHlQIR27Beiz2I-Yg1aO-P-pbsEbhBZ1RdYuflc,4040
14
14
  arcade_core/parse.py,sha256=arKGKL9C6g__tRfZ4re6IM_wAqr1v3LrOzTOBEDLhDc,2366
15
15
  arcade_core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  arcade_core/schema.py,sha256=y32Ndlb1b3Hw7_Wm3eVXxh0kSg3oGitWUYBfwFLjHuY,21198
17
- arcade_core/toolkit.py,sha256=lLlOL6fA6Lmo-dtLTMMcPCzKDf9YQObwxG1LdVADv3E,14431
17
+ arcade_core/toolkit.py,sha256=FO_I-ZVNL7-IPMubfY74Zas_pQKEzwyUvFB9g-aFbgY,15272
18
18
  arcade_core/utils.py,sha256=_3bM-yfIDFmMVqt-NFYp2Lx1QcNWp7xytGjUQzPs2LY,3255
19
19
  arcade_core/version.py,sha256=CpXi3jGlx23RvRyU7iytOMZrnspdWw4yofS8lpP1AJU,18
20
20
  arcade_core/converters/__init__.py,sha256=ckb7c0LCq62_bARxoV7XlRYF7vtGbG1SJnDTWZ9Z7P4,827
@@ -29,6 +29,6 @@ arcade_core/usage/constants.py,sha256=1FQIhkFFMZUhU-H4A7GvMb7KQ3qLFrNAZb2-LEvSF3
29
29
  arcade_core/usage/identity.py,sha256=h_THm-cN3j8nqW7_Lew7OdBRA70valCKJ7zvhDvja_E,8416
30
30
  arcade_core/usage/usage_service.py,sha256=xzWWSEktm58liiNYugBHRactSru8V5foriHcsoH0j1A,3407
31
31
  arcade_core/usage/utils.py,sha256=FqBOmlhwT68cbnpI5Vx9ZW6vLRYPVg4FJ0GaMEp8qEM,398
32
- arcade_core-4.2.1.dist-info/METADATA,sha256=5lFJ1C5vqqBXHLC51RdiGvHFsddE-JbG69wt8MFydlM,2447
33
- arcade_core-4.2.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
34
- arcade_core-4.2.1.dist-info/RECORD,,
32
+ arcade_core-4.2.3.dist-info/METADATA,sha256=FpU3nIosa-NhNT0CkixMXWw4r2dBTzvMdNF2Af4ns9Q,2484
33
+ arcade_core-4.2.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
34
+ arcade_core-4.2.3.dist-info/RECORD,,