website/docs/index.mdx
{/*
import CodeSnippet from '@site/src/sandbox/CodeSnippet'
Pyrefly is a fast type checker and language server for Python with powerful IDE features. It analyzes your Python code to help you catch type-related errors before your code runs, making your applications more reliable and easier to maintain. Pyrefly supports both IDE integration and CLI usage, giving you flexibility in how you incorporate type checking into your workflow.
Adding type annotations to your Python code and using a type checker like Pyrefly provides several important benefits:
Here's a simple example showing how Pyrefly can catch type errors:
<CodeSnippet sampleFilename="getting_started.py" codeSample={`# Example: Basic Type Checking
def greet(name: str) -> str: return "Hello, " + name
message = greet("World")
error_message = greet(42) `} />
In this example, Pyrefly flags the second call to greet() because we're passing an integer (42) where a string is expected, helping you catch this issue before your code runs. To learn more about Python typing and how to use it effectively: