|
| 1 | +class Pyrefly < Formula |
| 2 | + desc "Fast type checker and IDE for Python" |
| 3 | + homepage "https://pyrefly.org/" |
| 4 | + url "https://github.com/facebook/pyrefly/archive/refs/tags/0.26.1.tar.gz" |
| 5 | + sha256 "cb3a894a045ef5a2488db522f87bdedf31d642854bc8898bc1779c760d02edee" |
| 6 | + license "MIT" |
| 7 | + head "https://github.com/facebook/pyrefly.git", branch: "main" |
| 8 | + |
| 9 | + bottle do |
| 10 | + sha256 cellar: :any_skip_relocation, arm64_sequoia: "0eea480a5cd209764c609c1289817bd93322fc4a90bf6ed1f37416d4331f1dba" |
| 11 | + sha256 cellar: :any_skip_relocation, arm64_sonoma: "631b17eb6a049ca5025bf5d536bbc108937a4d8b9f4e1517bbc2d799b1a321ce" |
| 12 | + sha256 cellar: :any_skip_relocation, arm64_ventura: "cfb1a49c5e7b7aaa4b7c485d41cc5318fa9511f123b5426579c1d1ca7b93e99a" |
| 13 | + sha256 cellar: :any_skip_relocation, sonoma: "1b2b7965dd8053150ebdbca809ff39efe877a3f8aee7755f313e1a96f947fd80" |
| 14 | + sha256 cellar: :any_skip_relocation, ventura: "4774d8e2a6192454aba94785f57abbd8028b3373da129432a835f43bce49fe72" |
| 15 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "92bac047a9c209c9cf0346038757cfc2b78bab57e9c80d27b2972b2523cd9617" |
| 16 | + end |
| 17 | + |
| 18 | + depends_on "rust" => :build |
| 19 | + |
| 20 | + def install |
| 21 | + # Currently uses nightly rust features. Allow our stable rust to compile |
| 22 | + # these unstable features to avoid needing a rustup-downloaded nightly. |
| 23 | + # See https://rustc-dev-guide.rust-lang.org/building/bootstrapping/what-bootstrapping-does.html#complications-of-bootstrapping |
| 24 | + # Remove when fixed: https://github.com/facebook/pyrefly/issues/374 |
| 25 | + ENV["RUSTC_BOOTSTRAP"] = "1" |
| 26 | + # Set JEMALLOC configuration for ARM builds |
| 27 | + ENV["JEMALLOC_SYS_WITH_LG_PAGE"] = "16" if Hardware::CPU.arm? |
| 28 | + |
| 29 | + system "cargo", "install", *std_cargo_args(path: "pyrefly") |
| 30 | + end |
| 31 | + |
| 32 | + test do |
| 33 | + (testpath/"test.py").write <<~PYTHON |
| 34 | + def hello(name: str) -> int: |
| 35 | + return f"Hello, {name}!" |
| 36 | + PYTHON |
| 37 | + |
| 38 | + output = shell_output("#{bin}/pyrefly check #{testpath}/test.py 2>&1", 1) |
| 39 | + assert_match "`str` is not assignable to declared return type `int`", output |
| 40 | + end |
| 41 | +end |
0 commit comments