Change:
The nixpkgs version of fails to build a project created with . Steps to reproduce the behavior: The following expected behavior was seen on Ubuntu 24.04. <!-- Please @ people who are in the list of the offending package or module. If in doubt, check for whoever last touched something. --- system: host os: multi-user?: sandbox: version: channels(root): nixpkgs: Add a :+1: [reaction] to [issues you find important]. [reaction]: [issues you find important]:
No need to create an empty project. Running anywhere gives

Discussion:
{ lib, <del> python3, </del> <ins> python3Packages, </ins> fetchFromGitHub, <del> uv, </del> <ins> replaceVars, </ins> git, cargo, stdenv,

hatch, }: <del> python3.pkgs.buildPythonApplication rec { </del> <ins> python3Packages.buildPythonApplication rec { </ins> pname = "hatch"; version = "1.12.0"; pyproject = true;

hash = "sha256-HW2vDVsFrdFRRaPNuGDg9DZpJd8OuYDIqA3KQRa3m9o="; }; <del> build-system = with python3.pkgs; [ </del> <ins> patches = [ (replaceVars ./paths.patch { uv = lib.getExe python3Packages.uv; }) ]; build-system = with python3Packages; [ </ins> hatchling hatch-vcs <del> uv </del> ]; <del> dependencies = with python3.pkgs; [ </del> <ins> pythonRemoveDeps = [ "uv" ]; dependencies = with python3Packages; [ </ins> click hatchling httpx

]; nativeCheckInputs = <del> with python3.pkgs; </del> <ins> with python3Packages; </ins> [ binary git

<ins> diff --git a/src/hatch/env/virtual.py b/src/hatch/env/virtual.py index 285edb32..90bd94e6 100644 --- a/src/hatch/env/virtual.py +++ b/src/hatch/env/virtual.py @@ -106,26 +106,7 @@ class VirtualEnvironment(EnvironmentInterface): if self.explicit_uv_path: return self.explicit_uv_path -        from hatch.env.internal import is_default_environment - -        env_name = 'hatch-uv' -        if not ( -            # Prevent recursive loop -            self.name == env_name -            # Only if dependencies have been set by the user -            or is_default_environment(env_name, self.app.project.config.internal_envs[env_name]) -        ): -            uv_env = self.app.get_environment(env_name) -            self.app.prepare_environment(uv_env) -            with uv_env: -                return self.platform.modules.shutil.which('uv') - -        import sysconfig - -        scripts_dir = sysconfig.get_path('scripts') -        old_path = os.environ.get('PATH', os.defpath) -        new_path = f'{scripts_dir}{os.pathsep}{old_path}' -        return self.platform.modules.shutil.which('uv', path=new_path) +        return '@uv@' @staticmethod def get_option_types() -> dict: diff --git a/src/hatch/venv/core.py b/src/hatch/venv/core.py index d1303f03..e1e60871 100644 --- a/src/hatch/venv/core.py +++ b/src/hatch/venv/core.py @@ -131,7 +131,7 @@ class TempVirtualEnv(VirtualEnv): class UVVirtualEnv(VirtualEnv): def create(self, python, *, allow_system_packages=False): -        command = [os.environ.get('HATCH_UV', 'uv'), 'venv', str(self.directory), '--python', python] +        command = [os.environ.get('HATCH_UV', '@uv@'), 'venv', str(self.directory), '--python', python] if allow_system_packages: command.append('--system-site-packages') diff --git a/tests/conftest.py b/tests/conftest.py index e8fe663a..6066316d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -203,7 +203,7 @@ def python_on_path(): @pytest.fixture(scope='session', autouse=True) def uv_on_path(): -    return shutil.which('uv') +    return '@uv@' @pytest.fixture(scope='session') </ins>