class Black < Formula include Language::Python::Virtualenv desc "Python code formatter" homepage "https://black.readthedocs.io/en/stable/" url "https://files.pythonhosted.org/packages/13/88/560b11e521c522440af991d46848a2bde64b5f7202ec14e1f46f9509d328/black-26.1.0.tar.gz" sha256 "d294ac3340eef9c9eb5d29288e96dc719ff269a88e27b396340459dd85da4c58" license "MIT" head "https://github.com/psf/black.git", branch: "main" bottle do sha256 cellar: :any_skip_relocation, arm64_tahoe: "cbd1f8cf8d35ee909a3453ef97027c3b8d99e0ac652ada54b581fd8044709f2b" sha256 cellar: :any_skip_relocation, arm64_sequoia: "4182b03a0e4de5718afc262719a91d559df50e08c4f04a708b4aabdde81aa27b" sha256 cellar: :any_skip_relocation, arm64_sonoma: "3b06bfacf9218f039b00d4b4636d259042129dd9757226365b43cc8cc90f94ac" sha256 cellar: :any_skip_relocation, sonoma: "bfb65f801be6489d37b89a30d3deb0a915495fd34542c7910386464c74a03889" sha256 cellar: :any_skip_relocation, arm64_linux: "ab4ebeee4c361339c321a5fd97be86f76ae30b3f0f3f88b974e8bb4ca43c2752" sha256 cellar: :any_skip_relocation, x86_64_linux: "b4a42c523c52c578661e2e4ceb6cfea5287779c8dd7bae2cf4ea5f70e48e7802" end depends_on "python@3.14" pypi_packages package_name: "black[d]" resource "aiohappyeyeballs" do url "https://files.pythonhosted.org/packages/26/30/f84a107a9c4331c14b2b586036f40965c128aa4fee4dda5d3d51cb14ad54/aiohappyeyeballs-2.6.1.tar.gz" sha256 "c3f9d0113123803ccadfdf3f0faa505bc78e6a72d1cc4806cbd719826e943558" end resource "aiohttp" do url "https://files.pythonhosted.org/packages/50/42/32cf8e7704ceb4481406eb87161349abb46a57fee3f008ba9cb610968646/aiohttp-3.13.3.tar.gz" sha256 "a949eee43d3782f2daae4f4a2819b2cb9b0c5d3b7f7a927067cc84dafdbb9f88" end resource "aiosignal" do url "https://files.pythonhosted.org/packages/61/62/06741b579156360248d1ec624842ad0edf697050bbaf7c3e46394e106ad1/aiosignal-1.4.0.tar.gz" sha256 "f47eecd9468083c2029cc99945502cb7708b082c232f9aca65da147157b251c7" end resource "attrs" do url "https://files.pythonhosted.org/packages/6b/5c/685e6633917e101e5dcb62b9dd76946cbb57c26e133bae9e0cd36033c0a9/attrs-25.4.0.tar.gz" sha256 "16d5969b87f0859ef33a48b35d55ac1be6e42ae49d5e853b597db70c35c57e11" end resource "click" do url "https://files.pythonhosted.org/packages/3d/fa/656b739db8587d7b5dfa22e22ed02566950fbfbcdc20311993483657a5c0/click-8.3.1.tar.gz" sha256 "12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a" end resource "frozenlist" do url "https://files.pythonhosted.org/packages/2d/f5/c831fac6cc817d26fd54c7eaccd04ef7e0288806943f7cc5bbf69f3ac1f0/frozenlist-1.8.0.tar.gz" sha256 "3ede829ed8d842f6cd48fc7081d7a41001a56f1f38603f9d49bf3020d59a31ad" end resource "idna" do url "https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz" sha256 "795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902" end resource "multidict" do url "https://files.pythonhosted.org/packages/80/1e/5492c365f222f907de1039b91f922b93fa4f764c713ee858d235495d8f50/multidict-6.7.0.tar.gz" sha256 "c6e99d9a65ca282e578dfea819cfa9c0a62b2499d8677392e09feaf305e9e6f5" end resource "mypy-extensions" do url "https://files.pythonhosted.org/packages/a2/6e/371856a3fb9d31ca8dac321cda606860fa4548858c0cc45d9d1d4ca2628b/mypy_extensions-1.1.0.tar.gz" sha256 "52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558" end resource "packaging" do url "https://files.pythonhosted.org/packages/a1/d4/1fc4078c65507b51b96ca8f8c3ba19e6a61c8253c72794544580a7b6c24d/packaging-25.0.tar.gz" sha256 "d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f" end resource "pathspec" do url "https://files.pythonhosted.org/packages/4c/b2/bb8e495d5262bfec41ab5cb18f522f1012933347fb5d9e62452d446baca2/pathspec-1.0.3.tar.gz" sha256 "bac5cf97ae2c2876e2d25ebb15078eb04d76e4b98921ee31c6f85ade8b59444d" end resource "platformdirs" do url "https://files.pythonhosted.org/packages/cf/86/0248f086a84f01b37aaec0fa567b397df1a119f73c16f6c7a9aac73ea309/platformdirs-4.5.1.tar.gz" sha256 "61d5cdcc6065745cdd94f0f878977f8de9437be93de97c1c12f853c9c0cdcbda" end resource "propcache" do url "https://files.pythonhosted.org/packages/9e/da/e9fc233cf63743258bff22b3dfa7ea5baef7b5bc324af47a0ad89b8ffc6f/propcache-0.4.1.tar.gz" sha256 "f48107a8c637e80362555f37ecf49abe20370e557cc4ab374f04ec4423c97c3d" end resource "pytokens" do url "https://files.pythonhosted.org/packages/4e/8d/a762be14dae1c3bf280202ba3172020b2b0b4c537f94427435f19c413b72/pytokens-0.3.0.tar.gz" sha256 "2f932b14ed08de5fcf0b391ace2642f858f1394c0857202959000b68ed7a458a" end resource "yarl" do url "https://files.pythonhosted.org/packages/57/63/0c6ebca57330cd313f6102b16dd57ffaf3ec4c83403dcb45dbd15c6f3ea1/yarl-1.22.0.tar.gz" sha256 "bebf8557577d4401ba8bd9ff33906f1376c877aa78d1fe216ad01b4d6745af71" end def install ENV["HATCH_BUILD_HOOK_ENABLE_MYPYC"] = "1" virtualenv_install_with_resources generate_completions_from_executable(bin/"black", shell_parameter_format: :click) end service do run opt_bin/"blackd" keep_alive true require_root true working_dir HOMEBREW_PREFIX log_path var/"log/blackd.log" error_log_path var/"log/blackd.log" end test do assert_match "compiled: yes", shell_output("#{bin}/black --version") ENV["LC_ALL"] = "en_US.UTF-8" (testpath/"black_test.py").write <<~PYTHON print( 'It works!') PYTHON system bin/"black", "black_test.py" assert_equal 'print("It works!")', (testpath/"black_test.py").read.strip port = free_port spawn bin/"blackd", "--bind-host=127.0.0.1", "--bind-port=#{port}" sleep 10 output = shell_output("curl -s -XPOST localhost:#{port} -d \"print('valid')\"").strip assert_match 'print("valid")', output end end