admin管理员组

文章数量:1279057

I want to use pydantic-settings for the following scenario: I have two options to write CLI parameters to my application, either by providing a json file or a command. E.g.

myapp --config myconfig.json --logger DEBUG

The command line arguments should override the definitions in the json file.

My json file is nested.

Is it possible?

I thought of pre-parsing the args, reading the file with pydantic, and then make it the "default" for the cli, but I couldn't find a way to do it.

本文标签: pythonuse pydantic settings cli to parse partial json from fileStack Overflow