Skip to content

[2.11.0] 2025-08-16

Choose a tag to compare

@david-yz-liu david-yz-liu released this 16 Aug 15:27

✨ Enhancements

  • Support x in and x not in preconditions involving set(), list(), and tuple() function calls in the Z3 parser.
  • Update the output-format configuration option to take reporter aliases rather than the plugin path.
  • Integrated Watchdog to enable automatic re-checking of Python files when changes are detected.
  • Added autoformat-options configuration option to let users specify command-line arguments to the Black formatting tool
  • Update check_all and check_error functions to let users pass in typing.IO objects to the output argument
  • Update the forbidden-io-function-checker to check functions from imported modules as well as methods (according to their qualified name)
  • Update the forbidden-io-function-checker to flag aliases of forbidden functions
  • Update how error messages are overridden such that section headers are no longer required within the config file
  • Added presistent_server which recives the watch property changes through websockets and updates the HTML report
  • Added optional on_verify_fail argument to check_all and check_error, allowing users to raise a ValueError and immediately stop execution when a file cannot be checked.
  • Enhanced CFG generation to support match statements.
  • Added the optional format argument to the AccumulationTable class, allowing users to select between csv or table formatted outputs.
  • Added optional z3_enabled argument (default False) to generate_cfg, allowing users to enable z3 functionalities and providing extra safeguard to prevent z3 (and z3 related) imports from being executed when z3 is not enabled.
  • Added a dark mode toggle with system detection for the html reporter
  • Replaced icons on the html reporter using the heroicons library, adding hover effects
  • Extended infinite-loop check to flag while loops with constant conditions and no exit statements (e.g.: return, break, raise, yield, sys.exit())
  • Added command-line interface for CFG generation, allowing users to run python -m python_ta.cfg <file> with options for auto-open and visitor configuration
  • Updated the color palette for the PythonTA web reporter to improve readability and visual hierarchy.
  • Reduced shadow intensity, refined border opacity, and added subtle hover effects on interactive elements for the PythonTA web reporter to improve user experience.
  • Aligned slider dropdown icons with the title text of errors in the web reporter to improve user experience
  • Updated SnapshotTracer bundled webstepper version to v0.7.0
  • Added a small margin to the topmost error instance card in the web reporter to prevent the top border from being cut off when the hover effect is activated
  • Updated the error type text colors on the dark theme to be more consistent with that on the light theme
  • Changed default MemoryViz version used by snapshot from "latest" to "0.7.0"

💫 New checkers

  • infinite-loop: Provide an error message when a while loop never terminates, indicating an infinite loop.

🐛 Bug fixes

  • Introduced the IDTracker class to track unique IDs in memory model diagrams across multiple snapshots.
  • check_contracts no longer makes methods immediately enforce Representation Invariant checks when setting attributes of instances with the same type (one Node modifies another Node instance) and only checks RIs for these instances after the method returns.
  • Fixed error in contracts where comments in docstring assertions are not removed while parsing
  • Improved error message in patches/transforms.py where CFGVisitor is run
  • Fixed a bug in AccumulationTable where loop variable names weren't being captured for all nested targets.
  • Fixed a bug in the infinite-loop checker where function and method names were incorrectly included in the set of condition variables.
  • Fixed "No Problems Detected" message colour in HTML report
  • Fixed bug in SnapshotTracer output when using MemoryViz v0.7.0

🔧 Internal changes

  • Refactored custom checker tests to group repeated tests using pytest.mark.parametrize.
  • Dynamically loaded only the reporter specified in the configuration
  • Added test case for check_all function ensuring proper behaviour when handling inputs in package notation.
  • Improved get_valid_files_to_check function by removing unreachable code.
  • Refactored test_check.py to use pytest.mark.parametrize annotation, improving test isolation and extracting inputs from test functions
  • Added test case to test_check.py for better coverage of colour_messages_by_type
  • Removed unused imports from python_ta module
  • Wrapped type-only imports in if TYPE_CHECKING guards
  • Refactored render_pep8_errors to use a dict that maps error codes to error functions instead of repeated conditional statements
  • Added two test cases to test_accumulation_table.py to verify that AccumulationTable correctly extracts loop variables from nested tuple structures.
  • Refactored condition_logic_checker.py, cfg_generator.py and graph.py by removing top-level z3 (and z3 related) imports and moving them inside of functions where needed.
  • Wrapped type-only z3 (and z3 related) imports in a TYPE_CHECKING guard in condition_logic_checker.py, graph.py and cfg_generator.py.
  • Added tests to improve coverage in condition_logic_checker.py, graph.py and cfg_generator.py, verifying behaviour in case of failed z3 (and z3 related) import via import patching.
  • Added z3_enabled optional initializer argument (default False) to ControlFlowGraph class in graph.py and CFGVisitor class in visitor.py.
  • Updated transforms.py to ensure the patched version of patch_ast_transforms dynamically reads the z3 option from linter config to reflect correct runtime setting.
  • Simplified combined Z3 preconditions in set_function_def_z3_constraints using z3.simplify
  • Refactored one_shot_server and persistent_server to allow for reuseablity.
  • Removed old unused files
  • Linked the contributions list (README.md) in the pull request template