Closed andrea-bistacchi closed 2 weeks ago
I think black it's a good choice, Prettier is also nice but better for js/ts files than for python ones. Here's a quickstart https://black.readthedocs.io/en/stable/getting_started.html
Very good! Please give us some instructions in order to have a standard and be able to apply it consistently. This will also reduce commits related to cosmetic changes in the code.
Actually, I have installed black with conda install black
and then you can run black <directories or file>
to reformat all the code with the black style. I can check more advanced reformatting options
OK, if everybody is fine with this, we can add black
to the environment and conform to this style.
BTW, I guess this could be set as automatic in PyCharms,
Yes! I really like black
.
ok, let's add it to the pzer onvironments and use it!
added it!
Maybe we can use this PyCharm plugin BlackConnect?
yes, I think it's a good option for PyCharm if you want to use black automatically on your computer
I installed black in the conda environment
conda activate pzero
conda install blackd
Then I installed the PyCharm Plugin BlackConnect with File > Plugins > search "black connect" > Install.
Then I edited BlackConnect settings from File > Settings > Tools > BlackConnect as follows:
Now I find BlackConnect under Tools:
But it does not appear to modify files.
Suggestions?
are you inside the main branch? Because I've already pushed the reformatting process with black inside the main branch. I did the same steps as you and it worked.
For me it works also on the AB_GUI_tests branch. I noticed that it took a bit the first time that I tested it. Maybe I suggest to remove the trigger on save since it could be a bit annoying while working on a given file (pycharm saves constantly so you'll have changing code structure while typing).
We must make this a standard in instructions for developers.
This is the standard now, as explained in https://github.com/gecos-lab/PZero/wiki/PZero-code-style-&-formatting.
Hi, as I progress in my review of existing code I find a mix of different styles, indentation, line termination, commenting using # vs """, etc.
I guess we better standardize and automate this. There are PyCharm plug-ins based on black, isort or prettier to do this.
Please propose a standard and we will set our IDE and stick to it. This also reduces cosmetic commits.
Regarding commenting, I would propose to use dockstrings (""" ... """) to explain the purpose of functions and classes (one dockstring for each function/class) and standard comments for all other comments.
Thanks!