{"id":2711,"library":"pyrefly","title":"Pyrefly","description":"Pyrefly is a fast type checker and language server for Python, developed by Meta and written in Rust. It provides lightning-fast static type checking along with powerful IDE features such as code navigation, semantic highlighting, and code completion. Pyrefly aims to catch type-related errors before runtime, improve code quality, and enhance the developer experience. It is available as a command-line tool and an IDE extension, with new releases typically every Monday and more frequent updates for new features and bug fixes.","status":"active","version":"0.60.2","language":"en","source_language":"en","source_url":"https://github.com/facebook/pyrefly","tags":["type checker","language server","IDE","static analysis","python","linter"],"install":[{"cmd":"pip install pyrefly","lang":"bash","label":"Pip"},{"cmd":"conda install -c conda-forge pyrefly","lang":"bash","label":"Conda"}],"dependencies":[{"reason":"Pyrefly is a type checker for Python code.","package":"Python","optional":false}],"imports":[],"quickstart":{"code":"# 1. Create a new project directory and navigate into it\n# mkdir my_project && cd my_project\n\n# 2. Install Pyrefly (assuming pip is installed and virtual environment is active)\n# pip install pyrefly\n\n# 3. Initialize Pyrefly configuration (creates pyproject.toml or pyrefly.toml)\n# pyrefly init\n\n# 4. Create a sample Python file with a type error (e.g., 'main.py')\n# echo 'def greet(name: str) -> str:\\n    return f\"Hello, {name}\"\\n\\nprint(greet(42))' > main.py\n\n# 5. Run Pyrefly to check for type errors\n# pyrefly check\n\n# Expected output for 'print(greet(42))' should show a type error, e.g.:\n# main.py:3:11: Type mismatch: Expected `str` but got `int`","lang":"bash","description":"This quickstart demonstrates how to install Pyrefly, initialize a project, and run a basic type check on a Python file containing a simple type error. Pyrefly operates as a command-line tool, not typically imported within Python code."},"warnings":[{"fix":"Migrate your `.pre-commit-config.yaml` to use the consolidated `pyrefly-check` hook. Refer to the `pyrefly-pre-commit` GitHub repository for specific migration steps.","message":"The `pyrefly-pre-commit` hook underwent significant changes from version 0.0.1 to 0.42.0. Users migrating from older versions need to update their pre-commit configuration.","severity":"breaking","affected_versions":"<0.42.0 to >=0.42.0"},{"fix":"Use `pyrefly check --suppress-errors` to temporarily silence existing errors, followed by `pyrefly check --remove-unused-ignores` after running your code formatter. Repeat until a clean state is achieved.","message":"When upgrading Pyrefly (or its dependencies), new type errors might appear due to improved analysis or stricter checks. Addressing all at once can be impractical.","severity":"gotcha","affected_versions":"All versions"},{"fix":"This is not an actual error, but an informational message. Proceed to add your Python or Jupyter Notebook files to the project.","message":"The `pyrefly init` command may report a 'No Python files matched patterns' error if run in an empty directory. This is expected behavior and will resolve once Python files are added to the project.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be aware of potential instabilities if relying on Pyrefly's build system integration. Monitor official documentation and GitHub issues for updates and workarounds.","message":"Support for integrating with specific build systems (e.g., Buck2) is currently unstable and may break without prior notice. These issues are generally lower priority than core type-checking functionality.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}