TYP: update mypy and small pyi fixes from ruff
There is a much newer version of pyright but I haven't yet managed to get it to pass.
> This looks good to me. Will let others approve/merge.

Would still need to decide whether we prefer to disable the ruff/pylint rule or add ignore comments for pyright. Currently, I disabled the rule for ruff but not yet pylint. I would slightly prefer enabling the pylint/ruff rules and adding pyright ignores, if there are not too many ignores needed > I would slightly prefer enabling the pylint/ruff rules and adding pyright ignores, if there are not too many ignores needed

Using the pyright comments now Thanks @twoertwein 