diff --git a/.github/templates/formula.rb.template b/.github/templates/formula.rb.template index 44383c3..6474711 100644 --- a/.github/templates/formula.rb.template +++ b/.github/templates/formula.rb.template @@ -14,19 +14,18 @@ class {{CLASS_NAME}} < Formula license "MIT" depends_on "python@3.13" + depends_on "uv" => :build def install - # Create venv with pip included (not --without-pip) - python3 = "python3.13" - system python3, "-m", "venv", libexec - - # Install the package and all dependencies - system libexec/"bin/pip", "install", "--upgrade", "pip", "setuptools", "wheel" + # Point uv's venv at Homebrew's libexec directory and use a local cache + ENV["UV_PROJECT_ENVIRONMENT"] = libexec.to_s + ENV["UV_CACHE_DIR"] = (buildpath/".uv_cache").to_s # Set version for setuptools-scm since archive tarballs lack .git metadata # Skip for HEAD builds — they use git clone, so setuptools-scm reads tags directly ENV["SETUPTOOLS_SCM_PRETEND_VERSION"] = version.to_s unless build.head? - system libexec/"bin/pip", "install", buildpath.to_s - + # Install project + locked dependencies from uv.lock (no resolver runs) + system "uv", "sync", "--frozen", "--no-dev", "--no-editable", "--python", "python3.13" + # Create wrapper scripts in bin that use the venv bin.install_symlink Dir[libexec/"bin/{{NAME}}"] end