moskomule / chika

chika is a simple and easy config tool for hierarchical configurations.
MIT License
20 stars 3 forks source link

Simpler implementation #19

Open moskomule opened 1 year ago

moskomule commented 1 year ago

As child config classes need to be at the top of the parent class, the implementation of add_dataclass_arguments https://github.com/moskomule/chika/blob/e455aab749752054c5868f78cfb8d7708298af2f/chika/chika.py#L54 and parse_args_into_dataclass https://github.com/moskomule/chika/blob/e455aab749752054c5868f78cfb8d7708298af2f/chika/chika.py#L133 can be simpler and easier to maintain.

@chika.config
class ChildConfig:
    ...

@chika.config
class ParentConfig:
    child: ChildConfig # always at the top!
    others: tuple[str, str] = ('hello', 'world')