jsonargparse icon indicating copy to clipboard operation
jsonargparse copied to clipboard

lazy_instance and dataclasses ?

Open cgebbe opened this issue 11 months ago • 1 comments

🚀 Feature request

Thanks for this awesome library! I would like the following simple example to work:

import jsonargparse
from dataclasses import dataclass

@dataclass
class Bar:
    x: int

bar=jsonargparse.lazy_instance(Bar, x=3)
bar.x

Motivation

I really like lazy_instance: Its much nicer than writing long, nested YAML files, but still translates into a nice config Namespace which can be easily reused. However, currently, dataclasses don't seem to be really supported

cgebbe avatar Dec 08 '24 20:12 cgebbe