# What is PEP 484?


[PEP 484: Type Hints](https://peps.python.org/pep-0484/) is the 2014 proposal that gave Python optional static types. Accepted for Python 3.5, it defines what annotations like `name: str` mean, introduces the `typing` module, and establishes the gradual-typing model that every Python type checker implements.

The PEP was co-authored by Guido van Rossum and Jukka Lehtosalo, who created [mypy](https://pydevtools.com/handbook/reference/mypy.md). Type hints grew out of mypy's annotation syntax, then became a language standard that other tools could build on.

## Separate type checking from runtime behavior {#what-do-type-hints-do-at-runtime-nothing}

Python stores annotations but never enforces them. This program runs without complaint:

```python
def greet(name: str) -> str:
    return f"hello {name}"

greet(42)  # runs fine and returns "hello 42"
```

The annotations only matter to tools that read them: a type checker like mypy, [Pyright](https://pydevtools.com/handbook/reference/pyright.md), or [ty](https://pydevtools.com/handbook/reference/ty.md) flags `greet(42)` as an error without running the code, and editors use the same information for completion and inline documentation.

That separation is the core design decision of PEP 484. The interpreter's behavior never changes; correctness checking happens in a separate tool, at whatever strictness you choose.

## Adopt annotations gradually {#why-does-gradual-matter}

Gradual typing lets annotated and unannotated code coexist. Operations on `Any` escape static type checking, but missing annotations do not make every value `Any`: checkers can infer types from assignments and expressions.

Pyright checks unannotated function bodies by default and infers their return types; mypy skips fully unannotated bodies by default. See [how Python type checkers compare](https://pydevtools.com/handbook/explanation/how-do-mypy-pyright-and-ty-compare.md) for the checking policies.

Add annotations one module, function, or parameter at a time to make intended types explicit. [How to gradually adopt type checking in an existing Python project](https://pydevtools.com/handbook/how-to/how-to-gradually-adopt-type-checking-in-an-existing-python-project.md) walks through that process.

## Use modern annotation syntax {#how-has-the-syntax-evolved}

Use the annotation syntax supported by the project's minimum Python version:

| PEP 484 original | Modern equivalent | Since |
|---|---|---|
| `typing.List[int]` | `list[int]` ([PEP 585](https://peps.python.org/pep-0585/), builtin generics) | 3.9 |
| `Union[int, str]`, `Optional[int]` | `int \| str`, `int \| None` ([PEP 604](https://pydevtools.com/handbook/explanation/what-is-pep-604.md), union operator) | 3.10 |
| `T = TypeVar("T")` plus `Generic[T]` | `class Box[T]:` ([PEP 695](https://pydevtools.com/handbook/explanation/what-is-pep-695.md), type parameter syntax) | 3.12 |
| Quoted forward references | Unquoted, evaluated lazily ([PEP 649](https://pydevtools.com/handbook/explanation/what-is-pep-649.md), deferred annotations) | 3.14 |

The gradual-typing semantics underneath are unchanged. A checker written against PEP 484's model handles all of these spellings.

## Choose a type checker {#which-tools-implement-pep-484}

Four major type checkers implement the PEP 484 model today: mypy (the original), Pyright (which powers VS Code's Pylance), ty, and [Pyrefly](https://pydevtools.com/handbook/reference/pyrefly.md). [How do Python type checkers compare?](https://pydevtools.com/handbook/explanation/how-do-mypy-pyright-and-ty-compare.md) covers choosing between them.

[Ruff](https://pydevtools.com/handbook/reference/ruff.md) is not a type checker ([Does Ruff support type checking?](https://pydevtools.com/handbook/explanation/does-ruff-support-type-checking.md) explains the distinction), but its `UP`-prefixed rules automatically rewrite PEP 484-era syntax to the modern equivalents in the table.

The `typing_extensions` package backports new typing constructs to older Python versions, which is how libraries use features like `ParamSpec` ([PEP 612](https://pydevtools.com/handbook/explanation/what-is-pep-612.md), typed decorators) while still supporting Pythons that predate them.
