python-tooling
python-tooling copied to clipboard
Jupyter notebook formatting
Wonder whether we could make them better in git using this https://github.com/nbQA-dev/nbQA in pre-commit
I don't think we currently have any notebooks in the template? Or do you mean we should add this to the docs as a recommended tool?
I meant in the pre-commit
of the template as our users might have notebooks.
Me and @krishnakumarg1984 (and @matt-graham ) have exactly this. We're supporting some researchers who are using Jupiter notebooks and we probably want to lint them without imposing too much of a workflow change.
Some webpage recommendations (even if not included in the package template) would be appreciated.
We can probably repurpose this ticket for documenting what we learn. And/or add to the template pre-commit config as a final task, if we want that?
Some claims found whilst browsing:
-
black[jupyter]
works -
ruff
works, and integrates well with... - nbQA which also works as a pre-commit tool.
@paddyroddy do you still want this in the template? Or is documenting it enough?
I would have thought pre-commit
hooks? Worst case is adding a minor delay if not using them
I think ruff
does jupyter notebook formatting now, at least I've seen it happening in other repos.
Yep, ruff does support formatting jupyter notebooks - https://docs.astral.sh/ruff/configuration/#jupyter-notebook-discovery
I keep forgetting: did we say we were just going to have the notebooks page? Or do we want the template to actually provide a will_your_project_use_notebooks
variable?