Commit ccc1841
fix: resolve relative path sources in
Fixes #8980
## Problem
`marimo edit --sandbox` fails when a script's inline metadata uses
relative `path` sources in `[tool.uv.sources]`. `uv export --script`
returns paths relative to the script file, but those lines get written
to a temp requirements file. When `uv run --with-requirements` processes
that file, it resolves paths relative to CWD - not the script's
directory - causing path resolution failures.
## Fix
In `_uv_export_script_requirements_txt` (`marimo/_cli/sandbox.py`),
convert any relative paths (`.`-prefixed) to absolute paths using the
script's parent directory as the base. Handles both editable (`-e
../../`) and non-editable (`../../`) path sources. Non-path deps and
already-absolute paths are left unchanged.
## Test
Added `test_uv_export_script_requirements_txt_resolves_relative_paths`
covering:
- Editable relative paths (`-e ../../`) → resolved to absolute
- Non-editable relative paths (`../other_pkg`) → resolved to absolute
- Regular deps (`numpy==1.26.0`) → unchanged
- Already-absolute paths → unchanged
---------
Co-authored-by: dmadisetti <dmadisetti@coreweave.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>--sandbox uv export (#9052)1 parent 4c071de commit ccc1841
2 files changed
Lines changed: 56 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
185 | 203 | | |
186 | 204 | | |
187 | 205 | | |
| |||
202 | 220 | | |
203 | 221 | | |
204 | 222 | | |
205 | | - | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
206 | 228 | | |
207 | 229 | | |
208 | 230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
845 | 843 | | |
846 | 844 | | |
847 | 845 | | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
0 commit comments