Recent Releases of python-ta
python-ta - [2.11.1] 2025-08-17
🐛 Bug fixes
- Fixed reports to only include config files when they have errors
- Python
Published by david-yz-liu 7 months ago
python-ta - [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
- Python
Published by david-yz-liu 7 months ago
python-ta - [2.10.1] 2025-02-19
🐛 Bug fixes
- Fix import error when
graphvizis not installed
- Python
Published by david-yz-liu about 1 year ago
python-ta - [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)
- Python
Published by david-yz-liu about 1 year ago
python-ta - [2.9.2] 2025-01-16
🐛 Bug fixes
- Ignore annotation-only assignment statements in
redundant-assignmentcheck
- Python
Published by david-yz-liu about 1 year ago
python-ta - [2.9.1] 2024-12-09
🐛 Bug fixes
- Added
python_ta/debug/webstepperto projectMANIFEST.in
- Python
Published by david-yz-liu about 1 year ago
python-ta - [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 STRICTNUMERICTYPES 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
- Python
Published by david-yz-liu about 1 year ago
python-ta - [2.8.1] 2024-08-19
🐛 Bug fixes
- Fix loading of setendings plugin when z3-solver is not installed
- Python
Published by david-yz-liu over 1 year ago
python-ta - [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 pythonta.checkall()
- 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
- Python
Published by david-yz-liu over 1 year ago
python-ta - [2.7.0] 2023-12-14
Enhancements
- Added new configuration option
use-pyta-error-messagesto let users choose whether PythonTA should overwrite pylint's error messages. - Both PlainReporter and ColorReporter emphasize specific code chunks by using overline characters under any part that is highlighted as ERROR.
- Added snapshot function for deriving a list of dictionaries containing local variables from relevant functions and/or stack frames.
- Added new configuration option
allow-pylint-commentsto let users choose whether PythonTA should allow comments beginning with pylint: or not. AccumulationTablecan now track variables initialized within theforloop. Prior, only variables initialized before theforloop could be tracked.AccumulationTablenow stores deep copies of objects rather than shallow copies, thus fixing issues that come up in case of mutation during loop.AccumulationTablecan now take in any accumulator expressions, for eg.x * 2, instead of just variables.AccumulationTablenow has an optional initialization argumentoutputwhich allows the users to choose whether they want to write the Accumulation Table to a file.- Created a
RecursionTablecontext manager for recursive tracing using a tabular output. - Support Python 3.12 (requiring upgrade to pylint and astroid 3.0)
Bug fixes
- Fix bug in ending location setting for
AttributeandDelAttrnodes when the same attribute was accessed twice on the same line. - Fix bug where the
naming-convention-violationchecker was checking variables defined in a module's main block. This was inconsistent with theforbidden-global-variableschecker. - Fixed bug with
invalid-range-index: do not attempt any inference of variables inrangeexpressions. All range arguments involving variables will be ignored by this checker.
New checkers
Pylint checkers v3.0:
invalid-field-callreturn-in-finallykwarg-superseded-by-positional-argunnecessary-negation(renamed fromunneeded-not)
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.
Internal
- Remove experimental type inference code.
- Python
Published by david-yz-liu about 2 years ago
python-ta - [2.6.4] 2023-11-10
Bug fixes
- Fixed bug with
invalid-range-indexwhen variables are used inrangeexpressions.
- Python
Published by david-yz-liu over 2 years ago
python-ta - [2.6.3] - 2023-10-09
Bug fixes
- Ensure pycodestyle W503, line break before binary operator, is disabled (regression from 2.6.2).
- Fix
check_contractstypings so PyCharm static checking will work - Fix
invalid-range-indexbug where valid range calls were flagged as invalid
- Python
Published by david-yz-liu over 2 years ago
python-ta - [2.6.2] - 2023-09-22
Bug fixes
- Fix
naming-convention-violationbug where_was considered an invalid variable name. - Fix
naming-convention-violationbug where top-level constants were being checked as regular variable names.
Enhancements
- Created many custom renderers to make the code snippets for
pep8-errorseasier to understand.
- Python
Published by david-yz-liu over 2 years ago
python-ta - [2.6.1] - 2023-08-13
Bug fixes
- Make graphviz an optional dependency, and clarify the installation requirements for visualizing control flow graphs.
- Fix handling of forward references in class type annotations when using check_contracts decorator.
- Fix handling of | in type annotations (by updating to typeguard v4.1.0).
- Python
Published by david-yz-liu over 2 years ago
python-ta - [2.6.0] - 2023-08-06
Updated 2023/08/13: This release required the graphviz Python library to be installed, but this library was not listed as a project dependency. graphviz has been moved to be an optional dependency in 2.6.1.
Enhancements
- Can now create control flow graphs using
python_ta.control_flow_graphsto visualize the execution paths of Python code. forbidden-top-level-codeandforbidden-global-variablesnow allow top-level type alias assignment statements.- The
trailing-whitespaceerror message now highlights the trailing whitespace. - The
unnecessary-indexingerror now checks for a greater variety of loop/comprehension indexes. - Provided configuration files are now merged with PythonTA defaults, so you now only need to specify options that you want to be overridden. To ignore PythonTA defaults (the old behaviour), pass
load_default_config=Falsetocheck_errorsandcheck_all. - Improved the code snippets for the
pep8-errors"blank line" messages. Extra blank lines are now highlighted, and suggestions are added when blank lines are missing. - The default value of the
pyta-number-of-messagesconfiguration option is now 0 (changed from 5) This causes all error occurrences to be displayed. - Improved efficiency of the contract-checking custom
setattrfor classes. - Added new function
python_ta.contracts.validate_invariantsto manually check contracts for an object. - Updated to pycodestyle v2.11.
Bug Fixes
- Fixed bug where running
python3 -m python_ta --generate-configyields aFileNotFoundError. - Fixed bug in how PythonTA reports error messages that occur when parsing configuration files.
- Ensured some config file parsing errors no longer display incorrect lines in the error report.
- Fixed bug where the
HTMLReporterandJSONReporterwould ignore thepyta-number-of-messagesoption and always display all error occurrences. - Fixed bug in
check_contractswhere imported classes were not correctly resolved when checking types. - Fixed bug for class contract-checking when assigning an instance attribute that violates a class type constraint or representation invariant. Previously, the instance attribute changed to the new value after the error was raised, but now is correctly restored to the original value.
- Remove line double-spacing in PlainReporter and ColorReporter output code snippets.
New checkers
Custom checkers:
invalid-name-checker: Provide beginner-friendly error messages when reporting variable names that violate Python naming conventions. This replaces pylint's C0103 check.
Pylint checkers v2.16:
pointless-exception-statementshadowed-importunbalanced-dict-unpackingnested-min-maxinvalid-slice-step
Pylint checkers v2.17:
bad-chained-comparison
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.
- Python
Published by david-yz-liu over 2 years ago
python-ta - [2.5.0] - 2023-04-27
Bug fixes
- Fixed bug in possibly-undefined checker where a comprehension variable is falsely flagged as possibly undefined.
- Fixed bug where
check_errorsandcheck_allopens a webpage when a nonexistent or unreadable path is passed as an argument. - Fixed the CFG implementation to resolve a bug in the possibly-undefined checker where variables were falsely flagged as possibly undefined when the code conditionally raises an exception and the variable was referenced afterwards.
- Fixed bug where the generated CFGs will highlight the except block as unreachable if the same exception it is handling was raised in the body of the tryexcept.
New checkers
Custom checkers:
forbidden-python-syntax: Flag code that is not permitted to be used on an assessment.
Other
- Pin dependency versions
- Python
Published by david-yz-liu almost 3 years ago
python-ta - [2.4.2] - 2023-01-31
Bug fixes
- Fixed custom message formats based on Pylint 2.15 updates.
- Fixed bug in shadowing-in-comprehension checker when target is a subscript node.
- Ensured
check_contractsandcheck_all_contractsdo nothing whenENABLE_CONTRACT_CHECKINGisFalse.
- Python
Published by david-yz-liu about 3 years ago
python-ta - [2.4.1] - 2023-01-13
Bug fixes
- Fixed PyTA contract checking for method calls when running modules in PyCharm using the "Run File in Python Console" action.
- Python
Published by david-yz-liu about 3 years ago
python-ta - [2.4.0] - 2022-12-21
Enhancements
unnecessary_indexing_checkerhas now been extended to check comprehensions in addition to for loops.invalid_for_target_checkerhas now been extended to check comprehensions in addition to for loops.forbidden_io_function_checkeris now able to check for calls to IO functions written at the top-level of a module, but outside the main block.python_ta.debug.AccumulationTableis extended to support printing loop iterations for while loops.- Violated representation invariant error message now includes the class name and current values of the instance attributes.
- Added constant
python_ta.contracts.ENABLE_CONTRACT_CHECKINGto only check contracts when its value is set toTrue. python_ta.debug.AccumulationTablehas extended loop detection to allow the loop to appear anywhere inside the with statement.
Bug Fixes
- Fixed Issue #831: Contract Checker Bug. Now raises
AssertionErrorwhen the expected type isfloatbut gotintinstead. - PyTA contracts' type checking now raises
AssertionErrorwhen the expected type isintbut gotboolinstead. - Fixed PyTA contract checking when running modules in PyCharm using the "Run File in Python Console" action.
New checkers
Custom checkers:
forbidden-top-level-code: Flag code written at the top level when it is not one of the four acceptable types.
- Python
Published by david-yz-liu about 3 years ago
python-ta - [2.3.3] - 2022-09-05
Bug fixes
- Restored 'lineend', 'columnend', and 'snippet' fields in JSON reporter output.
- Python
Published by david-yz-liu over 3 years ago
python-ta - [2.3.2] - 2022-08-30
Bug fixes
- Updated jsonreporter to get data from the new pylint Message class (#840)
Experimental
- Added preliminary support for translation of constraints into Z3 solver. (This is currently not enabled by default in PythonTA.)
- Python
Published by david-yz-liu over 3 years ago
python-ta - [2.3.1] 2022-08-08
Bug fixes
- Add missing
tomlpackage to library dependencies. Users who installed 2.3.0 should upgrade to 2.3.1 or will need to installtomlmanually. - Improve formatting of
Noneandfloats inAccumulationTabledisplay. Also make minor improvements to the documentation.
- Python
Published by david-yz-liu over 3 years ago
python-ta - [2.3.0] - 2022-08-08
Enhancements
- Added new command line argument
-v/--version. User can print out current PythonTA version usingpython -m python_ta -v. - Preconditions, postconditions, and representation invariants are now parsed only once and compiled.
- Can configure custom error messages for pylint in a toml file.
missing_space_in_doctest_checkeris now able to check doctests in python modules and classes.- Updated to Pylint v2.14. See "New checks" below for the new checkers enabled by default.
- Added new
python_ta.debugmodule with anAccumulationTablecontext manager for loop print debugging. - Improve message for R1710 (inconsistent-return-statements)
Bug fixes
- Function
check_all_contractsskips contract checks for functions and classes which are not defined in a module whose name is passed as an argument. Ifdecorate_mainargument isTrue, functions and classes defined in__main__module will be checked without needing to pass in additional arguments.
New checkers
Custom checkers:
type-is-assigned: Flag when a type is not annotated but rather assigned in a function or class definition.
Pylint checkers v2.13:
modified-iterating-listmodified-iterating-dictmodified-iterating-setunnecessary-ellipsisbad-file-encoding
Pylint checkers v2.14:
comparison-of-constantspotential-index-errorunnecessary-list-index-lookupduplicate-valuesuper-without-brackets
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.
- Python
Published by david-yz-liu over 3 years ago
python-ta - [2.2.0] - 2021-12-09
Enhancements
- Added support for postconditions in function docstring.
- Improve error message of
unncessary-indexingchecker. - Added CLI for
python_ta.contractsmodule for executing a file with contract checking ($ python -m python_ta.contracts FILE) - Added two new command line interfaces. User can print out the default PythonTA configuration file in the command line using
python -m python_ta -gand can specify the output format of the reporter usingpython -m python_ta --output-format FILE. - Updated to Pylint v2.12. See "New checks" below for the new checkers enabled by default.
- Register ending location setter as pylint plugin.
Bug fixes
- Fix bugs in
unnecessary-indexingchecker:- False positive when the same loop variable is used in two loops in sequence.
- False negative when the loop variable can be simplified, but is also shadowed in the the loop body.
- Fix HTML report to link correctly to specific errors on the PythonTA documentation website.
- Fix bug when setting ending locations for
ClassDefs that have no decorators.
New checkers
Pylint checkers v2.12:
use-implicit-booleaness-not-len(renamed fromlen-as-condition)
Pylint checkers v2.11:
consider-using-f-string
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.
- Python
Published by david-yz-liu about 4 years ago
python-ta - [2.1.1] - 2021-09-23
Bug fixes
- Fix HTML report to display file even when no errors are found.
- Fix pylint cache directory creation (backport of change from pylint 2.11)
- Python
Published by david-yz-liu over 4 years ago
python-ta - [2.1.0] - 2021-09-16
Enhancements
- Added lineend and columnend to JSONReporter output.
- Python
Published by david-yz-liu over 4 years ago
python-ta - [2.0.0] - 2021-08-24
PythonTA's adopting semantic versioning as of this release, so we've bumped the version to 2.0.
Enhancements
- Added basic CLI. Users can now run PythonTA in the command line either as a standalone script (
$ python_ta my_file) or as a Python module ($ python -m python_ta my_file). - Added new documentation website, hosted at https://www.cs.toronto.edu/~david/pyta.
- Added support for relative paths in
outputargument tocheck_all. - Added new configuration option
pycodestyle-ignoreto customize the pycodestyle errors checked bypep8-errors.
Changes
- Changed HTML report template to make it more user-friendly.
- Changed default HTML report output: by default now loads in a web browser without creating a temporary file (previously,
pyta_report.html). This file can still be generated by passingoutput='pyta_report.html'to calls tocheck_all. - Added new
output-formatoption to specify reporter class. - Changed API of PythonTA custom reporters.
- Updated to Pylint v2.10. See "New checks" below for the new checks enabled by default.
- Renamed
for-target-subscriptchecker toinvalid-for-target, and added support checking for loop targets that are attributes (e.g.,for obj.x in [1, 2, 3]). (#701)
Bug fixes
- Fixed bug with
python_ta.contracts: do not check representation invariants when a helper method is called within an initializer. - Fixed bug with
python_ta.contracts: do not check class representation invariants in the initializer of a superclass. - Fixed bug with
shadowing-in-comprehensionchecker: do not treat_as a shadowed variable. - Fixed bug with
unnecessary-indexingchecker: handle case where loop variable is first assigned before the for loop. (#699) - Fixed bug where PythonTA would crash on files that used encodings other than UTF-8. PythonTA now reports an error and displays the invalid characters to the user.
Deprecations
- Deprecated
pyta-reporteroption; useoutput-formatinstead.
New checkers
Custom checkers:
missing-space-in-doctest: Flag when a doctest prompt (>>>) is not followed by a space. E.g.,>>>my_function(1).
Pylint checkers v2.10:
forgotten-debug-statementformat-string-without-interpolationuse-dict-literaluse-list-literal
Pylint checkers v2.9:
consider-using-from-importunnecessary-dict-index-lookup
Pylint checkers v2.8:
consider-using-with
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.
Internal
- Adopted semantic versioning.
- Created a Changelog.
- Added pre-commit hooks using pre-commit, black, isort, and prettier.
- Adopted Sphinx for documentation generation, using a Read the Docs template.
- Adopted
setup.cfgfile for configuration.
- Python
Published by david-yz-liu over 4 years ago