Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compare to r-argparse #45

Open
Mitmischer opened this issue Mar 21, 2024 · 5 comments
Open

Compare to r-argparse #45

Mitmischer opened this issue Mar 21, 2024 · 5 comments

Comments

@Mitmischer
Copy link

Hello,
I'm opening this issue here, but it might just as well be opened at the r-argparse-repo.

New users might need guidance on when to use r-argparse or r-optparse. It is unclear which package is superior to the other and the use cases are identical. From what I understood, r-argparse uses the python package as a backend, so it directly benefits from developments there, but therefore carries additional dependencies. r-optparse has more downloads but that might be for historical reasons and recommendations.

r-argparse appears to be more powerful (but maybe a bit more hurdlesome), due to its python-argparse backbone. Personally, I need support for multiple arguments (and I found issues #36, #22 discussing this and stating that it's missing), so I decided to go with r-argparse.

Note that this was only a very brief evaluation, but one could go into more detail here. Maybe putting a similar document to mine in both or at least one of the repos' READMEs might help users make the right decision. A feature comparison (maybe as a table) might be helpful, too.

@trevorld
Copy link
Owner

trevorld commented Apr 9, 2024

  • Perhaps add a "Related Software" section of the README with links to the various command-line parsing packages with brief comments. I don't really know all the tradeoffs of some of the other command-line passing packages like docopt written and maintained by others. Note many of the other command-line passing packages aren't at v1.0 (so no promise of stable API) and I'm unsure how high their code coverage is or how actively maintained they are.
  • I personally use optparse when I only need to support a few optional arguments and argparse when I need more advanced features like sub parsers and named positional arguments.
  • In terms of features not available in argparse note optparse supports a "callback" feature which can call user-written functions.
  • I note in details of ?getopt::getopt I did compare getopt with optparse...

@trevorld
Copy link
Owner

Maybe instead of a detailed section in the README of at least three packages that each would need to be maintained maybe there should be a single "splendid" list of R option parsers with some comparisons of features.

An example of a "splendid" list of game-related R packages: https://github.com/matt-dray/splendid-r-games

@Mitmischer
Copy link
Author

All of those suggestions are very reasonable :) I think that having a "splendid" list that is referred to in the respective projects' READMEs would be the best solution. But of course, the choice is up to you - I just wanted to give you a completely new user's perspective on those packages and the initial confusion that comes along with it.

@J-Moravec
Copy link

There is also argparser which is written in pure R with no dependencies.

https://cran.r-project.org/web/packages/argparser/index.html

@trevorld
Copy link
Owner

There is also argparser which is written in pure R with no dependencies.

  • When {optparse} was written there was only {getopt} but now I think there are at least 8 R packages that do command-line parsing
  • This includes {argparser} which like {getopt} and {optparse} are pure R packages with light dependencies but last time I checked it supported fewer features than {argrparse} (which depends on Python), doesn't promise a stable API (assuming it follows semantic versioning), and doesn't show any code coverage statistics but depending on your needs might be a good choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants