-
Notifications
You must be signed in to change notification settings - Fork 197
ENH: Switch to TOML and use Pydantic for validation #1432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.