chutes 0.5.4rc0__py3-none-any.whl → 0.5.4rc2__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.
chutes/_version.py CHANGED
@@ -1 +1 @@
1
- version = "0.5.4.rc0"
1
+ version = "0.5.4.rc2"
chutes/cfsv_v3 CHANGED
Binary file
chutes/cfsv_wrapper.py CHANGED
@@ -15,7 +15,7 @@ class CFSVWrapper:
15
15
  self.lib.cfsv_challenge.argtypes = [
16
16
  ctypes.c_char_p, # base_path
17
17
  ctypes.c_char_p, # salt
18
- ctypes.c_int, # sparse
18
+ ctypes.c_int, # sparse
19
19
  ctypes.c_char_p, # index_file
20
20
  ctypes.c_char_p, # exclude_path
21
21
  ctypes.c_char_p, # result_buf
@@ -30,6 +30,13 @@ class CFSVWrapper:
30
30
  ]
31
31
  self.lib.cfsv_sizetest.restype = ctypes.c_int
32
32
 
33
+ # cfsv_cleanup_bytecode(base_path, index_file)
34
+ self.lib.cfsv_cleanup_bytecode.argtypes = [
35
+ ctypes.c_char_p, # base_path
36
+ ctypes.c_char_p, # index_file
37
+ ]
38
+ self.lib.cfsv_cleanup_bytecode.restype = ctypes.c_int
39
+
33
40
  # cfsv_version()
34
41
  self.lib.cfsv_version.argtypes = []
35
42
  self.lib.cfsv_version.restype = ctypes.c_char_p
@@ -70,6 +77,23 @@ class CFSVWrapper:
70
77
  return result_buf.value.decode("utf-8")
71
78
  return None
72
79
 
80
+ def cleanup_bytecode(self, base_path="/", index_file="/etc/chutesfs.index"):
81
+ """
82
+ Remove rogue .pyc and injectable files not present in the verified index.
83
+
84
+ Args:
85
+ base_path: Root path to scan (default: "/")
86
+ index_file: Path to encrypted index file (default: "/etc/chutesfs.index")
87
+
88
+ Returns:
89
+ True on success, False on failure
90
+ """
91
+ ret = self.lib.cfsv_cleanup_bytecode(
92
+ base_path.encode() if isinstance(base_path, str) else base_path,
93
+ index_file.encode() if isinstance(index_file, str) else index_file,
94
+ )
95
+ return ret == 0
96
+
73
97
  def sizetest(self, test_dir, size_gib):
