stores 0.1.2__tar.gz → 0.1.4__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.
- {stores-0.1.2 → stores-0.1.4}/PKG-INFO +1 -1
- {stores-0.1.2 → stores-0.1.4}/pyproject.toml +1 -1
- {stores-0.1.2 → stores-0.1.4}/stores/indexes/index.py +2 -0
- {stores-0.1.2 → stores-0.1.4}/stores/indexes/local_index.py +10 -1
- {stores-0.1.2 → stores-0.1.4}/stores/indexes/remote_index.py +8 -1
- {stores-0.1.2 → stores-0.1.4}/stores/indexes/venv_utils.py +9 -1
- {stores-0.1.2 → stores-0.1.4}/tests/test_indexes/test_remote_index.py +9 -0
- {stores-0.1.2 → stores-0.1.4}/uv.lock +1 -1
- {stores-0.1.2 → stores-0.1.4}/.gitignore +0 -0
- {stores-0.1.2 → stores-0.1.4}/.python-version +0 -0
- {stores-0.1.2 → stores-0.1.4}/LICENSE +0 -0
- {stores-0.1.2 → stores-0.1.4}/README.md +0 -0
- {stores-0.1.2 → stores-0.1.4}/examples/README.md +0 -0
- {stores-0.1.2 → stores-0.1.4}/examples/quickstarts/anthropic_api.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/examples/quickstarts/google_gemini_auto_call.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/examples/quickstarts/google_gemini_manual_call.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/examples/quickstarts/langchain_w_tool_calling.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/examples/quickstarts/langgraph_agent.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/examples/quickstarts/litellm_w_tool_calling.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/examples/quickstarts/llamaindex_agent.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/examples/quickstarts/openai_agent.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/examples/quickstarts/openai_chat_completions.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/examples/quickstarts/openai_responses.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/run_complex.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/run_remote_tool.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/stores/__init__.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/stores/constants.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/stores/format.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/stores/indexes/__init__.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/stores/indexes/base_index.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/stores/parse.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/stores/utils.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/README.md +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/mock_index/hello/__init__.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/mock_index/tools.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/mock_index/tools.toml +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/mock_index_custom_class/foo.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/mock_index_custom_class/tools.toml +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/mock_index_function_error/foo.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/mock_index_function_error/tools.toml +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/mock_index_w_deps/mock_index/__init__.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/mock_index_w_deps/pyproject.toml +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/mock_index_w_deps/requirements.txt +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/mock_index_w_deps/tools.toml +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/test_format/conftest.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/test_format/test_format.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/test_indexes/conftest.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/test_indexes/test_base_index.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/test_indexes/test_index.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/test_indexes/test_local_index.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/test_indexes/test_venv_utils.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/test_parse/conftest.py +0 -0
- {stores-0.1.2 → stores-0.1.4}/tests/test_parse/test_parse.py +0 -0
@@ -19,6 +19,7 @@ class Index(BaseIndex):
|
|
19
19
|
env_var: dict[str, dict] | None = None,
|
20
20
|
cache_dir: Optional[os.PathLike] = None,
|
21
21
|
reset_cache=False,
|
22
|
+
sys_executable: str | None = None,
|
22
23
|
):
|
23
24
|
self.env_var = env_var or {}
|
24
25
|
tools = tools or []
|
@@ -44,6 +45,7 @@ class Index(BaseIndex):
|
|
44
45
|
env_var=self.env_var.get(index_name),
|
45
46
|
cache_dir=cache_dir,
|
46
47
|
reset_cache=reset_cache,
|
48
|
+
sys_executable=sys_executable,
|
47
49
|
)
|
48
50
|
except Exception:
|
49
51
|
logger.warning(
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import importlib
|
2
2
|
import logging
|
3
3
|
import os
|
4
|
+
import subprocess
|
4
5
|
import sys
|
5
6
|
import venv
|
6
7
|
from pathlib import Path
|
@@ -25,6 +26,7 @@ class LocalIndex(BaseIndex):
|
|
25
26
|
index_folder: os.PathLike,
|
26
27
|
create_venv: bool = False,
|
27
28
|
env_var: dict | None = None,
|
29
|
+
sys_executable: str | None = None,
|
28
30
|
):
|
29
31
|
self.index_folder = Path(index_folder)
|
30
32
|
self.env_var = env_var or {}
|
@@ -38,7 +40,14 @@ class LocalIndex(BaseIndex):
|
|
38
40
|
# Create venv and install deps
|
39
41
|
self.venv = self.index_folder / VENV_NAME
|
40
42
|
if not self.venv.exists():
|
41
|
-
|
43
|
+
if sys_executable:
|
44
|
+
subprocess.run(
|
45
|
+
[sys_executable, "-m", "venv", str(self.venv)], check=True
|
46
|
+
)
|
47
|
+
else:
|
48
|
+
venv.create(
|
49
|
+
self.venv, symlinks=True, with_pip=True, upgrade_deps=True
|
50
|
+
)
|
42
51
|
install_venv_deps(self.index_folder)
|
43
52
|
# Initialize tools
|
44
53
|
tools = init_venv_tools(self.index_folder, self.env_var)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import json
|
2
2
|
import logging
|
3
3
|
import shutil
|
4
|
+
import subprocess
|
4
5
|
import venv
|
5
6
|
from os import PathLike
|
6
7
|
from pathlib import Path
|
@@ -52,6 +53,7 @@ class RemoteIndex(BaseIndex):
|
|
52
53
|
env_var: dict | None = None,
|
53
54
|
cache_dir: Optional[PathLike] = None,
|
54
55
|
reset_cache=False,
|
56
|
+
sys_executable: str | None = None,
|
55
57
|
):
|
56
58
|
self.index_id = index_id
|
57
59
|
if cache_dir is None:
|
@@ -89,7 +91,12 @@ class RemoteIndex(BaseIndex):
|
|
89
91
|
# Create venv and install deps
|
90
92
|
self.venv = self.index_folder / VENV_NAME
|
91
93
|
if not self.venv.exists():
|
92
|
-
|
94
|
+
if sys_executable:
|
95
|
+
subprocess.run(
|
96
|
+
[sys_executable, "-m", "venv", str(self.venv)], check=True
|
97
|
+
)
|
98
|
+
else:
|
99
|
+
venv.create(self.venv, symlinks=True, with_pip=True, upgrade_deps=True)
|
93
100
|
install_venv_deps(self.index_folder)
|
94
101
|
# Initialize tools
|
95
102
|
tools = init_venv_tools(self.index_folder, self.env_var)
|
@@ -93,6 +93,7 @@ def init_venv_tools(index_folder: os.PathLike, env_var: dict | None = None):
|
|
93
93
|
tool_id=tool_id,
|
94
94
|
index_folder=index_folder,
|
95
95
|
venv=VENV_NAME,
|
96
|
+
env_var=env_var,
|
96
97
|
)
|
97
98
|
tool = parse_tool_signature(
|
98
99
|
signature_dict=tool_sig,
|
@@ -105,9 +106,15 @@ def init_venv_tools(index_folder: os.PathLike, env_var: dict | None = None):
|
|
105
106
|
|
106
107
|
|
107
108
|
# TODO: Sanitize tool_id, args, and kwargs
|
108
|
-
def get_tool_signature(
|
109
|
+
def get_tool_signature(
|
110
|
+
tool_id: str,
|
111
|
+
index_folder: os.PathLike,
|
112
|
+
venv: str = VENV_NAME,
|
113
|
+
env_var: dict | None = None,
|
114
|
+
):
|
109
115
|
module_name = ".".join(tool_id.split(".")[:-1])
|
110
116
|
tool_name = tool_id.split(".")[-1]
|
117
|
+
env_var = env_var or {}
|
111
118
|
|
112
119
|
runner = f"""
|
113
120
|
import pickle, sys, traceback, inspect, enum
|
@@ -197,6 +204,7 @@ except Exception as e:
|
|
197
204
|
[f"{venv}/bin/python", "-c", runner],
|
198
205
|
capture_output=True,
|
199
206
|
cwd=index_folder,
|
207
|
+
env=env_var,
|
200
208
|
)
|
201
209
|
try:
|
202
210
|
response = pickle.loads(result.stdout)
|
@@ -40,3 +40,12 @@ async def test_remote_index():
|
|
40
40
|
)
|
41
41
|
# Clean up index
|
42
42
|
shutil.rmtree(stores.indexes.remote_index.CACHE_DIR / "silanthro/send-gmail:0.2.0")
|
43
|
+
|
44
|
+
|
45
|
+
async def test_remote_index_2():
|
46
|
+
# Check that env_vars are set correctly
|
47
|
+
stores.indexes.RemoteIndex(
|
48
|
+
"silanthro/filesystem:0.2.0",
|
49
|
+
env_var={"ALLOWED_DIR": "./test"},
|
50
|
+
)
|
51
|
+
shutil.rmtree(stores.indexes.remote_index.CACHE_DIR / "silanthro/filesystem:0.2.0")
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|