Skip to content

Conversation

@MicahGale
Copy link
Collaborator

@MicahGale MicahGale commented Oct 28, 2025

Pull Request Checklist for MontePy

Description

MontePy does a lot of type and value checking, which consists of a lot of conditional raising of TypeError and ValueError as 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:

  1. Vendor check_value.py from OpenMC
  2. Update check_value.py to:
    1. add @args_checked decorator
    2. Add support for typing.Annotated for value checking
    3. Add support for recursive type annotations
  3. Introduce montepy.types for common types
  4. Switch almost all type and value checking via @args_checked and montepy.types

Fixes #674, fixes #91, fixes #393?


General Checklist

  • I have performed a self-review of my own code.
  • The code follows the standards outlined in the development documentation.
  • I have formatted my code with black version 25.
  • I have added tests that prove my fix is effective or that my feature works (if applicable).

LLM Disclosure

Were any large language models (LLM or "AI") used in to generate any of this code?

  • Yes
    • Model(s) used: ChatGPT-mini via GH copilot
  • No

Documentation Checklist

  • I have documented all added classes and methods.
  • For infrastructure updates, I have updated the developer's guide.
  • For significant new features, I have added a section to the getting started guide.

First-Time Contributor Checklist

  • If this is your first contribution, add yourself to pyproject.toml if you wish to do so.

Additional Notes for Reviewers

Ensure that:

  • This PR fully addresses and resolves the referenced issue(s).
  • The submitted code is consistent with the merge checklist outlined here.
  • The PR covers all relevant aspects according to the development guidelines.
  • 100% coverage of the patch is achieved, or justification for a variance is given.

📚 Documentation preview 📚: https://montepy--842.org.readthedocs.build/en/842/

tjlaboss and others added 30 commits March 11, 2025 16:10
* 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
@MicahGale MicahGale self-assigned this Oct 28, 2025
@MicahGale MicahGale added code improvement A feature request that will improve the software and its maintainability, but be invisible to users. feature request An issue that improves the user interface. labels Oct 28, 2025
@MicahGale MicahGale marked this pull request as draft October 28, 2025 16:25
@MicahGale MicahGale marked this pull request as ready for review October 31, 2025 03:55
@MicahGale MicahGale requested a review from tjlaboss October 31, 2025 03:55
@MicahGale
Copy link
Collaborator Author

Docs changes:

  1. dev docs
  2. check_value
  3. types

@MicahGale MicahGale mentioned this pull request Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code improvement A feature request that will improve the software and its maintainability, but be invisible to users. feature request An issue that improves the user interface.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Static Typing Testing Implement the use of function annotations

3 participants