-
Notifications
You must be signed in to change notification settings - Fork 340
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
Validate tljh specific config #962
Validate tljh specific config #962
Conversation
Looks like I've got most tests passing now. |
Excellent work @jrdnbradford! How should this behave if existing TLJH installations upgrade to get this validation? They could have invalid config already in place, and then making an unrelated config change may trigger a validation failure. I'm not confident on what I think makes sense to do here. If we could, I'd like to error loudly and early on before we have actually upgraded anything. I'm not sure we can do that while making use of this validation logic inside the tljh python package, as then we have already upgraded to use it I figure. At the same time, maybe not. The config could have been manually edited anyhow, and we should assume someone may have done that also... |
One option to trial this is to have a flag to turn validation warnings into errors or vice versa (e.g. |
@minrk is the suggestion something like this:
Those with invalid configs who update TLJH will start to get warnings when they use We could also do something like: parser.add_argument("--validate", action = argparse.BooleanOptionalAction) which should handle I'm open to whatever you all think is best and will edit and test after feedback, |
I also think it's just fine to validate by default if that's what others would prefer. I wouldn't call this breaking, because the validation error message should include a message showing how to re-run without validation, along the lines of:
|
I agree on the idea to validate by default, so having a flag to opt out of the validation is my preference. Flag naming decision, here are some ideas:
I'm leaning for the most verbose flags of either @minrk @jrdnbradford what do you think? |
I like the verb forms, and I think it's best to stick the very standard |
Got an initial working version using I also bumped the |
@consideRatio and @minrk if the failed Python 3.8 test is a blocker, I can rewrite to make it compatible. Let me know! |
Yes, that would be great if you can make it work on 3.8. Thank you! |
@consideRatio and @minrk the Python 3.8 test is now passing after removing Let me know if I can do anything else here. 🚀 |
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 it could be nice to default functions to validate=True, but its a refactoring detail really.
I'm looking into the remaining test failure - which shows up in the main branch as well, so i think we can merge this anyhow.
Co-authored-by: Erik Sundell <[email protected]>
Co-authored-by: Erik Sundell <[email protected]>
Co-authored-by: Erik Sundell <[email protected]>
Co-authored-by: Erik Sundell <[email protected]>
@jrdnbradford a trick to combine multiple code suggestions is to visit "files changed", from there you can "add suggestion to batch" and add multiple code suggestions in one go. I'm actively debugging the remaining test failures now btw |
Ah, good tip, sorry for the spam. 😃 |
Refactoring done. Good to merge when you're ready. Thanks, everyone! |
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.
THANK YOU @jrdnbradford!!!
I find robustifying contributions like these critical for the health of a open source projects - thank you ❤️ 🎉 🌻!!
This is a stab at the
FIXME
intljh/config.py
for addingconfig.yaml
validation. It usesjsonschema
to validate the changes against it.This is a work in progress; I've tried to use the tljh-config docs and
configurer.py
to fill it out the best I can.Example of some current validation:
Certainly not perfect, looking for input before I go any further! 🚀 Also trying to get these tests to pass.