Skip to content

Suggestions regarding CLI usability & compatibility with uvx #639

@Lucas-C

Description

@Lucas-C

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 camelot is a bit long but necesseray because camelot-py is the name of the Pypi package, and camelot the name of the CLI script defined in pyproject.toml. Maybe we could introduce a script alias, named camelot-py, that also invokes camelot.__main__:main? This way end users could simply invoke it like this: uvx camelot-py ...

  • would you be opened to make the --format optional, and deduce it from the --output extension?

  • it's a bit counter intuitive to provide an --output option 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 even camelot --format json --output $out_file $pdf_file (with hybrid becoming 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 uvx usage in camelot documentation? I'm not a big user of uvx but I find it quite handy to quickly test out a Python CLI tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions