PythonVerifier
- Creates a virtual environment with a specified Python version.
- Installs required packages before executing the provided script.
- Executes the script and compares the output against a ground truth, if supplied.
- Automatically cleans up the virtual environment after execution.
init
- extractor (Optional[BaseExtractor], optional): The extractor to use for extracting code from the solution. (default: :obj:
None
) - timeout (Optional[float], optional): The execution timeout in seconds. (default: :obj:
30.0
) - required_packages (Optional[List[str]], optional): A list of packages to install in the virtual environment. (default: :obj:
None
) - float_tolerance (Optional[float], optional): The tolerance for floating point comparisons. (default: :obj:
None
)
_cleanup_venv
_is_uv_environment
_setup_with_uv
_is_expression
- code (str): The Python code to analyze.
_is_equal_with_tolerance
- a (Any): First value to compare.
- b (Any): Second value to compare.