benchmax 0.1.2.dev22__tar.gz → 0.1.2.dev23__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 (52) hide show
  1. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/PKG-INFO +1 -1
  2. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/pyproject.toml +1 -1
  3. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/bundle/bundler.py +20 -7
  4. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/bundle/payload.py +1 -0
  5. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/bundle/validator.py +20 -6
  6. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax.egg-info/PKG-INFO +1 -1
  7. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/LICENSE +0 -0
  8. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/README.md +0 -0
  9. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/setup.cfg +0 -0
  10. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/adapters/__init__.py +0 -0
  11. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/adapters/benchmax_wrapper.py +0 -0
  12. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/adapters/skyrl/benchmax_data_process.py +0 -0
  13. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/adapters/skyrl/skyrl_adapter.py +0 -0
  14. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/bundle/__init__.py +0 -0
  15. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/bundle/errors.py +0 -0
  16. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/bundle/loader.py +0 -0
  17. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/__init__.py +0 -0
  18. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/base_env.py +0 -0
  19. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/crm/crm_env.py +0 -0
  20. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/crm/workdir/reward_fn.py +0 -0
  21. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/crm/workdir/salesforce_mcp.py +0 -0
  22. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/excel/data_utils.py +0 -0
  23. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/excel/excel_env.py +0 -0
  24. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/excel/workdir/__init__.py +0 -0
  25. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/excel/workdir/excel_code_runner_mcp.py +0 -0
  26. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/excel/workdir/excel_utils.py +0 -0
  27. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/excel/workdir/reward_fn.py +0 -0
  28. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/math/math_env.py +0 -0
  29. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/math/workdir/reward_fn.py +0 -0
  30. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/mcp/__init__.py +0 -0
  31. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/mcp/example_workdir/demo_mcp_server.py +0 -0
  32. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/mcp/example_workdir/reward_fn.py +0 -0
  33. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/mcp/parallel_mcp_env.py +0 -0
  34. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/mcp/provisioners/__init__.py +0 -0
  35. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/mcp/provisioners/base_provisioner.py +0 -0
  36. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/mcp/provisioners/local_provisioner.py +0 -0
  37. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/mcp/provisioners/manual_provisioner.py +0 -0
  38. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/mcp/provisioners/skypilot_provisioner.py +0 -0
  39. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/mcp/provisioners/utils.py +0 -0
  40. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/mcp/proxy_server.py +0 -0
  41. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/mcp/server_pool.py +0 -0
  42. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/mcp/utils.py +0 -0
  43. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/tracking.py +0 -0
  44. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/types.py +0 -0
  45. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/wikipedia/utils.py +0 -0
  46. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/envs/wikipedia/wiki_env.py +0 -0
  47. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/prompts/__init__.py +0 -0
  48. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax/prompts/tools.py +0 -0
  49. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax.egg-info/SOURCES.txt +0 -0
  50. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax.egg-info/dependency_links.txt +0 -0
  51. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax.egg-info/requires.txt +0 -0
  52. {benchmax-0.1.2.dev22 → benchmax-0.1.2.dev23}/src/benchmax.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: benchmax
3
- Version: 0.1.2.dev22
3
+ Version: 0.1.2.dev23
4
4
  Summary: Framework-Agnostic RL Environments for LLM Fine-Tuning
5
5
  Author: cgft.io
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "benchmax"
3
- version = "0.1.2.dev22"
3
+ version = "0.1.2.dev23"
4
4
  description = "Framework-Agnostic RL Environments for LLM Fine-Tuning"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "cgft.io" }]
@@ -70,9 +70,18 @@ def bundle_env(
70
70
  f"{mod.__name__}"
71
71
  )
72
72
 
73
- # --- Serialize the class ---
73
+ # --- Serialize the class AND constructor_args while modules are registered ---
74
+ pickled_constructor_args: bytes | None = None
74
75
  try:
75
76
  pickled_class = cloudpickle.dumps(env_class)
77
+ # Pickle constructor_args now (while local_modules are registered)
78
+ # so non-JSON-serializable objects get pickled by value.
79
+ if constructor_args is not None:
80
+ try:
81
+ import json
82
+ json.dumps(constructor_args)
83
+ except TypeError:
84
+ pickled_constructor_args = cloudpickle.dumps(constructor_args)
76
85
  except Exception as e:
