lebrice / SimpleParsing

Simple, Elegant, Typed Argument Parsing with argparse
MIT License
401 stars 50 forks source link

Support Literals and Finals in Dataclasses #86

Closed idoby closed 2 years ago

idoby commented 2 years ago

Addresses issue #2

idoby commented 2 years ago

I added support for lists, tuples and optionals of literals, but supporting anything with a more complicated structure is 1) dubious and 2) will require a refactor to some of functions in the field wrapper to do easily and without bugs.

lebrice commented 2 years ago

Great work to support python 3.9!

Lists (and other containers) of literals should be supported and tested too.

Huuh just for future reference @mixilchenko , I don't quite agree with the second point. Adding Literal and Final is already a nice, simple contribution. Adding lists and tuples of finals seems more like a bonus, somewhat niche use case. Sorry for noticing this a bit late @idoby , feel free to add or not add the containers of Finals as you wish. If not, then we can probably do that in another PR. If things are already working on your end, then fine, this PR can also add them.

lebrice commented 2 years ago

Thanks again @idoby , I added some more suggestions.

lebrice commented 2 years ago

Hey @ivanprado @idoby , just in case this looks a bit overwhelming: I'd be happy to actually implement/fix most of my comments here myself, if you don't have time, but I'd need write access to your fork, so that I can push new commits to your branch.

Let me know if that's something you'd like :)

ivanprado commented 2 years ago

@lebrice I think you have mistaken me for @idoby :stuck_out_tongue:

lebrice commented 2 years ago

Woops you're right, sorry about that!

ivanprado commented 2 years ago

No worries! :smile:

idoby commented 2 years ago

I forgot about this PR. Should I close it?

lebrice commented 2 years ago

I mean, it would be nice to have this in, actually! But probably best to close this and start fresh with my comments in mind.

Up to you @idoby .