Open ocefpaf opened 3 years ago
Thanks for all the helpful feedback, sorry we haven't gotten around to spending more quality time with this project.
There's probably a lot of things that would end up wanting to be customized for this to be a real tool, but ideally not part of this repo, per se (e.g. formatters, etc. for other languages).
Probably the right thing for us to do is get a bit less opinionated and have a config file that let a project specify
As to the actual location of the config file:
jupyter_*_config.json
(we already have jupyter_core
lying around, i'd wager)As to the format of writing the rules, etc:
jsonpointer
, while a standard, might not be good enoughjsonpath
is kinda... grossjmespath
is goodjsonschema
somehow... e.g. you write another schema for your team's notebooks that further constrained how they work (i don't really know how to do this... not for lack of thinking about it)json-e
is maybe the best fit, but has some pointy edgesThen there'd be the actual commands. We'd want to special-case python
so we can run some things in-loop, but generally expect to run sane shell commands.
Also, hadn't reviewed the landscape in a while, but there's mdformat which would be a lower-barrier entry for a python-native (myst|gfm) markdown formatter, which is probably good enough and would be much faster than spinning up prettier
for each cell (takes a truly horrendous amount of time)... prettier
would just become another cmd
, and it's up to you to get your $PATH
and $HOME
in order.
With proper caching, this could even become a run-time tool, as any/all of:
pre_save
hookMan, that mdformat stable is deep... grayskull might need a workout on this.
mdformat looks quite promising!
When mixing Python and R notebooks in the same repository it can be cumbersome to add them to an exclude list. It would be nice if the pre-commit would only run on notebooks that have a Python kernel.
The problem will persists with notebooks that use other languages magics but that skipping those is too much to ask :smile: