Closed rusmux closed 1 month ago
Thank you for reporting!
This is not a bug. Pydantic classes behave like dataclasses, which means, they don't behave like subclasses and don't accept class_path
to select a derived class. This could be considered a duplicate of #287, since the fix will be the same: a new feature that allows developers to select which classes and which not behave as subclasses.
Running the reproduction code, I do see a bug. The parsing is not failing with an error saying class_path
and init_args
are unexpected. Which is why the failure is on instantiation making it misleading.
Closing this in favor of #287.
🐛 Bug report
CLI
fails to instantiatepydantic
classes.To reproduce
In
main.py
:In
config.yaml
:In terminal:
Expected behavior
Program should exit with zero code.
It does work If I change
pydantic
classes to normal classes.Environment
pip install jsonargparse[all]
):pip install jsonargparse[all]