-
Notifications
You must be signed in to change notification settings - Fork 520
Description
Context
I'm considering adding a new extract-tables subcommand to pdfly: py-pdf/pdfly#185
I just realized that camelot already has a CLI script: https://camelot-py.readthedocs.io/en/master/user/cli.html
I tried to use it with uvx, and this currently works 👍 :
cd camelot/tests/files/
uvx --from camelot-py camelot --format markdown --output agstat.md hybrid agstat.pdf
# produces: agstat-page-1-table-1.md
Feedback
camelot is awesome, I'm just trying to provide some constructive feedback, and I would be happy to submit a PR to improve it if you agree with some of the following observations:
-
uvx --from camelot-py camelotis a bit long but necesseray becausecamelot-pyis the name of the Pypi package, andcamelotthe name of the CLI script defined in pyproject.toml. Maybe we could introduce a script alias, namedcamelot-py, that also invokescamelot.__main__:main? This way end users could simply invoke it like this:uvx camelot-py ... -
would you be opened to make the
--formatoptional, and deduce it from the--outputextension? -
it's a bit counter intuitive to provide an
--outputoption but have a file produced that is not exactly named like specified, du to the-page-{p}-table-{t}prefix. I totally understand the need to produce several files, it's just the command option name that makes things slightly unintuitive. Maybe we could just improve the option documentation to mention that it's actually a file name TEMPLATE? -
arguments parsing is relatively strict, end-users must not mix options command to all subcommands and arguments specific to the given:
camelot [COMMON-OPTIONS] COMMAND [CMD-ARGS]Would you be open to allowing usage like this:camelot hybrid --format json --output $out_file $pdf_file, or evencamelot --format json --output $out_file $pdf_file(withhybridbecoming the default flavor)? I think it would make the CLI a bit more user-friendly, while allowing full backward compatibility. -
would you be open to mention
uvxusage incamelotdocumentation? I'm not a big user ofuvxbut I find it quite handy to quickly test out a Python CLI tool.