Run isort and pycln over entire repo - upgrade pre-commit config#2002
Run isort and pycln over entire repo - upgrade pre-commit config#2002outofculture merged 6 commits intopyqtgraph:masterfrom
Conversation
d984671 to
c1e7fa6
Compare
|
I thought CodeQL would ignore the unused import if I had a |
|
On further reflection of this, I think removing whitespaces as part of this PR will likely cause merge conflicts w/ the remaining PRs so we probably want not want to include that as part of this PR. |
|
We could consider taking the examples out of the CodeQL coverage (at least for now) When I've gone on my "rampage through codeQL identified problems" I've largely ignored the examples anyway, personally. Thats just a matter of adding an "ignore" path to the action. You can also ignore CodeQL problems via the web ui, that should cause them to not come back unless the lines are touched, I think. |
...that's actually a really good idea. |
fe9121e to
a71b685
Compare
a71b685 to
aef0086
Compare
|
@outofculture I updated this PR so that isort/pycln and such run w/o issue, removed the encoding bit, updated pre-commit (and even added The only thing I haven't done is change the Qt namespace bits, which of course take us back to how do we want to deal with the modules that changed their parent namespaces. If memory serves, @pijyoi made an argument a while back about minimizing the modifications we made to the parent modules (as they could impact user code outside of pyqtgraph). |
|
It's okay to do things like QtWidgets.QAction = QtGui.QAction because we have a fake QtWidgets and QtGui. Not okay would be QMouseEvent.position = QMouseEvent.pos as that would be visible to other libraries |
Thanks for the clarification 👍🏻 |
There are places throughout the library that the order of imports for PyOpenGL and other OpenGL related modules is important. In all cases, PyOpenGL should be imported first. This change moves it to the top of the file, and adds the # noqa comment so that isort does not rearrange the ordering causing unintentional breakages.
This commit has the fixes for a variety of pre-commit hooks
1. end-of-file-fixer
2. fix-encoding-pragma --remove
3. mixed-line-ending --fix=lf
In addition, the following hooks were added
- id: check-merge-conflict
- id: check-toml
- id: debug-statements
- id: check-ast
Instead of importing from __init__.py specifying the file to import from results in imports remaining robust after isort shuffles the order of the imports
Change the order of results, with the isort config being in the pyproject.toml file that is also added. Furthermore, a pre-commit hook for isort has been added
aef0086 to
2461626
Compare
|
Alright folks, merging this is going to cause some merge conflicts, sorry about that...shortly after merging this we'll merge #1915 ...which is also likely to cause some merge conflicts. |

This PR makes some changes such that isort and pycln can be run over the entire repository safely, and also incorporates the entire repository as well.
Some things to note, import order is important with respect to pyopengl, that needs to be imported first, so on any file that uses that as an import, I have the following at the very top.
isortknows not to reshuffle the order if I have the# noqacomment and it is before other imports.