TYP: use from __future__ import annotations more - batch 1
I'm fairly sure that we agreed we would do this but leave it to just before the 1.3 release to reduce the chance of auto backports failing

after you have changed everything should create a rule to avoid Optional if this is possible. > after you have changed everything should create a rule to avoid Optional if this is possible.

it is still needed when creating aliases although I could move all aliases definitions into if TYPE_CHECKING blocks or into pandas._typing where that makes sense.

A couple of other points that have arisen from this exercise..
we are using Optional/Union alot in docstrings
some imports from pandas._typing instead of typing... could maybe limit what's reexported from pandas._typing. I think is we have a rule that if we import from typing we also use `from __future__ import annotations` and pyupgrade and flake8 should make sure that the typing imports of Union, Optional etc are only used in casts and aliases. > I think is we have a rule that if we import from typing we also use `from __future__ import annotations` and pyupgrade and flake8 should make sure that the typing imports of Union, Optional etc are only used in casts and aliases.

Might be easier to require that every file (except for __init__.py , api.py, tests, setup.py, and probably just a handful of others) contains this import. This could be done with `pygrep` and `--negate`, I'll open an issue for this sounds good can you rebase thisone > after you have changed everything should create a rule to avoid Optional if this is possible.

Sorry for barging in but can someone link me to context for this? My understanding was that the recommendation is to prefer `Optional` over a union with `None`  (but maybe that changed with support for the `|` operator in type hints?) @mwaskom yeah it's just to use the latest `| None` syntax, rather than anything against `Optional` specifically