nutti / fake-bpy-module

Fake Blender Python API module collection for the code completion.
MIT License
1.32k stars 95 forks source link

Switch from YAPF to Ruff format #168

Closed JonathanPlasse closed 7 months ago

JonathanPlasse commented 7 months ago

Purpose of the pull request

Reduce to nearly zero the time to format the generated code.

Description about the pull request

Remove YAPF formatting in the code generation. Format with Ruff the entire generated code at the end.

JonathanPlasse commented 7 months ago

@nutti, I reworked the PR to keep the same behavior as before, only replacing the YAPF by Ruff. The CI now passes.

nutti commented 7 months ago

@JonathanPlasse

Thanks for your effort! Looks good to me about Ruff code.

I have another request about this PR. Is it possible to co-exist with YAPF and Ruff, and switch them from the environment? I will show you the brief example.

$ export GEN_MODULE_CODE_FORMAT: "ruff"
$ bash tools/pip_package/build_pip_package.sh ... 
$ export GEN_MODULE_CODE_FORMAT: "yapf"
$ bash tools/pip_package/build_pip_package.sh ... 

I understand Ruff is the better case, but we want to support YAPF format for a while.

JonathanPlasse commented 7 months ago

@nutti, I added back the possibility to format with YAPF.

nutti commented 7 months ago

@JonathanPlasse

Ruff is so fast! Thank you for your suggestion 👍

JonathanPlasse commented 7 months ago

That is one of the reason why I suggested using it instead of pycodestyle and pylint.