cucim
cucim copied to clipboard
[FEA] Investigate using black
Previously we tried to use black for formatting Python, but ran into some issues. It would be good to revisit this at some point
cc @grlee77 @quasiben
I think the two issues are:
1.) unless fmt:off
/ fmt:on
blocks are used, it can make some small test matrices formatted in a less readable way.
2.) since upstream scikit-image is not formatted with black, it makes direct comparison with upstream code in diff tools a bit more difficult
Yeah the matrix point makes sense. Disabling formatting on them seems fine
On 2 it might be worth asking scikit-image if they are willing to use black. We started using this a while back in Dask + Distributed as well as RAPIDS, which has helped keep things readable and consistent
On 2 it might be worth asking scikit-image if they are willing to use black.
It did come up in the past in https://github.com/scikit-image/scikit-image/issues/4111 and wasn't received too favorably at the time. Maybe people are more familiar with it by now, though?
I am not too strongly against using it here even if upstream does not. We can always apply black to the scikit-image source prior to doing a diff if we need to compare files directly across the two. For specific files like colorconv.py
where we added custom CUDA kernel code, the diff will already be pretty large in either case.
Thanks for the context. Yeah I think black has also softened on some things, which helps, and more projects have started to use it, which also helps issue discovery & subsequent fixes
That said, if it is going to make it hard to coordinates changes between here and scikit-image. It's probably not worth the effort until scikit-image adopts it