Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

chore: tidy up package resolution in convert (#11622)

Dylan Madisetti29651da455f2
diff --git a/marimo/_convert/ipynb/to_ir.py b/marimo/_convert/ipynb/to_ir.py
index 11ba7b1ea8..b8ddca0a17 100644
--- a/marimo/_convert/ipynb/to_ir.py
+++ b/marimo/_convert/ipynb/to_ir.py
@@ -786,6 +786,10 @@ def _resolve_pip_packages(packages: list[str]) -> list[str]:
str(req_file),
"--output-file",
str(out_file),
+ # Build not needed for best effort
+ "--no-build",
+ # Ignore uv.toml/pyproject.toml
+ "--no-config",
],
capture_output=True,
text=True,
diff --git a/tests/_convert/ipynb/test_ipynb_to_ir.py b/tests/_convert/ipynb/test_ipynb_to_ir.py
index d9cbf0880b..8e4fccd9c0 100644
--- a/tests/_convert/ipynb/test_ipynb_to_ir.py
+++ b/tests/_convert/ipynb/test_ipynb_to_ir.py
@@ -2,7 +2,9 @@ from __future__ import annotations
import ast
import json
+import shutil
from textwrap import dedent
+from typing import TYPE_CHECKING
import pytest
@@ -22,6 +24,9 @@ from marimo._convert.ipynb.to_ir import (
transform_remove_duplicate_imports,
)
+if TYPE_CHECKING:
+ from pathlib import Path
+
def dd(sources: list[str]) -> list[str]:
return [dedent(s) for s in sources]
@@ -296,6 +301,27 @@ def test_complex_exclamation_mark():
assert result.needs_subprocess is False
[email protected](shutil.which("uv") is None, reason="requires uv")
+def test_exclamation_mark_pip_resolve_does_not_build(tmp_path: Path) -> None:
+ """Resolving `!pip install` doesn't run setup"""
+ pkg_dir = tmp_path / "unexpected"
+ pkg_dir.mkdir()
+ marker = tmp_path / "ran"
+ (pkg_dir / "setup.py").write_text(
+ "from pathlib import Path\n"
+ f"Path({str(marker)!r}).write_text('ran')\n"
+ "from setuptools import setup\n"
+ "setup(name='unexpected', version='0')\n"
+ )
+
+ result = transform_exclamation_mark([f"!pip install {pkg_dir}"])
+
+ assert not marker.exists()
+ # Fallback keeps the spec (normalized); the point is that nothing ran
+ assert len(result.pip_packages) == 1
+ assert result.needs_subprocess is False
+
+
def test_transform_duplicate_definitions():
sources = [
"a = 1",