Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add idlelib.interface module #71349

Closed
terryjreedy opened this issue May 31, 2016 · 3 comments
Closed

Add idlelib.interface module #71349

terryjreedy opened this issue May 31, 2016 · 3 comments
Assignees
Labels
topic-IDLE type-feature A feature request or enhancement

Comments

@terryjreedy
Copy link
Member

BPO 27162
Nosy @terryjreedy

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/terryjreedy'
closed_at = <Date 2017-06-23.04:10:21.384>
created_at = <Date 2016-05-31.06:46:46.909>
labels = ['expert-IDLE', 'type-feature']
title = 'Add idlelib.interface module'
updated_at = <Date 2017-06-23.04:10:21.382>
user = 'https://github.com/terryjreedy'

bugs.python.org fields:

activity = <Date 2017-06-23.04:10:21.382>
actor = 'terry.reedy'
assignee = 'terry.reedy'
closed = True
closed_date = <Date 2017-06-23.04:10:21.384>
closer = 'terry.reedy'
components = ['IDLE']
creation = <Date 2016-05-31.06:46:46.909>
creator = 'terry.reedy'
dependencies = []
files = []
hgrepos = []
issue_num = 27162
keywords = []
message_count = 3.0
messages = ['266739', '267179', '296668']
nosy_count = 1.0
nosy_names = ['terry.reedy']
pr_nums = []
priority = 'normal'
resolution = 'rejected'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue27162'
versions = ['Python 3.6']

@terryjreedy
Copy link
Member Author

In msg243635 of the renaming issue bpo-24225, Nick suggested

"One path you may want to consider is progressively factoring out a public "idlelib.extensions" API, and treat everything else in idlelib as fair game for renaming. Folks tend to be more tolerant of disruption if the new state of affairs is also clearly better for them, not just the folks making the change."

This issue is an implementation of that idea, except that I want to reserve 'extension' for modules added by 3rd parties using the extension interface. The new module would consist of callables that make builtin IDLE features available to non-IDLE tkinter code.

The first callable would replace the following from turtledemo.__main__

from idlelib.colorizer import ColorDelegator, color_config
from idlelib.percolator import Percolator
...
        Percolator(self.text).insertfilter(ColorDelegator())
...
        color_config(text)

with

from idlelib.interface import colorize
...
        colorize(text)

At the moment, interface would have the imports and

def colorize(text):
    color_config(text)
    Percolator(self.text).insertfilter(ColorDelegator())

Future enhancements might be to accept a color scheme name and to return the Percolator instance (or a wrapper thereof), but these would not break code. In any case, colorize would be re-written if the needed incantation changed, and turtledemo would continue to work without change.

An new public module should not be backported for the usual reasons. New callables should also not be added except in comments. I plan to only add features that are requested, and perhaps a very few others, rather than everything and everything possible.

@terryjreedy terryjreedy self-assigned this May 31, 2016
@terryjreedy terryjreedy added the type-feature A feature request or enhancement label May 31, 2016
@terryjreedy
Copy link
Member Author

Import should fail if tk.TkVersion < 8.5.

@terryjreedy
Copy link
Member Author

Nick later suggested against this, and in the absence of requests, I don't want to do this, at least not before 3.7, if ever. What if we make a change that makes the public promise awkward? The docstring for colordelegator should say how it is used (in IDLE and turtledemo). Anyone else interested could follow the instructions, at their own risk, not mine.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-IDLE type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants