diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml new file mode 100644 index 00000000..7454ca30 --- /dev/null +++ b/.github/workflows/typecheck.yml @@ -0,0 +1,35 @@ +name: Pyrefly Type Check + +on: + pull_request: + branches: [main] + workflow_dispatch: # Allows manual triggering from the GitHub UI + +jobs: + typecheck: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 + + - name: Install uv + uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4 + with: + enable-cache: true + cache-dependency-glob: | + **/pyproject.toml + **/uv.lock + + - name: Set up Python + uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4 + with: + python-version: '3.11' + + - name: Install package and dependencies + run: | + uv sync --group dev + + - name: Run Pyrefly Type Checker + run: | + make typecheck diff --git a/Makefile b/Makefile index ce40aef6..172595e0 100644 --- a/Makefile +++ b/Makefile @@ -23,9 +23,10 @@ help: @echo " test-e2e Run E2E tests" @echo " test-all Run both unit and E2E tests" @echo "" - @echo "Linting:" + @echo "Linting & Type Checking:" @echo " lint Run ruff linter to check code" @echo " lint-fix Auto-fix linting issues" + @echo " typecheck Run pyrefly type checker" @echo "" @echo "Package Management:" @echo " package-test Build and test package installation" @@ -97,12 +98,18 @@ install-buildx: fi @docker buildx version +.PHONY: check-pyrefly +check-pyrefly: + @echo "Initializing pyrefly..." + uv run pyrefly init + .PHONY: setup setup: check-uv uv venv uv sync --group dev uv run pre-commit install make install-buildx + make check-pyrefly .PHONY: reset reset: @@ -133,6 +140,10 @@ lint: lint-fix: uv run ruff check --fix . +.PHONY: typecheck +typecheck: + uv run pyrefly check --summarize-errors + .PHONY: test-e2e test-e2e: E2E_ENV_FILE=.env ./scripts/run-e2e-tests.sh diff --git a/pyproject.toml b/pyproject.toml index 368275d6..5dc58fb8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,7 +79,8 @@ test = [ dev = [ {include-group = "test"}, "ruff==0.12.0", - "pre-commit>=4.2.0" + "pre-commit>=4.2.0", + "pyrefly>=0.1.0" ] [tool.uv] @@ -88,3 +89,12 @@ package = true [tool.ruff] target-version = "py311" line-length = 120 + +[tool.pyrefly] +project-includes = ["**/*"] +project-excludes = [ + "**/node_modules", + "**/__pycache__", + "**/*venv/**/*", + "tests/**/*", +] diff --git a/uv.lock b/uv.lock index 5bbf1c7c..c99fa87f 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 3 requires-python = ">=3.11" resolution-markers = [ "python_full_version >= '3.13'", @@ -273,6 +273,7 @@ dev = [ { name = "coverage", extra = ["toml"] }, { name = "hypothesis" }, { name = "pre-commit" }, + { name = "pyrefly" }, { name = "pytest" }, { name = "pytest-cov" }, { name = "pytest-mock" }, @@ -328,6 +329,7 @@ dev = [ { name = "coverage", extras = ["toml"], specifier = ">=7.0.0" }, { name = "hypothesis", specifier = ">=6.0.0" }, { name = "pre-commit", specifier = ">=4.2.0" }, + { name = "pyrefly", specifier = ">=0.1.0" }, { name = "pytest", specifier = ">=7.0.0" }, { name = "pytest-cov", specifier = ">=4.0.0" }, { name = "pytest-mock", specifier = ">=3.10.0" }, @@ -1114,6 +1116,22 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/61/ad/689f02752eeec26aed679477e80e632ef1b682313be70793d798c1d5fc8f/PyJWT-2.10.1-py3-none-any.whl", hash = "sha256:dcdd193e30abefd5debf142f9adfcdd2b58004e644f25406ffaebd50bd98dacb", size = 22997, upload-time = "2024-11-28T03:43:27.893Z" }, ] +[[package]] +name = "pyrefly" +version = "0.37.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/4a/da/dcb6f917cc63c79d60f851aef334923ba2f9970ae543f4e8435b63b5a5ef/pyrefly-0.37.0.tar.gz", hash = "sha256:6f0d582e1be9e17bc9c49691d88fda17268426946157170e36790976144a3d5f", size = 1699530, upload-time = "2025-10-13T16:46:26.692Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4e/a5/7e7d8fa4d79efc90c9222dfe90b935327458e8d9ab81d020d4a65fffdf0c/pyrefly-0.37.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:297e92fe0f215ef25afc615de302ecc419e21e517f87153ec0e5be4023318427", size = 6932440, upload-time = "2025-10-13T16:46:11.962Z" }, + { url = "https://files.pythonhosted.org/packages/0f/13/9c5425371b9b67695e2685e604421cf9b797ab7f3e97a11e9152fe9dd7aa/pyrefly-0.37.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:abf48a76b7484c9623354ba54e4aa77400223b706571bc339e67271ceb738830", size = 6459673, upload-time = "2025-10-13T16:46:14.422Z" }, + { url = "https://files.pythonhosted.org/packages/d6/78/87da3f0adb7552e7db4a1053065bb8f8c03ce3b3bbe1367e1f67e97ec882/pyrefly-0.37.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:60d2cef64049356cac77363ab95b393974086f01c04a880b28ae4b08614f5e0a", size = 6699446, upload-time = "2025-10-13T16:46:16.174Z" }, + { url = "https://files.pythonhosted.org/packages/c6/48/70fa5a6d019299bc5a5dc4216013114b21f5ef42aedf06b4780a67ccd3df/pyrefly-0.37.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0da8bf10a4ce60c3282d6e210da26a88cb2f36d4983666663de15a8870bb283b", size = 7562849, upload-time = "2025-10-13T16:46:17.865Z" }, + { url = "https://files.pythonhosted.org/packages/3a/7f/92d426a44ce6f2776a727992dc0ef4dd0f07b3ac47aaf73dfec679f52c68/pyrefly-0.37.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:82be6258d0c3f5fc6103d07a10ccec9ba5428b3282e67b6f7199eb87b93566c1", size = 7210722, upload-time = "2025-10-13T16:46:19.756Z" }, + { url = "https://files.pythonhosted.org/packages/02/5f/a8afc0b8277b7851079a1394e99cac21c5845e94312db26c1190f07f10f5/pyrefly-0.37.0-py3-none-win32.whl", hash = "sha256:79820b05b90fe11442d1d6d9ba3122e0322831ca2bd0001d21c0aea62db13522", size = 6736390, upload-time = "2025-10-13T16:46:21.386Z" }, + { url = "https://files.pythonhosted.org/packages/85/2d/6fae569e4ea88610080fca98748f9a0b8affd80e8a21326c0b62b10e9fc6/pyrefly-0.37.0-py3-none-win_amd64.whl", hash = "sha256:054bf0a55959821cbc07305c9958da491493bd1f699c6db7d8dd33a8040be504", size = 7174438, upload-time = "2025-10-13T16:46:23.064Z" }, + { url = "https://files.pythonhosted.org/packages/f6/2d/e82ec9dc7bb7f78b8400d5c3a3408c619099b6e2b3166660d66174862c1c/pyrefly-0.37.0-py3-none-win_arm64.whl", hash = "sha256:3725a195c159994e0f01d81778b0d47c735f54b55505c73a81bd0d8b69f25441", size = 6756218, upload-time = "2025-10-13T16:46:25.13Z" }, +] + [[package]] name = "pysocks" version = "1.7.1"