[New-bugs-announce] [issue30728] IDLE: Modernize configdialog code.

Terry J. Reedy report at bugs.python.org
Wed Jun 21 19:36:55 EDT 2017


New submission from Terry J. Reedy:

Depending on the file, modernizing includes:
* Add docstrings.
* Change non-class names with caps to PEP8 no-caps names;
  this often means, for example, changing embedded 'A' to '_a'.
* Make most comments be sentences, like this sentence.  
* Review and possibly change overly cryptic existing PEP8 names.
* Switch to ttk widgets and revise imports; 'from tkinter import *'
  becomes 'from tkinter(.ttk) import item1, item2, ...';
  use (...\n...) for multiple lines.
* Split a toplevel class into a window class and a frame class.
* Use modern code idioms and features up to current maintenance version.
* Add tests, which are essential for checking correctness of above.

For a large file like configdialog.py, I would like a separate PR or even issue for each item above.  Of necessity, name changes must be done  in test_configdialog.py, and it should be included in most patches for this issue.  For some files, other consumers will also need patching. I don't think that modules other than test_configdialog access much of anything beside ConfigDialog, which name we are not presently changing. 

Cheryl's original patch for this issue combined conversion to pep8 names, revision of pep8 names (including existing #28523 'colour' to 'color'), and tkk and import conversion (and an unrelated typo correction in another file).  Louie suggested adding comment revisions.  At this point, I decided that this would be too much for one patch and that I would prefer more numerous patches that would be easier to review and test.  (Louie's comments should be the basis for a separate PR.) Issue 28523 can be made a dependency of this issue and expanded to other name revisions.

The order of changes is somewhat arbitrary, except that docstrings and comments do not need tests, and can be helpful for writing tests.  Tests of some type are otherwise needed for the other steps.  This presents a problem when code changes are needed to write tests. What is true is that each patch needs to apply to the current file, and once applied, should be backported immediately.  (Out of order backports can 'work' but produce a wrong result.  This happened already.)

The problem of multiple patches to the same file possibly breaking each other includes exist patches on the tracker.  When we changed textview, there were no outstanding patches that I know of.  For help_about, there is an existing patch, but I did not want to apply it completely as is.  Pieces of it will have to be adapted as needed.  For config_key, there are at least 2 patches that may be ready-to-go or close to it.  So I want to test those before writing additional patches to modernize config_key.

I will review current config-dialog issues to see which have patches and which might be quick to apply.

----------
messages: 296603
nosy: csabella, louielu, terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: IDLE: Modernize configdialog code.
type: enhancement
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30728>
_______________________________________


More information about the New-bugs-announce mailing list