sergiocorreia / panflute

An Pythonic alternative to John MacFarlane's pandocfilters, with extra helper functions
http://scorreia.com/software/panflute/
BSD 3-Clause "New" or "Revised" License
500 stars 59 forks source link

Removal of click dependency #234

Open lewer opened 1 year ago

lewer commented 1 year ago

Hi,

The click library is used in panflute, but only here: https://github.com/sergiocorreia/panflute/blob/dd8b03a3f5b1eca13faf54289dae3e50d5323ca0/panflute/autofilter.py#L166-L177

This can be easily replaced with standard lib's argparse, and then click could be removed. It would be one less dependency.

Do you agree with a PR proposing this?

sergiocorreia commented 1 year ago

I've gotten used to click in other packages (easier than argparse) so I have a slight preference for relying on it.

That said, is there something that makes you prefer a click-less approach?

lewer commented 1 year ago

I have nothing against click and use it also in some projects. If you have a complex CLI with for instance subcommands and don't want the hassle of doing it with argparse, why not using click.

But here there's only a single command, with a few options. It would easily translate to argparse syntax, and would achieve the same behavior. The benefit is that you reduce the external dependencies of panflute; users who install panflute (like me :-)) don't have to install click also, click can be removed from the CI, etc. It's not a huge improvement, but if it doesn't cost anything...

mfhepp commented 1 year ago

In the light of supply-chain attacks on Python dependencies, simplifying the dependency graph is generally a good thing. But as for Click, I tend to see the benefits outweigh the costs. CLI interfaces with Click (or Typer, which is an even nicer wrapper around Click) are so much more readable than argparse stuff.

And a panflute-based project will have additional dependencies in a requirements.txt or environment.yaml anyway.

So I would argue for a readable and maintainable CLI implementation and hence for keeping the dependency. But no strong opinion either.