Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .github/templates/formula.rb.template
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It is recommended to set UV_CACHE_DIR to a directory within the build sandbox (e.g., buildpath/".uv_cache"). This prevents uv from attempting to write to the default user cache directory, which may be restricted or cause permission issues in sandboxed or CI build environments.

    ENV["UV_PROJECT_ENVIRONMENT"] = libexec.to_s
    ENV["UV_CACHE_DIR"] = (buildpath/".uv_cache").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
Expand Down