Hello! Curious if anyone has made a plugin for `./...
# plugins
p
Hello! Curious if anyone has made a plugin for
./pants fmt ::
to run
black
over Jupyter Notebooks. Haven't dipped my toes into plugins just yet but feel this might be a decent starting point.
h
Hi! Not that I'm aware of - it should be pretty easy to copy & paste the current rule to get this working. Ideally we would instead give you a way to hook into the current rule rather than duplicating it, but should work First step would be figuring out how to model this w/ targets. Do you only want to run Black on notebooks? Or other things like Flake8 and MyPy?
p
Thanks! I'm thinking of starting with Black just because I know it is supported. But in theory I'd love to be able to run Flake8 and MyPy over them as well. I suspect those won't be as straightforward or at least not accomplished without additional packages.
👍 1
h
Cool. First step is creating a new target https://www.pantsbuild.org/docs/target-api-concepts I recommend that you have one target per notebook, meaning you use
SingleSourceField
rathher than
MultipleSourcesField
p
😎 Alright, off and running. Thanks
❤️ 1
h
my main question will be how much to integrate into Python ecosystem like whether to subclass
PythonSourceField
. For now, I think keeping this simple and disjoint is a good idea. You can add coupling later - start w/ simplest for now