switch-model / switch

A Modern Platform for Planning High-Renewable Power Systems
http://switch-model.org/
Other
129 stars 85 forks source link

Migrate code style to Black #138

Closed staadecker closed 3 years ago

staadecker commented 3 years ago

Hello there!

Through this pull request, I'm proposing that SWITCH use Black, the most used Python code formatter. Here's a description from the Black documentation.

By using Black, you agree to cede control over minutiae of hand-formatting. In return, Black gives you speed, determinism, and freedom from pycodestyle nagging about formatting. You will save time and mental energy for more important matters.
Black makes code review faster by producing the smallest diffs possible. Blackened code looks the same regardless of the project you’re reading. Formatting becomes transparent after a while and you can focus on the content instead.

Black is managed by the Python Software Foundation, has +20k stars on GitHub and is used by many large projects including the pandas library!

For Switch specifically, it would be great to use Black so that merging changes from downstream forks (e.g. RAEL-Berkley) is easier since formatting would be consistent across both repositories.

This pull request adds black to the dev dependencies and reformats all the Python files according to Black.

mfripp commented 3 years ago

Just wanted to comment since this has been languishing for a while: I support this idea (though I should probably re-train to use double-quotes instead of single quotes). I expect to start rolling out new versions with elements like this over the next couple months.

staadecker commented 3 years ago

@mfripp That sounds great! I'm working with @PatyHidalgo until early August on some research using Switch. We've made quite a few improvements in our fork of Switch and I'd be happy to put in some time to get those changes merged into here. Just let me know once you start working on Switch and we can touch base.