SimpleParsing icon indicating copy to clipboard operation
SimpleParsing copied to clipboard

Support Literals and Finals in Dataclasses

Open idoby opened this issue 2 years ago • 9 comments

Addresses issue #2

idoby avatar Sep 29 '21 11:09 idoby

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.

idoby avatar Oct 01 '21 18:10 idoby

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 avatar Oct 02 '21 22:10 lebrice

Thanks again @idoby , I added some more suggestions.

lebrice avatar Oct 02 '21 23:10 lebrice

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 :)

lebrice avatar Oct 14 '21 20:10 lebrice

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

ivanprado avatar Oct 15 '21 08:10 ivanprado

Woops you're right, sorry about that!

lebrice avatar Oct 15 '21 08:10 lebrice

No worries! :smile:

ivanprado avatar Oct 15 '21 08:10 ivanprado

I forgot about this PR. Should I close it?

idoby avatar Apr 09 '22 20:04 idoby

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 .

lebrice avatar Apr 10 '22 00:04 lebrice