-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Format code with black #316
Conversation
Pull Request Test Coverage Report for Build 820926823
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow this is pretty ugly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.ini
for addingtox -eblack
and makingflake8
agree withblack
pyproject.toml
for addingblack
settingsCONTRIBUTING.md
with instructions to runblack
for new contributors.github/workflows/main.yml
for checkingblack
codestyle in CI