MouseLand / cellpose

a generalist algorithm for cellular segmentation with human-in-the-loop capabilities
https://www.cellpose.org/
BSD 3-Clause "New" or "Revised" License
1.24k stars 359 forks source link

Code quality standards #943

Open JoshuaSchlucke opened 1 month ago

JoshuaSchlucke commented 1 month ago

When trying to extend the code I noticed that the code doesn't conform to PEP 8 or PEP 257 and generally the internal code documentation is few and far between, it makes the code very hard to understand.

Would it be possible to introduce linters like flake8 or pylint with especially flake8-docstrings so that at least the functions are documented and the code is more easily understood. It could be added as github workflow and checked on PR the --diff option would probably be needed.

Alternatively tools like darker would be nice since it automates the whole formatting as I guess the codebase is not reformatted with Black as it ruins git blame (not always) but alas it would be nice if the code could be easier to extend and understand.

carsen-stringer commented 1 month ago

We are using yapf, although it is not currently auto-running, which makes the code readable for those familiar with python.

We have docstrings for many of the functions and methods in the algorithm, and there are several videos and tutorials for using cellpose in addition to the paper (see our readme) -- is there a specific part of the algorithm that you're having trouble running?