arcade-core 3.3.0__py3-none-any.whl → 3.3.1__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/catalog.py
CHANGED
|
@@ -283,7 +283,6 @@ class ToolCatalog(BaseModel):
|
|
|
283
283
|
module = import_module(module_name)
|
|
284
284
|
tool_func = getattr(module, tool_name)
|
|
285
285
|
self.add_tool(tool_func, toolkit, module)
|
|
286
|
-
|
|
287
286
|
except ToolDefinitionError as e:
|
|
288
287
|
raise e.with_context(tool_name) from e
|
|
289
288
|
except ToolkitLoadError as e:
|
arcade_core/toolkit.py
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import contextlib
|
|
1
2
|
import importlib.metadata
|
|
2
3
|
import importlib.util
|
|
3
4
|
import logging
|
|
4
5
|
import os
|
|
6
|
+
import sys
|
|
5
7
|
import types
|
|
6
8
|
from collections import defaultdict
|
|
7
9
|
from pathlib import Path, PurePosixPath, PureWindowsPath
|
|
@@ -293,9 +295,27 @@ class Toolkit(BaseModel):
|
|
|
293
295
|
f"Failed to locate Python files in package directory for '{package_name}'."
|
|
294
296
|
) from e
|
|
295
297
|
|
|
298
|
+
# Get the currently executing file (the entrypoint file) so that we can skip it when loading tools.
|
|
299
|
+
# Skipping this file is necessary because tools are discovered via AST parsing, but those tools
|
|
300
|
+
# aren't in the module's namespace yet since the file is still executing.
|
|
301
|
+
current_file = None
|
|
302
|
+
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()
|
|
306
|
+
|
|
296
307
|
tools: dict[str, list[str]] = {}
|
|
297
308
|
|
|
298
309
|
for module_path in modules:
|
|
310
|
+
# Skip adding tools from the currently executing file
|
|
311
|
+
if current_file:
|
|
312
|
+
try:
|
|
313
|
+
module_path_resolved = module_path.resolve()
|
|
314
|
+
if module_path_resolved == current_file:
|
|
315
|
+
continue
|
|
316
|
+
except Exception: # noqa: S110
|
|
317
|
+
pass
|
|
318
|
+
|
|
299
319
|
relative_path = module_path.relative_to(package_dir)
|
|
300
320
|
cls.validate_file(module_path)
|
|
301
321
|
# Build import path and avoid duplicating the package prefix if it already exists
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
arcade_core/__init__.py,sha256=1heu3AROAjpistehPzY2H-2nkj_IjQEh-vVlVOCRF1E,88
|
|
2
2
|
arcade_core/annotations.py,sha256=Nst6aejLWXlpTu7GwzWETu1gQCG1XVAUR_qcFbNvyRc,198
|
|
3
3
|
arcade_core/auth.py,sha256=On9sJPOxvHjKBxgKC1yqp7oijF6KYBsG6fG8KUw-9OY,5882
|
|
4
|
-
arcade_core/catalog.py,sha256=
|
|
4
|
+
arcade_core/catalog.py,sha256=vAXAvdalLq1YymHw46Yq-mUiVb-DTFsup4599E9GUCw,42069
|
|
5
5
|
arcade_core/config.py,sha256=e98XQAkYySGW9T_yrJg54BB8Wuq06GPVHp7xqe2d1vU,572
|
|
6
6
|
arcade_core/config_model.py,sha256=78BR6Ch9BDuG4ddWGfpuEKqWcb1fyOF6kxiF4qLFogM,4481
|
|
7
7
|
arcade_core/constants.py,sha256=wakdklI7TyJ0agq9n-Cmb2lbVa95D0oUaMGm30eiv9Y,375
|
|
@@ -13,7 +13,7 @@ arcade_core/output.py,sha256=CMY1pHlQIR27Beiz2I-Yg1aO-P-pbsEbhBZ1RdYuflc,4040
|
|
|
13
13
|
arcade_core/parse.py,sha256=arKGKL9C6g__tRfZ4re6IM_wAqr1v3LrOzTOBEDLhDc,2366
|
|
14
14
|
arcade_core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
arcade_core/schema.py,sha256=l1eE4__sliPIMOp70YxQMlEIpiYQWlBUWEUvr9K1wxA,16927
|
|
16
|
-
arcade_core/toolkit.py,sha256=
|
|
16
|
+
arcade_core/toolkit.py,sha256=lLlOL6fA6Lmo-dtLTMMcPCzKDf9YQObwxG1LdVADv3E,14431
|
|
17
17
|
arcade_core/utils.py,sha256=_3bM-yfIDFmMVqt-NFYp2Lx1QcNWp7xytGjUQzPs2LY,3255
|
|
18
18
|
arcade_core/version.py,sha256=CpXi3jGlx23RvRyU7iytOMZrnspdWw4yofS8lpP1AJU,18
|
|
19
19
|
arcade_core/converters/openai.py,sha256=4efdgTkvdwT44VGStBhdUmzCnoP5dysceIqPVVPG-vk,7408
|
|
@@ -23,6 +23,6 @@ arcade_core/usage/constants.py,sha256=1FQIhkFFMZUhU-H4A7GvMb7KQ3qLFrNAZb2-LEvSF3
|
|
|
23
23
|
arcade_core/usage/identity.py,sha256=2dP1iusI9pE_GrPlz3VXEdz51R5JlNo9_-OXbe6vn7I,6716
|
|
24
24
|
arcade_core/usage/usage_service.py,sha256=xzWWSEktm58liiNYugBHRactSru8V5foriHcsoH0j1A,3407
|
|
25
25
|
arcade_core/usage/utils.py,sha256=FqBOmlhwT68cbnpI5Vx9ZW6vLRYPVg4FJ0GaMEp8qEM,398
|
|
26
|
-
arcade_core-3.3.
|
|
27
|
-
arcade_core-3.3.
|
|
28
|
-
arcade_core-3.3.
|
|
26
|
+
arcade_core-3.3.1.dist-info/METADATA,sha256=4-Lc2GDL-C3cq4zM2l1bUIoZH7D8HZ-WCWQJn2GC9Mw,2383
|
|
27
|
+
arcade_core-3.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
28
|
+
arcade_core-3.3.1.dist-info/RECORD,,
|
|
File without changes
|