stores 0.1.2__py3-none-any.whl → 0.1.4__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.
stores/indexes/index.py CHANGED
@@ -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
- venv.create(self.venv, symlinks=True, with_pip=True, upgrade_deps=True)
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
- venv.create(self.venv, symlinks=True, with_pip=True, upgrade_deps=True)
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(tool_id: str, index_folder: os.PathLike, venv: str = VENV_NAME):
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stores
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Repository of Python functions and tools for LLMs
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.10
@@ -0,0 +1,15 @@
1
+ stores/__init__.py,sha256=KYpKkNrMLx6ssVUbxHnn9wFBq5F5KnaFchcimIfDf9g,186
2
+ stores/constants.py,sha256=7WqFmoGCtmUKHA5WHxOJvvK7g-yYu_KGoqnuVFADNao,57
3
+ stores/format.py,sha256=LduYBVDiUDB1J1HDyu9jHrRG1V97pw6C5g76OirpJJY,7792
4
+ stores/parse.py,sha256=HYPNPzQod2vpu1Cln7yQ8aVkZT1Mw2IN0sZ2A1DIaqE,4967
5
+ stores/utils.py,sha256=GPWT6lCoGobwP3PlEOHyJfKyd0dobamjyErcR7lgm7M,242
6
+ stores/indexes/__init__.py,sha256=s-RNqml8uGREQhxwSdDoxcbcxeD8soB9BcL5dBKsQfI,215
7
+ stores/indexes/base_index.py,sha256=K4--_OAFyPNESaisD0JPNRIEffCnjw9nziahDgjdZHU,10708
8
+ stores/indexes/index.py,sha256=C3i5JAwYoKEK7jIJRAgnLrQxjeewtInKcMinep6yvyA,2432
9
+ stores/indexes/local_index.py,sha256=TVk7W8BXF5KEqjEK0LYqq3CtLMfHaF-Tk_5cZ6bjsBU,3189
10
+ stores/indexes/remote_index.py,sha256=CHa9kQVDQlgI8qw3XQXchrE1cjXJk9fNY2j2HWL2gio,3226
11
+ stores/indexes/venv_utils.py,sha256=U69UsHn9APTc615TchW2aZmrBORgbZhuZunv4zQv_hU,12514
12
+ stores-0.1.4.dist-info/METADATA,sha256=Rkj7Ot2ClwUiCfkhejFU7Hs8PvXxTEdBXNQeWtlIrGA,3076
13
+ stores-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ stores-0.1.4.dist-info/licenses/LICENSE,sha256=VTidYE7_Dam0Dwyq095EhhDIqi47g03oVpLAHQgKws0,1066
15
+ stores-0.1.4.dist-info/RECORD,,
@@ -1,15 +0,0 @@
1
- stores/__init__.py,sha256=KYpKkNrMLx6ssVUbxHnn9wFBq5F5KnaFchcimIfDf9g,186
2
- stores/constants.py,sha256=7WqFmoGCtmUKHA5WHxOJvvK7g-yYu_KGoqnuVFADNao,57
3
- stores/format.py,sha256=LduYBVDiUDB1J1HDyu9jHrRG1V97pw6C5g76OirpJJY,7792
4
- stores/parse.py,sha256=HYPNPzQod2vpu1Cln7yQ8aVkZT1Mw2IN0sZ2A1DIaqE,4967
5
- stores/utils.py,sha256=GPWT6lCoGobwP3PlEOHyJfKyd0dobamjyErcR7lgm7M,242
6
- stores/indexes/__init__.py,sha256=s-RNqml8uGREQhxwSdDoxcbcxeD8soB9BcL5dBKsQfI,215
7
- stores/indexes/base_index.py,sha256=K4--_OAFyPNESaisD0JPNRIEffCnjw9nziahDgjdZHU,10708
8
- stores/indexes/index.py,sha256=X8q2Pe6PCmzQ9j0KVvJmqZid1A1RB0jUe-JugcOrl7o,2330
9
- stores/indexes/local_index.py,sha256=NS4AWzeMVZ51YPo0eJ_udbF5aASuksG-88YXLDn41fQ,2880
10
- stores/indexes/remote_index.py,sha256=dp84keyEDyL-cQrmshwHd4QqDGMw0CTSJcQxqZQiULY,2983
11
- stores/indexes/venv_utils.py,sha256=Nakh2L7gMXpP_0_g7pnjQkB1g-P-jUCxpWSxg68JjbQ,12388
12
- stores-0.1.2.dist-info/METADATA,sha256=GDKpmD4EPbitZaIA2BSEu7r-CWBoo9Y7bO-90f79u6k,3076
13
- stores-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
- stores-0.1.2.dist-info/licenses/LICENSE,sha256=VTidYE7_Dam0Dwyq095EhhDIqi47g03oVpLAHQgKws0,1066
15
- stores-0.1.2.dist-info/RECORD,,
File without changes