python-tooling icon indicating copy to clipboard operation
python-tooling copied to clipboard

Jupyter notebook formatting

Open paddyroddy opened this issue 1 year ago • 5 comments

Wonder whether we could make them better in git using this https://github.com/nbQA-dev/nbQA in pre-commit

paddyroddy avatar Jun 05 '23 13:06 paddyroddy

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?

p-j-smith avatar Jul 25 '23 10:07 p-j-smith

I meant in the pre-commit of the template as our users might have notebooks.

paddyroddy avatar Jul 25 '23 16:07 paddyroddy

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:

samcunliffe avatar Aug 17 '23 16:08 samcunliffe

@paddyroddy do you still want this in the template? Or is documenting it enough?

samcunliffe avatar Oct 24 '23 15:10 samcunliffe

I would have thought pre-commit hooks? Worst case is adding a minor delay if not using them

paddyroddy avatar Oct 24 '23 15:10 paddyroddy

I think ruff does jupyter notebook formatting now, at least I've seen it happening in other repos.

dstansby avatar Oct 17 '24 08:10 dstansby

Yep, ruff does support formatting jupyter notebooks - https://docs.astral.sh/ruff/configuration/#jupyter-notebook-discovery

Saransh-cpp avatar Oct 17 '24 08:10 Saransh-cpp

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?

samcunliffe avatar Oct 17 '24 09:10 samcunliffe