homebrew-core/Formula/huggingface-cli.rb

85 lines
4.2 KiB
Ruby

class HuggingfaceCli < Formula
include Language::Python::Virtualenv
desc "Client library for huggingface.co hub"
homepage "https://huggingface.co/docs/huggingface_hub/index"
url "https://files.pythonhosted.org/packages/c4/12/695ea1d874e70c7d7c0407e355e29902c675b4bac7da0ad19542cbbc30c0/huggingface_hub-0.11.0.tar.gz"
sha256 "b48860d791502c2b8a0e6c841214df19c67999198a75d1417512b45752508ac6"
license "Apache-2.0"
bottle do
sha256 cellar: :any_skip_relocation, arm64_ventura: "3c3892ec98203e8cd85982acf4247c3d400bda909db40612a636a0aaf4e86374"
sha256 cellar: :any_skip_relocation, arm64_monterey: "71f8e581ee7ac817e28bfb96b362d57fc34328fbd784d3663287aefce8eb65d9"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "aa73393102f4d8a10c31f889b1dfe87aab12e7468f4d71f50f9b6946ebc0b499"
sha256 cellar: :any_skip_relocation, ventura: "58aa5a7ab1ae0e35f8605d2b7daa3010a1959fb4018bd5957524434475e47b43"
sha256 cellar: :any_skip_relocation, monterey: "ab24a717b2086143f8b4b16871e53c433086679bf715e0f5a8f550892b7c01cc"
sha256 cellar: :any_skip_relocation, big_sur: "0a0c6157852730b65f7192a0be819ceddaa1dbfc0d3de7aa5786deb4543c0974"
sha256 cellar: :any_skip_relocation, catalina: "b3f1db24640361d8bae816b28955852581c5c27c98bef835fd224d0566829092"
sha256 cellar: :any_skip_relocation, x86_64_linux: "fbea8449adb881d3631c54d4199746a7bf1b335ab0f031eff2f1d5461d4a6b9e"
end
depends_on "git-lfs"
depends_on "python-typing-extensions"
depends_on "python@3.11"
depends_on "pyyaml"
resource "certifi" do
url "https://files.pythonhosted.org/packages/cb/a4/7de7cd59e429bd0ee6521ba58a75adaec136d32f91a761b28a11d8088d44/certifi-2022.9.24.tar.gz"
sha256 "0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14"
end
resource "charset-normalizer" do
url "https://files.pythonhosted.org/packages/a1/34/44964211e5410b051e4b8d2869c470ae8a68ae274953b1c7de6d98bbcf94/charset-normalizer-2.1.1.tar.gz"
sha256 "5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845"
end
resource "filelock" do
url "https://files.pythonhosted.org/packages/95/55/b897882bffb8213456363e646bf9e9fa704ffda5a7d140edf935a9e02c7b/filelock-3.8.0.tar.gz"
sha256 "55447caa666f2198c5b6b13a26d2084d26fa5b115c00d065664b2124680c4edc"
end
resource "idna" do
url "https://files.pythonhosted.org/packages/8b/e1/43beb3d38dba6cb420cefa297822eac205a277ab43e5ba5d5c46faf96438/idna-3.4.tar.gz"
sha256 "814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"
end
resource "packaging" do
url "https://files.pythonhosted.org/packages/df/9e/d1a7217f69310c1db8fdf8ab396229f55a699ce34a203691794c5d1cad0c/packaging-21.3.tar.gz"
sha256 "dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"
end
resource "pyparsing" do
url "https://files.pythonhosted.org/packages/71/22/207523d16464c40a0310d2d4d8926daffa00ac1f5b1576170a32db749636/pyparsing-3.0.9.tar.gz"
sha256 "2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"
end
resource "requests" do
url "https://files.pythonhosted.org/packages/a5/61/a867851fd5ab77277495a8709ddda0861b28163c4613b011bc00228cc724/requests-2.28.1.tar.gz"
sha256 "7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983"
end
resource "tqdm" do
url "https://files.pythonhosted.org/packages/c1/c2/d8a40e5363fb01806870e444fc1d066282743292ff32a9da54af51ce36a2/tqdm-4.64.1.tar.gz"
sha256 "5f4f682a004951c1b450bc753c710e9280c5746ce6ffedee253ddbcbf54cf1e4"
end
resource "urllib3" do
url "https://files.pythonhosted.org/packages/b2/56/d87d6d3c4121c0bcec116919350ca05dc3afd2eeb7dc88d07e8083f8ea94/urllib3-1.26.12.tar.gz"
sha256 "3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e"
end
def install
virtualenv_install_with_resources
end
test do
whoami_output = shell_output("#{bin}/huggingface-cli whoami")
assert_match "Not logged in", whoami_output
test_cache = testpath/"cache"
test_cache.mkdir
ENV["HUGGINGFACE_HUB_CACHE"] = test_cache.to_s
scan_output = shell_output("#{bin}/huggingface-cli scan-cache")
assert_match "Done in 0.0s. Scanned 0 repo(s) for a total of \e[1m\e[31m0.0\e[0m.", scan_output
end
end