Add type annotations to djblets.siteconfig.

Review Request #12702 — Created Oct. 28, 2022 and submitted — Latest diff uploaded

Information

Djblets
release-3.x

Reviewers

djblets.siteconfig, and SiteConfiguration in particular, is central
to much of the Djblets and Review Board codebases. This change
inrtoduces type annotations to most of the module, helping to make sure
call sites are passing in all the right information.

Settings management in SiteConfiguration is all typed now, helping
callers ensure they're handling results correctly.

Mappings between siteconfig and Django settings are typed with
structured TypeDicts, so we can avoid any issues with invalid keys or
values in those sometimes-complex mappings.

This was fairly smooth, though it did uncover a couple code paths where
assumptions were incorrectly made. Unbound varibable issues were fixed
in the management commands

All unit tests pass for all supported versions of Python.

Mypy and pyright were largely happy. There's some work in related modules
that still need to be done.

Commits

Files