Additional code formatting/linting without modernizing Python syntax #1598
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a few more pre-commit hooks that check the code and especially docstrings / docs for various syntax and formatting issues, including:
docstring-convention = google
withinflake8
which enforces a bunch of RST formatting in docstrings that we were missing before (this should clean up our documentation output a bit).rstcheck
linter to the docs build with Tox, in addition to running it in the pre-commit hooks.I also tried to add some python syntax updates using these formatters / pre-commit hooks:
However, it turns out there are some incompatibilities between Pydantic and the use of
The use of
__futures__
is required in order to make new style annotations work with Python 3.8 and 3.9. In general they work great though, and if/when we want to leave behind Python 3.8 and 3.9 we can automatically update all of the code to use the newer versions of type annotations and other syntax changes.This commit touches a ton of files, but almost exclusively changes docstrings, not code, so hopefully it won't create any headaches for merging.
There are a handful of functions which are missing descriptions for their arguments, which results in a
D417
error. I've deactivated these with# noqa: D417
but we should make sure that the arguments get documented.