pytest-sphinx
pytest-sphinx copied to clipboard
Write union types as X | Y (PEP 604)
Friendlier typing syntax seems to be a carrot for deprecating old python releases.
In my tmuxp project, I still support python 3.7, so have to use Union, Optional, etc.
In my libvcs project, it's python 3.9+, I can use str | None instead of Optional[None] and int | str instead of Union[int, str]. It's so much cleaner.
At work we are also using python3.7 and thx to the __future__ import we can use e.g. the PEP604 type annotations, but I was not aware that this doesn't work at runtime.