eladrich / pyrallis

Pyrallis is a framework for structured configuration parsing from both cmd and files. Simply define your desired configuration structure as a dataclass and let pyrallis do the rest!
https://eladrich.github.io/pyrallis/
MIT License
198 stars 7 forks source link

Add option alias #16

Open de9uch1 opened 2 years ago

de9uch1 commented 2 years ago

Add option alias setting alias in metadata of dataclass fields.

lebrice commented 2 years ago

https://github.com/lebrice/SimpleParsing/blob/ed8170a32e7765bd98ed42831a428f0cdb645b67/simple_parsing/helpers/fields.py#L38

de9uch1 commented 2 years ago

https://github.com/lebrice/SimpleParsing/blob/ed8170a32e7765bd98ed42831a428f0cdb645b67/simple_parsing/helpers/fields.py#L38

@lebrice Thank you for your comment. I've updated pyrallis.field() to be able to pass aliases like SimpleParsing.

eladrich commented 2 years ago

Thanks @de9uch1 for the pull request!

We did consider supporting aliases in the past but decided that it goes against the design we are aiming for. Pyrallis currently uses a simple one-to-one mapping between the input arguments and the dataclass fields and we want to keep enforcing that.

@lebrice's SimpleParsing is indeed a great choice if you need alias support or other advanced features.

Keeping this pull request open if you want to discuss further 🙃

de9uch1 commented 2 years ago

Thank you for your reply, @eladrich.

OK, I understand. I think it is a great decision for a simple and consistent design.

I'll decide to create pyrallis-plus, the wrapper of Pyrallis that is added some features at the expense of simplicity.

If there is no problem, I would like to close this PR, is that OK?