stores 0.1.7.dev5__tar.gz → 0.1.7.dev6__tar.gz

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.
Files changed (56) hide show
  1. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/PKG-INFO +1 -1
  2. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/pyproject.toml +1 -1
  3. stores-0.1.7.dev6/run_sandbox.py +24 -0
  4. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/stores/indexes/venv_utils.py +38 -22
  5. stores-0.1.7.dev5/run_sandbox.py +0 -16
  6. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/.gitignore +0 -0
  7. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/.python-version +0 -0
  8. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/LICENSE +0 -0
  9. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/README.md +0 -0
  10. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/examples/README.md +0 -0
  11. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/examples/quickstarts/anthropic_api.py +0 -0
  12. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/examples/quickstarts/google_gemini_auto_call.py +0 -0
  13. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/examples/quickstarts/google_gemini_manual_call.py +0 -0
  14. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/examples/quickstarts/langchain_w_tool_calling.py +0 -0
  15. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/examples/quickstarts/langgraph_agent.py +0 -0
  16. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/examples/quickstarts/litellm_w_tool_calling.py +0 -0
  17. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/examples/quickstarts/llamaindex_agent.py +0 -0
  18. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/examples/quickstarts/openai_agent.py +0 -0
  19. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/examples/quickstarts/openai_chat_completions.py +0 -0
  20. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/examples/quickstarts/openai_responses.py +0 -0
  21. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/local_generator.py +0 -0
  22. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/run_browser_use.py +0 -0
  23. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/run_remote_tool.py +0 -0
  24. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/stores/__init__.py +0 -0
  25. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/stores/constants.py +0 -0
  26. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/stores/format.py +0 -0
  27. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/stores/indexes/__init__.py +0 -0
  28. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/stores/indexes/base_index.py +0 -0
  29. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/stores/indexes/index.py +0 -0
  30. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/stores/indexes/local_index.py +0 -0
  31. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/stores/indexes/remote_index.py +0 -0
  32. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/stores/parse.py +0 -0
  33. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/stores/utils.py +0 -0
  34. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/README.md +0 -0
  35. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/mock_index/hello/__init__.py +0 -0
  36. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/mock_index/tools.py +0 -0
  37. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/mock_index/tools.toml +0 -0
  38. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/mock_index_custom_class/foo.py +0 -0
  39. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/mock_index_custom_class/tools.toml +0 -0
  40. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/mock_index_function_error/foo.py +0 -0
  41. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/mock_index_function_error/tools.toml +0 -0
  42. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/mock_index_w_deps/mock_index/__init__.py +0 -0
  43. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/mock_index_w_deps/pyproject.toml +0 -0
  44. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/mock_index_w_deps/requirements.txt +0 -0
  45. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/mock_index_w_deps/tools.toml +0 -0
  46. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/test_format/conftest.py +0 -0
  47. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/test_format/test_format.py +0 -0
  48. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/test_indexes/conftest.py +0 -0
  49. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/test_indexes/test_base_index.py +0 -0
  50. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/test_indexes/test_index.py +0 -0
  51. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/test_indexes/test_local_index.py +0 -0
  52. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/test_indexes/test_remote_index.py +0 -0
  53. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/test_indexes/test_venv_utils.py +0 -0
  54. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/test_parse/conftest.py +0 -0
  55. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/tests/test_parse/test_parse.py +0 -0
  56. {stores-0.1.7.dev5 → stores-0.1.7.dev6}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stores
3
- Version: 0.1.7.dev5
3
+ Version: 0.1.7.dev6
4
4
  Summary: Repository of Python functions and tools for LLMs
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.10
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "stores"
3
- version = "0.1.7dev5"
3
+ version = "0.1.7dev6"
4
4
  description = "Repository of Python functions and tools for LLMs"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -0,0 +1,24 @@
1
+ import stores # noqa
2
+
3
+ index = stores.Index(
4
+ ["silanthro/python-sandbox"],
5
+ # env_var={
6
+ # "silanthro/python-sandbox": {
7
+ # "DENO_PATH": "/drive3/Silanthro/tools/python-sandbox/deno"
8
+ # }
9
+ # },
10
+ )
11
+ print(index.tools)
12
+
13
+ # for value in index.stream_execute("sandbox.run_code", {"code": "1+1"}):
14
+ # print(value)
15
+
16
+ print(
17
+ index.execute(
18
+ "sandbox.run_code",
19
+ kwargs={
20
+ "timeout": 5,
21
+ "code": "def is_prime(n):\n if n <= 1:\n return False\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return False\n return True\n\nprimes = []\nnum = 2\nwhile len(primes) < 10:\n if is_prime(num):\n primes.append(num)\n num += 1\n\nsum(primes)",
22
+ },
23
+ )
24
+ )
@@ -5,6 +5,7 @@ import json
5
5
  import logging
6
6
  import os
7
7
  import pickle
8
+ import queue
8
9
  import socket
9
10
  import subprocess
10
11
  import sys
@@ -340,28 +341,43 @@ def parse_tool_signature(
340
341
  elif signature_dict.get("isgeneratorfunction"):
341
342
 
342
343
  def func_handler(*args, **kwargs):
343
- async def collect():
344
- async for value in run_remote_tool(
345
- tool_id=signature_dict["tool_id"],
346
- index_folder=index_folder,
347
- args=args,
348
- kwargs=kwargs,
349
- venv=venv,
350
- env_var=env_var,
351
- stream=True,
352
- ):
353
- yield value
354
-
355
- loop = asyncio.new_event_loop()
356
- asyncio.set_event_loop(loop)
357
- agen = collect()
358
- try:
359
- while True:
360
- yield loop.run_until_complete(agen.__anext__())
361
- except StopAsyncIteration:
362
- pass
363
- finally:
364
- loop.close()
344
+ q = queue.Queue()
345
+ sentinel = object()
346
+
347
+ def run():
348
+ async def runner():
349
+ try:
350
+ async for item in run_remote_tool(
351
+ tool_id=signature_dict["tool_id"],
352
+ index_folder=index_folder,
353
+ args=args,
354
+ kwargs=kwargs,
355
+ venv=venv,
356
+ env_var=env_var,
357
+ stream=True,
358
+ ):
359
+ q.put(item)
360
+ except Exception as e:
361
+ q.put(e)
362
+ finally:
363
+ q.put(sentinel)
364
+
365
+ asyncio.run(runner())
366
+
367
+ t = threading.Thread(target=run)
368
+ t.start()
369
+
370
+ while True:
371
+ item = q.get()
372
+ if item is sentinel:
373
+ break
374
+ elif isinstance(item, Exception):
375
+ raise item
376
+ else:
377
+ yield item
378
+
379
+ t.join()
380
+
365
381
  elif signature_dict.get("iscoroutinefunction"):
366
382
 
367
383
  async def func_handler(*args, **kwargs):
@@ -1,16 +0,0 @@
1
- import stores # noqa
2
-
3
- index = stores.Index(
4
- ["silanthro/python-sandbox"],
5
- # env_var={
6
- # "silanthro/python-sandbox": {
7
- # "DENO_PATH": "/drive3/Silanthro/tools/python-sandbox/deno"
8
- # }
9
- # },
10
- )
11
- print(index.tools)
12
-
13
- # for value in index.stream_execute("sandbox.run_code", {"code": "1+1"}):
14
- # print(value)
15
-
16
- print(index.execute("sandbox.run_code", {"code": "1+1"}))
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes