NASA-Openscapes / earthdata-cloud-cookbook

A tutorial book of workflows for research using NASA EarthData in the Cloud created by the NASA-Openscapes team
https://nasa-openscapes.github.io/earthdata-cloud-cookbook
Other
83 stars 30 forks source link

Apply code formatting for accessibility to Jupyter notebooks (and Quarto code cells?) #338

Open mfisher87 opened 3 weeks ago

mfisher87 commented 3 weeks ago

Code formatting can significantly improve the accessibility of code in addition to enforcing consistency. Reviewing a how-to today on the mentor call I noticed some Python code that I felt could be formatted more accessibly. The Black project is a Python code formatter that puts readability first.

We can use the black-jupyter code formatter, or maybe something else, to do this using CI. I think the formatting can be very accessible using pre-commit.ci, so formatting can be done automatically by posting a comment containing the magic words "pre-commit.ci autofix" to any PR. We can use PR templates to instruct PR authors of this as well.

There's a Quarto extension too, but not sure about how to make the user experience good: https://github.com/shafayetShafee/black-formatter

Thoughts?