Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Type annotations for
nacl.exceptions
(pyca#694)
Following on from pyca#693, I've pulled out the changes in pyca#692 which relate to `nacl.exceptions` (and applied a suggestion of @Dreamsorcerer in the process). I picked this module because it was a leaf: it doesn't import any other things from `nacl`. The code changes are small; instead, I think we'll have more to say about the mypy config changes. I've turned on a bunch of extra checks for `nacl.exceptions` only. I'd hoped that I could enable strict mode on a module-by-module basis, but that doesn't seem to be possible. So instead, I went through the [mypy documentation](https://mypy.readthedocs.io/en/stable/config_file.html) and turned on every check that sounded good for type safety. (At work, I've found disallowing the propagation of Any, and `disallow_untyped_defs` the most useful: they help ensure that mypy is actually able to do type checking in the first place!) If you're happy with this list of checks, my plan would be to take on other modules and add them one-by-one to the "strict" section in `pyproject.toml`. In the long run I'd like to have everything in `pynacl` under this list, at which point we can drop the per-module override and have a single set of package-wide configuration for mypy.
- Loading branch information