From ccf51c7494b36a2076758c8af9f8e7431d0a43a5 Mon Sep 17 00:00:00 2001 From: Owen Price Skelly <21372141+OwenPriceSkelly@users.noreply.github.com> Date: Mon, 27 Apr 2026 14:35:46 -0500 Subject: [PATCH] fix: use importlib to get rootstock version spec --- rootstock/commands/install.py | 10 ++++++---- uv.lock | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rootstock/commands/install.py b/rootstock/commands/install.py index e6aa071..8fb055e 100644 --- a/rootstock/commands/install.py +++ b/rootstock/commands/install.py @@ -252,13 +252,15 @@ def _install_single_environment( # Install rootstock print("3. Installing rootstock...") - # Find rootstock package path - import rootstock + # Pin to the running rootstock's version so the env matches the driver, + # without depending on where the driver itself was installed from. + from importlib.metadata import version as _pkg_version - rootstock_path = Path(rootstock.__file__).parent.parent + rootstock_spec = f"rootstock=={_pkg_version('rootstock')}" + print(f" Installing: {rootstock_spec}") result = subprocess.run( - ["uv", "pip", "install", "--python", str(env_python), str(rootstock_path)], + ["uv", "pip", "install", "--python", str(env_python), rootstock_spec], capture_output=not verbose, text=True, env=uv_env, diff --git a/uv.lock b/uv.lock index 91a2b2f..3166d12 100644 --- a/uv.lock +++ b/uv.lock @@ -2312,7 +2312,7 @@ wheels = [ [[package]] name = "rootstock" -version = "0.7.0" +version = "0.7.1" source = { editable = "." } dependencies = [ { name = "ase" },