Format code with black#316
Conversation
Pull Request Test Coverage Report for Build 820926823
💛 - Coveralls |
mtreinish
left a comment
There was a problem hiding this comment.
Overall this LGTM. Personally I've resisted using black here because I personally really don't like some of it's style choices it makes. But, I think we've already (for quite some time) reached the point where retworkx is no longer solely my domain. With that in mind I think using black to handle the code formatting makes sense since it simplifies the code formatting for contribution in the same way rustfmt does (also the style is a closer match to rustfmt).
I just left a couple of comments inline. Of those comments most are just idle thoughts or questions for the future (mostly around line length) the only required changes are in the tox.ini.
Aside from the inline comments though, you will also need to manually update the lint github actions job. We don't use tox for that job because I wanted to run cargo directly for the well formatted compiler error message and we already build twice, so doing it again for tox seemed unnecessary. I guess you could update the job either to just explicitly run black --check --diff or change the lint jobs to be tox --skip-pkg-install -elint either would work (the later might be better to be more consistent between local and ci, especially with a pinned black version).
| self.assertEqual( | ||
| [ | ||
| ( | ||
| "a", | ||
| [ | ||
| {"numeral": 9}, | ||
| {"numeral": 8}, | ||
| {"numeral": 7}, | ||
| {"numeral": 6}, | ||
| {"numeral": 5}, | ||
| {"numeral": 4}, | ||
| {"numeral": 3}, | ||
| {"numeral": 2}, | ||
| {"numeral": 1}, | ||
| {"numeral": 0}, | ||
| ], | ||
| ) | ||
| ], | ||
| res, | ||
| ) |
There was a problem hiding this comment.
Perhaps the beauty is that we didn't have to format it ourselves!
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
|
I have addressed some comments and:
With regards to line lenght: I agree with the idea of using the same line lenght for It is easier though to set |
Format Python code with black to align code formatting with recent changes to other Qiskit repositories.
This formatting changes a massive amount of test files, so I will highlight the files that actually need to be reviewed:
tox.inifor addingtox -eblackand makingflake8agree withblackpyproject.tomlfor addingblacksettingsCONTRIBUTING.mdwith instructions to runblackfor new contributors.github/workflows/main.ymlfor checkingblackcodestyle in CI