77
86
  raise BundlingError(
78
87
  f"Failed to serialize {env_class.__name__} with cloudpickle: {e}"
@@ -99,8 +108,13 @@ def bundle_env(
99
108
  python_version=python_version,
100
109
  benchmax_version=benchmax_version,
101
110
  constructor_args=constructor_args,
111
+ constructor_args_pickled=pickled_constructor_args is not None,
112
+ )
113
+ payload = BundledEnv(
114
+ pickled_class=pickled_class,
115
+ metadata=metadata,
116
+ pickled_constructor_args=pickled_constructor_args,
102
117
  )
103
- payload = BundledEnv(pickled_class=pickled_class, metadata=metadata)
104
118
 
105
119
  size_kb = len(pickled_class) / 1024
106
120
  logger.info(
@@ -136,12 +150,11 @@ def write_bundle_files(
136
150
  pickle_path.write_bytes(bundle.pickled_class)
137
151
  metadata_path.write_bytes(bundle.metadata.to_json_bytes())
138
152
 
139
- # Write pickled constructor_args alongside the class pickle
140
- # when they contain non-JSON-serializable objects (e.g. SearchClient).
141
- pickled_args = bundle.metadata.pickled_constructor_args_bytes()
142
- if pickled_args is not None:
153
+ # Write pre-pickled constructor_args (pickled during bundling while
154
+ # local_modules were registered, so module code is inline).
155
+ if bundle.pickled_constructor_args is not None:
143
156
  args_path = pickle_path.with_suffix(".args.pkl")
144
- args_path.write_bytes(pickled_args)
157
+ args_path.write_bytes(bundle.pickled_constructor_args)
145
158
  logger.info("[bundling] Wrote pickled constructor_args to %s", args_path)
146
159
 
147
160
 
@@ -75,3 +75,4 @@ class BundledEnv:
75
75
 
76
76
  pickled_class: bytes
77
77
  metadata: BundleMetadata
78
+ pickled_constructor_args: Optional[bytes] = None
@@ -35,7 +35,8 @@ def validate_bundle(
35
35
  if constructor_args is None:
36
36
  constructor_args = bundle.metadata.constructor_args
37
37
  return _run_isolated_validation(
38
- bundle.pickled_class, bundle.metadata, constructor_args
38
+ bundle.pickled_class, bundle.metadata, constructor_args,
39
+ pickled_constructor_args=bundle.pickled_constructor_args,
39
40
  )
40
41
 
41
42
 
@@ -110,6 +111,7 @@ def _run_isolated_validation(
110
111
  pickled_class: bytes,
111
112
  metadata: BundleMetadata,
112
113
  constructor_args: Optional[Dict[str, Any]],
114
+ pickled_constructor_args: Optional[bytes] = None,
113
115
  ) -> List[str]:
114
116
  """Create a temp venv, install deps, unpickle the bundle, and smoke test.
115
117
 
@@ -192,18 +194,30 @@ def _run_isolated_validation(
192
194
  with open(pickle_path, "wb") as f:
193
195
  f.write(pickled_class)
194
196
 
195
- # 5. Write and run smoke test script using cloudpickle directly
196
- constructor_args_json = json.dumps(constructor_args) if constructor_args else "null"
197
+ # 5. Write constructor args as pickle (handles non-JSON-serializable objects)
198
+ args_pickle_path = os.path.join(venv_dir, "constructor_args.pkl")
199
+ if pickled_constructor_args is not None:
200
+ # Use pre-pickled args (pickled during bundling with modules registered)
201
+ with open(args_pickle_path, "wb") as f:
202
+ f.write(pickled_constructor_args)
203
+ elif constructor_args is not None:
204
+ import cloudpickle as _cp
205
+ with open(args_pickle_path, "wb") as f:
206
+ _cp.dump(constructor_args, f)
207
+
208
+ # 6. Write and run smoke test script using cloudpickle directly
197
209
  smoke_script = textwrap.dedent(f"""\
198
- import json
210
+ import os
199
211
  import asyncio
200
212
  import cloudpickle
201
213
 
202
214
  with open({pickle_path!r}, "rb") as f:
203
215
  env_class = cloudpickle.load(f)
204
216
 
205
- constructor_args = json.loads({constructor_args_json!r})
206
- if constructor_args is not None:
217
+ args_path = {args_pickle_path!r}
218
+ if os.path.exists(args_path):
219
+ with open(args_path, "rb") as f:
220
+ constructor_args = cloudpickle.load(f)
207
221
  instance = env_class(**constructor_args)
208
222
  tools = asyncio.run(instance.list_tools())
209
223
  asyncio.run(instance.shutdown())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: benchmax
3
- Version: 0.1.2.dev22
3
+ Version: 0.1.2.dev23
4
4
  Summary: Framework-Agnostic RL Environments for LLM Fine-Tuning
5
5
  Author: cgft.io
6
6
  Classifier: Programming Language :: Python :: 3
File without changes
File without changes
File without changes