This adds `pyproject.toml`, needed to configure defaults for autopep8.
The file is auto-discovered in a similar way to `.clang-format`,
other tools could be configured here too. For now just configure autopep8
so this can be enabled in IDE's without causing unexpected edits such as wrapping
lines over 80 columns in width.
Now autopep8 can be used from the root directory by running: `autopep8 .`
This uses multiple-jobs to run autopep8 over all Python scripts except paths that are explicitly ignored in `exclude` defined by `pyproject.toml`.
---
NOTE: we could also add this in the root directory, I don't have a strong opinion about this as we don't have so many scripts in other directories and it clutters the root directory with a non-hidden file for a fairly spesific tool. This project is also intended to be used as a kind of project-meta-data file for Python projects which is not our intended use case, so I prefer not to make it so prominent. See: https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/
For some context Jon Denning posted in `#blender-coders`:
> C/C++ code should use clang format, but what about python? use PEP8? use none? I touched the space_view3d.py in a few spots, but PEP8 wants to reformat almost every line!
It was a while since I last looked into configuring autopep8, it used to always re-arrange imports in a way that broke our detection for module reloading and there wasn't a good way to configure it. Since then both issues are resolved, so committing this file makes it simpler to run autopep8 in a similar way to how clang-format can be used on Blender's C/C++ code.
----
Further work:
- Investigate removing some fixes from the `ignore` list, this needs to be done carefully as some of these could potentially break existing code / unintentional functional changes.
- Investigate making this part of `make format`
For this to be done it might be best to include autopep8 with Blender so people aren't using different versions of the formatting tool.
- Investigate improving autopep8's exclude checks, currently they're quite weak. `autopep8 .` works, but `autopep8 $PWD` doesn't because the resulting paths being matches against no longer have a `./` prefix, this seems like something the autopep8 tool would need to resolve - making paths relative to the `pyproject.toml` before checking if they should be excluded.
- Investigate running this on MS-Windows (check paths are properly excluded for example).
- Document using autopep8 on the wiki (similar to our docs for clang-format)