ENH: Switch to TOML and use Pydantic for validation#1432
Conversation
TODO(haozeke): revisit with plugins
|
CI is failing |
|
Is there any update on this? |
This one needs a decision and a cleanup.. summoning @JuroOravec for an opinion and will clean it up soonish. |
|
Hi, sorry for silence, I was moving countries. If anyone's in Prague hit me up! Having a look now. |
| autoapi_add_toc_entry = True | ||
| autoapi_keep_files = True | ||
| autoapi_ignore = ["*_version*", "*migrations*"] | ||
| autoapi_ignore = ["*_version*", "*migrations*", "*schema*"] |
There was a problem hiding this comment.
In my other project we use mkdocs, so I'm not that familiar with sphinx. So this addition is to exclude the asv/schema.py file, right?
| # Using model_dump with mode='json' to ensure proper serialization | ||
| # print(rtoml.dumps(config.model_dump(mode="toml"))) | ||
| # print(json.dumps(config.model_dump(mode="toml"), indent=4)) | ||
| mkconf = ASVConfig.model_validate_json( |
There was a problem hiding this comment.
I think using Pydantic for validation is great!
However I don't understand the purpose of this asv/schema.py file:
- How does it relate to
asv/config.py? Isasv/schema.pysimply for documentation? Wouldn't it make more sense to make the main config classConfig(inasv/config.py) into a Pydantic model, so all the fields and their descriptions live there? - Also, in
asv/config.py, there_get_config_path()which defines the paths for the config. It doesn't yet support.tomlextension. - What is this code here at the end with
mkconfandprint()statements. Is that only for debugging?
| @@ -0,0 +1,66 @@ | |||
| # The version of the config file format. Do not change, unless | |||
| # you know what you are doing. | |||
| version = 1 | |||
There was a problem hiding this comment.
Also how is this asv.conf.toml used? Is it just an example? Or are these values used as defaults? Because now there wll be both asv.conf.toml and asv.conf.json
As it says in the title. Closes #1431. Closes #1430. Depends on #1429.