74
98
  """
75
99
  Test filesystem capacity and integrity.
@@ -185,7 +185,6 @@ def build_embedding_chute(
185
185
 
186
186
  pooler_config = {
187
187
  "pooling_type": pooling_type,
188
- "normalize": True,
189
188
  }
190
189
  if enable_chunked_processing:
191
190
  pooler_config["enable_chunked_processing"] = True
@@ -214,6 +213,7 @@ def build_embedding_chute(
214
213
  raise ValueError("You may not override api key!")
215
214
 
216
215
  env = os.environ.copy()
216
+ env["PYTHONDONTWRITEBYTECODE"] = "1"
217
217
  if enable_chunked_processing:
218
218
  env["VLLM_ENABLE_CHUNKED_PROCESSING"] = "true"
219
219
 
@@ -58,9 +58,9 @@ async def prompt_one(
58
58
  headers=headers,
59
59
  ) as resp:
60
60
  if require_status:
61
- assert (
62
- resp.status == require_status
63
- ), f"Expected to receive status code {require_status}, received {resp.status}"
61
+ assert resp.status == require_status, (
62
+ f"Expected to receive status code {require_status}, received {resp.status}"
63
+ )
64
64
  return await resp.json()
65
65
  if resp.status == 200:
66
66
  result = await resp.json()
@@ -330,9 +330,9 @@ def build_sglang_chute(
330
330
  # Set torch inductor, flashinfer, etc., cache directories.
331
331
  set_default_cache_dirs(download_path)
332
332
  os.environ["TRANSFORMERS_OFFLINE"] = "1"
333
- env["HF_HUB_OFFLINE"] = "1"
334
- env["SGL_MODEL_NAME"] = self.name
335
- env["SGL_REVISION"] = revision
333
+ os.environ["HF_HUB_OFFLINE"] = "1"
334
+ os.environ["SGL_MODEL_NAME"] = self.name
335
+ os.environ["SGL_REVISION"] = revision
336
336
 
337
337
  # Reset torch.
338
338
  torch.cuda.empty_cache()
@@ -359,9 +359,9 @@ def build_sglang_chute(
359
359
  parts = command.split()
360
360
  display_cmd = startup_command.replace(api_key, "*" * len(api_key))
361
361
  logger.info(f"Launching SGLang with command: {display_cmd}")
362
- self._sglang_process = subprocess.Popen(
363
- parts, text=True, stderr=subprocess.STDOUT, env=os.environ.copy()
364
- )
362
+ env = os.environ.copy()
363
+ env["PYTHONDONTWRITEBYTECODE"] = "1"
364
+ self._sglang_process = subprocess.Popen(parts, text=True, stderr=subprocess.STDOUT, env=env)
365
365
 
366
366
  server_ready = asyncio.Event()
367
367
  self._monitor_task = asyncio.create_task(
@@ -372,6 +372,7 @@ def build_vllm_chute(
372
372
  raise ValueError("You may not override api key!")
373
373
 
374
374
  env = os.environ.copy()
375
+ env["PYTHONDONTWRITEBYTECODE"] = "1"
375
376
  env["HF_HUB_OFFLINE"] = "1"
376
377
  env["SGL_MODEL_NAME"] = self.name
377
378
  env["SGL_REVISION"] = revision
chutes/chutes-cfsv.so CHANGED
Binary file
chutes/entrypoint/run.py CHANGED
@@ -1108,6 +1108,33 @@ def run_chute(
1108
1108
  logger.error(f"Must be PID 1 (container entrypoint), but got PID {os.getpid()}")
1109
1109
  sys.exit(137)
1110
1110
 
1111
+ # Clean up any bytecode not found in the original image. Probably mainly
1112
+ # irrelevant since we disable precompiled bytecode use anyways, but worth
1113
+ # as a sanity check/safeguard.
1114
+ if not dev:
1115
+ logger.info("Running bytecode cleanup...")
1116
+ try:
1117
+ from chutes.cfsv_wrapper import get_cfsv
1118
+
1119
+ cfsv = get_cfsv()
1120
+ if not cfsv.cleanup_bytecode("/", "/etc/chutesfs.index"):
1121
+ logger.error("Bytecode cleanup failed")
1122
+ sys.exit(137)
1123
+ logger.info("Bytecode cleanup completed")
1124
+ except Exception as e:
1125
+ logger.error(f"Bytecode cleanup error: {e}")
1126
+ sys.exit(137)
1127
+
1128
+ # Prevent the bytecode use from here onwards.
1129
+ sys.dont_write_bytecode = True
1130
+ os.environ["PYTHONDONTWRITEBYTECODE"] = "1"
1131
+
1132
+ # And other sneaky tampering methods.
1133
+ os.environ["PYTHONNOUSERSITE"] = "1"
1134
+ if "PYTHONSTARTUP" in os.environ:
1135
+ logger.warning(f"Clearing PYTHONSTARTUP: {os.environ['PYTHONSTARTUP']}")
1136
+ del os.environ["PYTHONSTARTUP"]
1137
+
1111
1138
  # Generate inspecto hash.
1112
1139
  token = get_launch_token()
1113
1140
  token_data = get_launch_token_data()
@@ -105,7 +105,9 @@ class ADD(BaseDirective):
105
105
  for path in positive_patterns
106
106
  if path not in negative_patterns and os.path.abspath(path).startswith(build_dir)
107
107
  ]
108
- assert self._build_context, f"No (accessible) source paths matched provided pattern '{positive_patterns}' trying to add {source}"
108
+ assert self._build_context, (
109
+ f"No (accessible) source paths matched provided pattern '{positive_patterns}' trying to add {source}"
110
+ )
109
111
 
110
112
  # Destination within the image.
111
113
  arguments.append(dest)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chutes
3
- Version: 0.5.4rc0
3
+ Version: 0.5.4rc2
4
4
  Summary: Chutes development kit and CLI.
5
5
  Home-page: https://github.com/rayonlabs/chutes
6
6
  Author: Jon Durbin
@@ -1,10 +1,10 @@
1
1
  chutes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- chutes/_version.py,sha256=CCgrqe2UcuerFtOjmqBwBZp3sVECC6KtjTAK3ndIhyk,22
2
+ chutes/_version.py,sha256=HcQEphyu2SYjKhiw3ARBOfhdnv8PZsayWyYOH7LGjdc,22
3
3
  chutes/cfsv,sha256=vkR_q3qB0hkD8Knv8rqqrb4A29y1muHW2-eNYZiuI-g,892932
4
4
  chutes/cfsv_v2,sha256=fa8-WFqaNeD-BXcCayUjCvR0NNizcc6Ewd6vNmFjPc0,893296
5
- chutes/cfsv_v3,sha256=aIe3rnM3-g416Ry7eMyDXDOJkLZPxW_EjKJDwh7BMGc,1198496
6
- chutes/cfsv_wrapper.py,sha256=qpzUuGkpt_8JDpUbSKvw06y_uFYYqAZ2LDsLZPGFwjY,4186
7
- chutes/chutes-cfsv.so,sha256=YxF2VhOHfehz0RuoQwxRGNl6xRmw4fNfYYEoHtap6qc,38896
5
+ chutes/cfsv_v3,sha256=abhs7mRAgXnpJzV-LhOlJZ4g1RCjM792sbtyfn3rdvk,1199884
6
+ chutes/cfsv_wrapper.py,sha256=b6EJ6xSJbxHzEvXpJY-0qxJcpc2OSu0NDnOQ3YKfQxg,5094
7
+ chutes/chutes-cfsv.so,sha256=sRG-iKVSIjfydVq3Z2IKcbgoX5vUs9lWpu6LcY3xcSM,47088
8
8
  chutes/chutes-inspecto.so,sha256=ywWZXE5VDUFgnLD2NSAsQJLXSlbWkB5jZFCVEKTZDv4,2309920
9
9
  chutes/chutes-logintercept.so,sha256=3mYyj1_3Vc5g_2MLrEJPqnB5UiFMVkYy8Tw37BlRwDM,22424
10
10
  chutes/chutes-netnanny.so,sha256=1ZQn-Vdd8Lp8CV5dC6p5sz7u1gGrgtX4rDSejY2t2ec,179624
@@ -23,10 +23,10 @@ chutes/chute/job.py,sha256=8t4ODHCLaOod93u2Jh8wn0uP6ZxNM-ccdXbv7H0r_vE,10164
23
23
  chutes/chute/node_selector.py,sha256=QclqaA_-xmhG4utPJLe9nFz0hr6hXy-_fxPjX9BuCsQ,318
24
24
  chutes/chute/template/__init__.py,sha256=At21W3ESSMC7c9uW1XPNeG_8ac90GNIE4glrduO-6_s,70
25
25
  chutes/chute/template/diffusion.py,sha256=UI__t3Oz4U3vp_nL2jVpG8vWP_zjb_rBlPLk8WlLbjY,11089
26
- chutes/chute/template/embedding.py,sha256=wszGXe4Aviu05mzXhI6L9L__BUw5Aa4-JUu9a7eMv8k,9646
27
- chutes/chute/template/helpers.py,sha256=QNvciAuX2-3QQgBQt1C3Z9_liS3ur4jyJ4rNrOjnK4g,6500
28
- chutes/chute/template/sglang.py,sha256=x9OOpGW_PG_OlFT2qCP8fuLZ6GDfSIpmELLJXqZlMP0,14826
29
- chutes/chute/template/vllm.py,sha256=wXb3ngu8MAjwfFxB5K1I66qLz3Lz1hRXZJ3KrHaM27c,16247
26
+ chutes/chute/template/embedding.py,sha256=JnNiED-mz55XkTIgS06KKIXU5K57bmn2EFAicXDXLUI,9660
27
+ chutes/chute/template/helpers.py,sha256=oqDLaPhaL40-3_XSTVFsFquWkc2Ph3lyWYCWOgv1LHo,6500
28
+ chutes/chute/template/sglang.py,sha256=WKgh1vWZigtjqsoGczCRrXZ5ngIzYJCF7izljQOxfGU,14888
29
+ chutes/chute/template/vllm.py,sha256=OsK-YG09pecESe6xg38WkGsgeMK5eC5pujHJfmAkme8,16292
30
30
  chutes/entrypoint/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  chutes/entrypoint/_shared.py,sha256=NiD3fK51TKYK2ZH_bj20VpMeV5E2rMy1o9ak39jgYVE,7056
32
32
  chutes/entrypoint/api_key.py,sha256=hFHEjzjCP7RU8Ec_XTo9GVxJVCvlYM6lQAM4FYlTV7g,4206
@@ -37,7 +37,7 @@ chutes/entrypoint/logger.py,sha256=MGfKmxni_4daAwFWb7JcSBDXTpmBJE8guACz2uYY6fE,9
37
37
  chutes/entrypoint/login.py,sha256=9d_MzS3ZQ884d4NAc8JGwvyNR6SaUazrpseOTAIhWNU,6076
38
38
  chutes/entrypoint/register.py,sha256=jHwZphEZCLpF4BRXT7iaieBZOvmpByCz25UQd804Kp0,9080
39
39
  chutes/entrypoint/report.py,sha256=-AeUFF8DFoaL14C8lAfVqd97aDH7fLDCzxZo-COYINg,1949
40
- chutes/entrypoint/run.py,sha256=yf1_3VHW0Xka8kHB5-dqVY0XoltarniFHfdjYLsRDx8,60611
40
+ chutes/entrypoint/run.py,sha256=ClulYQ2LpUNrGgtkitLM0siUgWpq2bwbqPKtJXRq_W4,61760
41
41
  chutes/entrypoint/secret.py,sha256=_mtBXm_YL-nDg9XWmg2S4gGU_OdNBub_zb6jpLV7458,1581
42
42
  chutes/entrypoint/share.py,sha256=_1yIdIMwK5khxNZ8WApTRXx1htMi_dg1_VV7j1IVUjs,1532
43
43
  chutes/entrypoint/ssh.py,sha256=ryBRL_-bREyYpV_cZAhhZBFyIgvdWsNIIRwnM_sX41g,2285
@@ -49,7 +49,7 @@ chutes/envdump/__init__.py,sha256=DHofdObdvKRYQfP_c04VgV7a6fPfcrl3xY1w7Bj2OOk,40
49
49
  chutes/envdump/envdump.so,sha256=e69MR3LLv0VVWsakVm4F6TtZ-Jedhvo8Tn7QMLyXMds,802920
50
50
  chutes/image/__init__.py,sha256=UEJFNsTp9AwiowXgs07oarDCXx20D6rk7ZzRSYr-BUQ,6340
51
51
  chutes/image/directive/__init__.py,sha256=Cm91_m6T6XR8w9NdV1SIpK87HgKJUKVh87pac2llZy4,682
52
- chutes/image/directive/add.py,sha256=c2iD4ull3rExGQqFzp_nZhtf5aW-QjReOx1w1sIs3r8,4011
52
+ chutes/image/directive/add.py,sha256=AWtBiGqMl841hGBc4cazWARa93fFDFzS2XQXsMR_2vc,4043
53
53
  chutes/image/directive/apt.py,sha256=ijv581wz6Gey3fI7jsKJ-ON1qUFUrN0d38Fp0tAXPHQ,1853
54
54
  chutes/image/directive/base_image.py,sha256=WxBwDVt8fSi4tmSkNuOpkT1x7Nb5rcNTOE2IwulhRf4,635
55
55
  chutes/image/directive/entrypoint.py,sha256=1EaMUZhXh8nezcyDG49HouAzsl5Utij9wEtR4oGMC9I,557
@@ -73,9 +73,9 @@ chutes/util/context.py,sha256=_dHVEM6S6CYwgaxrA0yZCplSDA2HuiyNOmedSsyiDWA,355
73
73
  chutes/util/hf.py,sha256=oEw0Z8pWDd_KUZhefF6iLE_5Ikig2AydrPSd6I1lEBM,14262
74
74
  chutes/util/schema.py,sha256=b0NX-hWhc0FKnWD6FObBmQxINrJDFNocKsbGJn79D-8,6699
75
75
  chutes/util/user.py,sha256=WBx6vyw0P32wJ2GFYMjO5oQJPA3jn_XsyRglNJx0PhY,423
76
- chutes-0.5.4rc0.dist-info/LICENSE,sha256=9qFhoY0O1XdKOczAAc7vcveZzk32-a0Wq2_diH_hAD8,1067
77
- chutes-0.5.4rc0.dist-info/METADATA,sha256=4FT_EC_-nGT76_GoDyOQ6aLWp8axF4lqiWS5_YGLQ74,18789
78
- chutes-0.5.4rc0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
79
- chutes-0.5.4rc0.dist-info/entry_points.txt,sha256=93PU_dKxEGA1hCGaabvRXO9WpyFgon6eqT4wIN91YAU,42
80
- chutes-0.5.4rc0.dist-info/top_level.txt,sha256=oRxU-Kvd5BhaNbBQtqZCp9uzY0FrMBocoL0Q6kokxzA,7
81
- chutes-0.5.4rc0.dist-info/RECORD,,
76
+ chutes-0.5.4rc2.dist-info/LICENSE,sha256=9qFhoY0O1XdKOczAAc7vcveZzk32-a0Wq2_diH_hAD8,1067
77
+ chutes-0.5.4rc2.dist-info/METADATA,sha256=R0Lyje5OddXMYKI8svSbFJtO-O2GMksFOJo5r4aFaw8,18789
78
+ chutes-0.5.4rc2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
79
+ chutes-0.5.4rc2.dist-info/entry_points.txt,sha256=93PU_dKxEGA1hCGaabvRXO9WpyFgon6eqT4wIN91YAU,42
80
+ chutes-0.5.4rc2.dist-info/top_level.txt,sha256=oRxU-Kvd5BhaNbBQtqZCp9uzY0FrMBocoL0Q6kokxzA,7
81
+ chutes-0.5.4rc2.dist-info/RECORD,,