Closed szymonk211 closed 1 year ago
Hello there @szymonk211! Thanks for your comment.
That utility function exists, it's simple_parsing.parse
, but it's brand new, and I havent added it to the README or examples just yet.
I'd agree that this probably simplifies things for a lot of new users, but one thing to keep in mind is that one of the biggest selling points for simple_parsing is its backward-compatibility with argparse. My main "target user" is trying to clean up some ugly argparse code, by transitioning one block at a time into a dataclass, and starts to type their codebase.
For that reason, the "complicated" api is still preferred. I don't want people to see this as a complete replacement of argparse per-say. I'll still include an example with the utility function in the readme.
Hope this helps! :)
If they want to clean up some ugly code, than the use of more simple function will only clean up the code more ;) I will close the problem for now anyway if the function is already implemented.
I'll keep this open until I properly show that function in the README.
I thing that the code to parse simple, most basic use case is a little bit too complicated:
Instead i would like something like this:
The only thing I (and probably the most of the users) need is the simple utility function, that takes the class name, and returns the parsed object. This is what almost every user really wants. Other, more advanced features are important too, but they shouldn't obscure the most frequent use cases.
If you decide to add an utility function I would advice to add the simplified example to the front page, so that every new user would see how simple it is. You could than put more complicated examples. My personal experience, when I first saw the library was that the library is great, exactly something I was looking for, but for some reason it is unnecessary complicated.