asta-code-execution 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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: asta-code-execution
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Add your description here
5
5
  Author: Allen Institute for Artificial Intelligence
6
6
  Requires-Dist: ipython>=9.9.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "asta-code-execution"
3
- version = "0.1.2"
3
+ version = "0.1.4"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import importlib.metadata
5
6
  import json
6
7
  import os
7
8
  import shutil
@@ -148,10 +149,20 @@ class ProcessIPythonBackend:
148
149
  text=True,
149
150
  )
150
151
 
151
- # Install code_execution package (editable) so the sandbox runner works
152
- code_exec_pkg = Path(__file__).resolve().parent.parent.parent # packages/code_execution
152
+ # Install code_execution package so the sandbox runner can import it.
153
+ # In the workspace dev layout, packages/code_execution/pyproject.toml is
154
+ # three levels up from this file; install editable from there. When the
155
+ # parent process is running from a normal site-packages install, that
156
+ # path is the site-packages parent dir (no pyproject.toml), so fall back
157
+ # to installing the published wheel pinned to the loaded version.
158
+ code_exec_pkg = Path(__file__).resolve().parent.parent.parent
159
+ if (code_exec_pkg / "pyproject.toml").is_file():
160
+ install_spec = ["-e", str(code_exec_pkg)]
161
+ else:
162
+ version = importlib.metadata.version("asta-code-execution")
163
+ install_spec = [f"asta-code-execution=={version}"]
153
164
  subprocess.run(
154
- [uv, "pip", "install", "--python", str(python_bin), "-e", str(code_exec_pkg)],
165
+ [uv, "pip", "install", "--python", str(python_bin), *install_spec],
155
166
  check=True,
156
167
  capture_output=True,
157
168
  text=True,