Releases: pyta-uoft/pyta
Releases · pyta-uoft/pyta
[2.12.0] 2025-12-08
✨ Enhancements
- Updated
SnapshotTracerto open the generated HTML report in a one-shot server, instead of opening the HTML file directly. - Extended infinite-loop check to flag while loops whose conditions depend only on immutable variables and are not reassigned in the loop body.
- Added custom renderers for the PEP8 error codes: E204, E225, E231
- Added custom renderers for the PEP8 error codes: E271, E274, E502
- Updated the message format for Pycodestyle error messages to be more concise
- Added custom renderer for
line-too-longto improve its error snippet to highlight the overflow segment instead of the entire line. - Improved error message for error C0305
trailing-newlinesand inserted a "DELETE" comment for each trailing newline. - Added a solution to prevent possible large snippets created by the following errors: pylint error C0305, and pycodestyle errors E303, E304
- Added markdown rendering to display code in error messages
- Improved RI checking to raise a warning when a
NameErroris raised and the missing name matches an instance attribute, and is due to an omittedself.in the RI. - Extended
AccumulationTableclass to support multiple loops in sequence within the same context manager - Added a solution to prevent possible large snippets created by the
render_genericfunction - Support Python 3.14
💫 New checkers
Pylint checkers v4.0:
break-in-finally
For more information on these checkers, please see the
Pylint release notes. Note that the above
list only contains the Pylint checkers enabled by default in PythonTA.
Custom checkers:
unnecessary-f-string: Added new checker that checks f-string to see if it only consists of a single bare format expression that can be replaced with the string representation of that expressionsimplifiable-if: Added a new checker that checks if aniforelifbranch only contains a single nestedifstatement with a single branch.
🐛 Bug fixes
- Fixed issue that caused PEP8 errors E301, E302, E303, E304, E305 and E306 to not render properly
🔧 Internal changes
- Added tests for node_printers.py functions rendering the PEP8 error messages: E101, E116, E124, E128, E201, E202
- Added tests for node_printers.py functions rendering the following PEP8 error codes: E221, E251, E261, E272, E273, E302, E305, E306
- Refactored node_printers.py by grouping repeated code in helper functions and grouping identical functions into a single functions to reduce code duplication
- Updated GitHub Actions workflow to Node 24
- Refactored custom renderers to accept
configparameter to stay consistent with the added parameter forrender-message - Refactored
setendings.pyto rely primarily on Astroid/Python’s built-in end-location attributes, reducing the amount of custom parsing logic - Fixed
test_html_server.pytests to be compatible with Windows - Updated
conftest.pyandtest_black.pyto be compatible with pytest v9, removing usage of some deprecated features. - Updated tests in
test_accumulation_table.pyto cover multi-loop behavior and added new cases - Updated to pylint v4.0 and astroid v4.0
[2.11.1] 2025-08-17
🐛 Bug fixes
- Fixed reports to only include config files when they have errors
[2.11.0] 2025-08-16
✨ Enhancements
- Support
x inandx not inpreconditions involvingset(),list(), andtuple()function calls in the Z3 parser. - Update the
output-formatconfiguration 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-optionsconfiguration option to let users specify command-line arguments to the Black formatting tool - Update
check_allandcheck_errorfunctions to let users pass intyping.IOobjects to theoutputargument - Update the
forbidden-io-function-checkerto check functions from imported modules as well as methods (according to their qualified name) - Update the
forbidden-io-function-checkerto 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_serverwhich recives the watch property changes through websockets and updates the HTML report - Added optional
on_verify_failargument tocheck_allandcheck_error, allowing users to raise aValueErrorand immediately stop execution when a file cannot be checked. - Enhanced CFG generation to support
matchstatements. - Added the optional
formatargument to theAccumulationTableclass, allowing users to select between csv or table formatted outputs. - Added optional
z3_enabledargument (default False) togenerate_cfg, allowing users to enablez3functionalities 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-loopcheck 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
SnapshotTracerbundled 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
snapshotfrom "latest" to "0.7.0"
💫 New checkers
infinite-loop: Provide an error message when awhileloop never terminates, indicating an infinite loop.
🐛 Bug fixes
- Introduced the IDTracker class to track unique IDs in memory model diagrams across multiple snapshots.
check_contractsno longer makes methods immediately enforce Representation Invariant checks when setting attributes of instances with the same type (oneNodemodifies anotherNodeinstance) and only checks RIs for these instances after the method returns.- Fixed error in
contractswhere comments in docstring assertions are not removed while parsing - Improved error message in
patches/transforms.pywhere 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-loopchecker 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
SnapshotTraceroutput 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_allfunction ensuring proper behaviour when handling inputs in package notation. - Improved
get_valid_files_to_checkfunction by removing unreachable code. - Refactored
test_check.pyto usepytest.mark.parametrizeannotation, improving test isolation and extracting inputs from test functions - Added test case to
test_check.pyfor better coverage ofcolour_messages_by_type - Removed unused imports from
python_tamodule - Wrapped type-only imports in if
TYPE_CHECKINGguards - Refactored
render_pep8_errorsto use a dict that maps error codes to error functions instead of repeated conditional statements - Added two test cases to
test_accumulation_table.pyto verify thatAccumulationTablecorrectly extracts loop variables from nested tuple structures. - Refactored
condition_logic_checker.py,cfg_generator.pyandgraph.pyby removing top-levelz3(and z3 related) imports and moving them inside of functions where needed. - Wrapped type-only
z3(and z3 related) imports in aTYPE_CHECKINGguard incondition_logic_checker.py,graph.pyandcfg_generator.py. - Added tests to improve coverage in
condition_logic_checker.py,graph.pyandcfg_generator.py, verifying behaviour in case of failedz3(and z3 related) import via import patching. - Added
z3_enabledoptional initializer argument (default False) toControlFlowGraphclass ingraph.pyandCFGVisitorclass invisitor.py. - Updated
transforms.pyto ensure the patched version ofpatch_ast_transformsdynamically reads thez3option from linter config to reflect correct runtime setting. - Simplified combined Z3 preconditions in
set_function_def_z3_constraintsusingz3.simplify - Refactored
one_shot_serverandpersistent_serverto allow for reuseablity. - Removed old unused files
- Linked the contributions list (README.md) in the pull request template
[2.10.1] 2025-02-19
🐛 Bug fixes
- Fix import error when
graphvizis not installed
[2.10.0] 2025-02-18
✨ Enhancements
- Added custom error message for
comparison-with-callable - Changed
pyta-template-fileargument to now resolve the file path relative to the CWD. - Added a watch configuration option to the HTML reporter for persistent server mode.
- Added
server-portconfiguration option to specify the port number to use when serving the PyTA HTML report. - Added new checker option
mypy-optionsinstatic-type-checkerto let users override default mypy command-line arguments - Added documentation for overriding messages
- Improved
check_contractserror messages by ensuring a consistent format and phrasing - Improved rendering of if/while/for syntax blocks in control flow graphs
- Ensured GraphViz-generated files have
.gvextension - Export
generate_cfgfrompython_ta.cfg - Move
check_allconfiguration info to logging DEBUG level (was INFO) - Update list of "error" checks
💫 New checkers
redundant-condition: Provide error message when a conditional statement within a function is guaranteed true. This checker requiresz3option to be turned on.impossible-condition: Provide error message when a conditional statement within a function is guaranteed false. This checker requiresz3option to be turned on.incompatible-argument-type: Provide an error message when a function argument has an incompatible type.incompatible-assignment: Provide an error message when there is an incompatible assignment.list-item-type-mismatch: Provide an error message when a list item has an incompatible type.unsupported-operand-types: Provide an error message when an operation is attempted between incompatible types.union-attr-error: Provide an error message when accessing an attribute that may not exist on a Union type.dict-item-type-mismatch: Provide an error message when a dictionary entry has an incompatible key or value type.
🐛 Bug fixes
- Fixed issue in
static-type-checkersuch that mypy no longer checks imported modules in the file being checked - Fixed issue in
autoformatwhere the defaultmax-line-lengthvalue was not used - Fixed issue in contract-checking
new_setattrwhere an instance attribute was not always reset when reassigning it to an invalid value - Fixed issue in
AccumulationTablewhere accumulation expressions could not refer to loop variables - Fixed issue in
snapshotwhere some imported objects were being included in the output - Fixed issue in
snapshotwhereNonewas not being rendered in SVG correctly
🔧 Internal changes
- Configured CI tests to run on environments with and without
z3dependency. - Refactored
script.jsto avoid using jQuery, and instead use vanilla Javascript functionality. - Configured CI to upload coverage report for both base and
z3test environments - Remove unnecessary calls to
node.stream()in raw file checkers (pycodestyle and static type checkers)
[2.9.2] 2025-01-16
🐛 Bug fixes
- Ignore annotation-only assignment statements in
redundant-assignmentcheck
[2.9.1] 2024-12-09
🐛 Bug fixes
- Added
python_ta/debug/webstepperto projectMANIFEST.in
[2.9.0] 2024-12-09
✨ Enhancements
- Added
include_framesfilter tosnapshot - Added
exclude_framesfilter tosnapshot - Added
exclude_varsfilter tosnapshot - Added new
python_ta.debugmodule with anSnapshotTracercontext manager for generating memory models - Added
z3option toinconsistent-or-missing-returns,redundant-assignment, andpossibly-undefinedcheckers to only check for feasible code blocks based on edge z3 constraints - Included the name of redundant variable in
E9959 redundant-assignmentmessage - Update to pylint v3.3 and and astroid v3.3. This added support for Python 3.13 and dropped support for Python 3.8. (No new checkers are enabled by default.)
- Added a STRICT_NUMERIC_TYPES configuration to
python_ta.contractsallowing to enable/disable stricter type checking of numeric types - Added integration with MemoryViz Webstepper
- Added
z3option toone-iteration-checkerto only check for feasible code blocks based on edge z3 constraints - Added reporting for errors raised by custom transforms (
Z3Visitor,CFGVisitor) - Ensured
SnapshotTracerdoes not include the_trace_funcstack frame - Enabled
SnapshotTracerto create itsoutput_directoryargument if it doesn't already exist - Changed
SnapshotTracer's Webstepper code line number to align with the source code line number
💫 New checkers
unmentioned-parameter: Provide error message when a function parameter is not mentioned by name in the function's docstring. By default, this checker is disabled.
🐛 Bug fixes
- Fixed issue where
snapshoterrors on unserializable values - Fixed issue within
Snapshot.pywhere thememory_viz_versionparameter was not respected - Fixed issue where parallel assignment statements and assignment to multiple targets were not checked by
redundant_assignment_checker - Fixed issue where annotated assignment statements were not checked by
redundant_assignment_checker - Fixed issue where empty preconditions were preventing CFGs from being generated
- Added strict numeric type checking to enforce type distinctions across the entire numeric hierarchy, including complex numbers.
- Added strict type checking support for nested and union types (e.g.,
list[int],dict[float, int],Union[int, float]) - Fixed issue where CFG edges from loop body to loop condition block was ignored during augmenting edge z3 constraints
- Fixed issue in
one-iteration-checkerwhere the message was not correctly reported forwhileloops whenz3option is on - Fixed crash when z3-solver is not installed
- Fixed crash when an inline comment had no spaces after the
#
🔧 Internal changes
- Renamed
ExprWrapperclass toZ3Parser - Renamed
ExprWrappermodule toz3_parserand moved it to new directorypython_ta.z3 - Removed
nodeattribute forZ3Parser - Renamed
reducemethod ofZ3Parsertoparse - Renamed
test_expr_wrappertotest_z3_parser - Added
is_feasibleattribute forCFGEdgeand implemented update to edge feasibility based on lists of Z3 constraints - Refactored codebase to use modern type annotations. Replaced
Listwithlist,Dictwithdict,Setwithset, andTuplewithtuple - Checked for variable reassignment in
AugAssignandAnnAssignnode in parsing edge Z3 constraints - Rendered logically infeasible control flow graph edges in light grey
- Modified
test_snapshot_to_json_sets_primitivefor Python 3.8 compatibility - Added unit tests for
one_iteration_checker - Added mock
webbrowser.openin tests to prevent browser tabs and HTTP requests duringpython_ta.check_all()executions. - Added
pytest-mockas a development dependency - Make
test_snapshot.py::test_snapshot_serializes_unserializable_valueable to run on Windows. - Added GitHub Action workflow for automatically publishing releases to PyPI
- Update
SnapshotTracertests to usememory-viz@0.5.0and prevent browser from opening - Updated bundled webstepper version and removed source map, and excluded the bundle from prettier pre-commit check
[2.8.1] 2024-08-19
🐛 Bug fixes
- Fix loading of setendings plugin when z3-solver is not installed
[2.8.0] 2024-08-19
WARNING: this release assumes that the z3-solver Python library is installed. Users are strongly encouraged to install v2.8.1 instead.
✨ Enhancements
- Add new boolean configuration
allow-local-importsto allow for local imports - Extended the
snasphotfunction to include the relevant variables defined at the top level (global variables). - Include the pycodestyle error code to the error message for PEP8 style errors
- Added date and time display to
PlainReporterandColorReporter - Allowed specifying allowed names in configurations
allowed-import-modulesandextra-importsinstead of just modules - Improved error display for pycodestyle (E9989) errors E123, E203, E222, E226, and E262
- Added the configuration option to ignore naming convention violations (C9103 and C9104) for names matching the provided regular expression.
- Update to pylint v3.1 and and astroid v3.1
- Stored actual AST condition node in edges leading out of If/While blocks in generated control flow graphs.
- Stored valid Python function preconditions in initial edge to function code in generated function control flow graphs.
- Report warning when control flow graph creation encounters a syntax error related to control flow
- Added autoformat option that runs black formatting tool to python_ta.check_all()
- Extended the
snapshotfunction to optionally generate a svg of the snapshot using MemoryViz when save parameter is true.
💫 New checkers
Pylint checkers v3.1:
use-yield-fromdeprecated-attribute
For more information on these checkers, please see the
Pylint release notes. Note that the above
list only contains the Pylint checkers enabled by default in PythonTA.
Custom checkers:
inconsistent-returnsandmissing-return-statement: Provide clearer error messages when reporting missing return statements. This replaces pylint's R1710 check.
🐛 Bug fixes
- Fixed issue with error message of C0410 by reformating it to properly fit with the list of modules imported that are provided to it
- Fixed bug where
_was marked as a built-in when running PythonTA after running doctest - Fixed issue where annotated constant variable assignment was not considered as permissible top level code and triggered error E9992
- Fixed issue where top level class attribute assignment was considered as permissible top level code
- Fixed issue where
check_contractsfails silently when function preconditions contain precondition violations, and when a representation invariant contains a call to a top-level function (not built-in or imported library). - Fixed issue where methods called in representation invariants lead to infinite recursion.
- Fixed issue where
PossiblyUndefinedCheckerraised an error if the control flow graph was invalid due to syntax error
🔧 Internal changes
- Updated changelog and pull request template formats
- Added unit tests for PEP8 errors E115, E122, E125, E127, E129, E131 for
PycodestyleChecker - Added unit tests for PEP8 errors E223, E224, E227, E228, E265 for
PycodestyleChecker - Refactored
test_check_on_dirintest_check.pymodule to test onsample_dir, a subset ofexamples - Added unit test
test_examples_files_pytaintest_examples.pyto check every file inexampleswith PythonTA - Added unit tests for PEP8 errors E266, E275, E301, E303, E304 for
PycodestyleChecker - Moved tests related to
__main__.pyfromtest_check.pytotest_main.py - Added more unit tests to
test_main.pyto increase coverage of__main__.pyto 100% - Updated
README.mdto reflect updated folder structure - Added unit test
test_pycodestyle_errors_pytaintest_examples.pyto check every file ine9989_pycodestylewith PythonTA for PEP8 errors - Parametrized tests for
PycodestyleChecker - Moved tests related to
snapshot.pyout oftest_accumulation_table.pyand into new moduletest_snapshot.py - Updated GitHub Action tests to avoid running
test_accumulation_table.pyandtest_recursion_table.pywith coverage and add verbose output for debug testing - Allowed GitHub Action tests to run on all pull requests, including drafts
- Updated dependencies for GitHub Actions to use the latest versions
- Updated dependabot configuration to auto-update dependencies for GitHub Actions in the future
- Updated usage messages in
examples/sample_usage/ofdraw_cfg.pyandprint_ast.pyto be accurate on all operating systems - Removed redundant line from
tests/test_examples.py - Fixed minor typo in an error message in
python_ta/cfg/visitor.py - Updated
ExprWrapperto supportset/list/tupleliterals andin/not inoperators - Updated
snapshot.pyandtest_snapshot.pyto align with MemoryViz 0.2.0 updates - Updated
ExprWrapperto support string variables and==,in/not in, indexing and slicing operators - Added protected
_z3_varsattribute toControlFlowGraphto store variables to be used in Z3 solver - Removed unused imports from
python_ta/cfg/graph.py - Extended functionality of
ExprWrapperclass to include function definitions' arguments and name assignments - Added
z3to dependencies installed as part of thedocsjob in the GitHub Actions workflow - Added tests to maintain/increase coverage of
visitor.py,graph.py, andExprWrapper.py - Removed deprecated and redundant
futureargument fromnode.frame()call ininvalid_name_checker.py - Updated pylint to v3.2.6 and astroid to v3.2.4 (no new checks were enabled by default)
- Excluded
node_modules/folder from package autodiscovery - Updated
graph.pyto augment control flow graph edges with z3 constraints - Added support for the
!=operator and replaced dictionary indexing with.getinExprWrapper. - Refactored
Z3Visitorto usesafe_infer()instead ofinferred()and added handling ofAstroidError. - Add
negateattribute toCFGEdge