-
Notifications
You must be signed in to change notification settings - Fork 18
Implemented automated Type and Value Checking #842
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
Conversation
* Vendor "checkvalue.py" from OpenMC and add license * The OpenMC codebase is released under the MIT license. This commit includes a module from OpenMC to add value checking capabilities to MontePy. The LICENSE is updated accordingly. * Update CHANGELOG * Don't require sphinx docs checkvalue for now * Rename checkvalue -> _check_value * Update LICENSE * Copy license VERBATIM and add serial commas to MontePy's license * Update LICENSE to reflect checkvalue's 2014 date
|
Docs changes: |
|
This does almost double the benchmark time. So I'm thinking of pushing this to next next minor release where we will have jit parsing overcoming this overhead. |
|
Ok @tjlaboss, could you review this one finally, lower priority since this won't ship until MontePy 1.3 |
|
Heavy PR, but mostly boilerplate. Everything seems to be working as expected. |
|
Also I haven't mastered the art of clicking a button yet. |
Yeah.... sorry. |
|
Thanks for the review. |
Pull Request Checklist for MontePy
Description
MontePy does a lot of type and value checking, which consists of a lot of conditional raising of
TypeErrorandValueErroras noted in #674. Thanks @kordusas for bugging us to actually do this. This fixes this by using decorator magic to automatically run these tests at call time every time with minimal code per new function.This has been a large effort to:
check_value.pyfrom OpenMCcheck_value.pyto:@args_checkeddecoratortyping.Annotatedfor value checkingmontepy.typesfor common types@args_checkedandmontepy.typesFixes #674, fixes #91, fixes #393?
General Checklist
blackversion 25.LLM Disclosure
Were any large language models (LLM or "AI") used in to generate any of this code?
Documentation Checklist
First-Time Contributor Checklist
pyproject.tomlif you wish to do so.Additional Notes for Reviewers
Ensure that:
📚 Documentation preview 📚: https://montepy--842.org.readthedocs.build/en/842/